improving calendar
This commit is contained in:
@@ -10,9 +10,6 @@
|
||||
<UseXPManifest Value="True"/>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<StringTable ProductVersion=""/>
|
||||
</VersionInfo>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
@@ -38,6 +35,7 @@
|
||||
<Filename Value="scanner.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="ScanForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
|
||||
@@ -3,9 +3,9 @@ program Belegscanner;
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, scanner
|
||||
{ you can add units after this };
|
||||
|
||||
105
Belegscanner.lps
105
Belegscanner.lps
@@ -3,23 +3,24 @@
|
||||
<ProjectSession>
|
||||
<Version Value="10"/>
|
||||
<BuildModes Active="Default"/>
|
||||
<Units Count="6">
|
||||
<Units Count="9">
|
||||
<Unit0>
|
||||
<Filename Value="Belegscanner.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<CursorPos X="17" Y="10"/>
|
||||
<UsageCount Value="20"/>
|
||||
<CursorPos X="11" Y="8"/>
|
||||
<UsageCount Value="27"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="ScanForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<IsVisibleTab Value="True"/>
|
||||
<TopLine Value="54"/>
|
||||
<CursorPos X="159" Y="97"/>
|
||||
<UsageCount Value="20"/>
|
||||
<TopLine Value="10"/>
|
||||
<CursorPos Y="50"/>
|
||||
<UsageCount Value="27"/>
|
||||
<Loaded Value="True"/>
|
||||
<LoadedDesigner Value="True"/>
|
||||
</Unit1>
|
||||
@@ -28,7 +29,7 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="119"/>
|
||||
<CursorPos X="14" Y="151"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit2>
|
||||
<Unit3>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/extdlgs.pas"/>
|
||||
@@ -36,7 +37,7 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="175"/>
|
||||
<CursorPos X="29" Y="215"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit3>
|
||||
<Unit4>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/stdctrls.pp"/>
|
||||
@@ -44,137 +45,159 @@
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="389"/>
|
||||
<CursorPos X="14" Y="437"/>
|
||||
<UsageCount Value="10"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit4>
|
||||
<Unit5>
|
||||
<Filename Value="/usr/share/fpcsrc/3.0.4/packages/fcl-process/src/process.pp"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="99"/>
|
||||
<CursorPos X="14" Y="131"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit5>
|
||||
<Unit6>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/interfaces/gtk2/gtk2int.pas"/>
|
||||
<UnitName Value="Gtk2Int"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="811"/>
|
||||
<CursorPos Y="852"/>
|
||||
<UsageCount Value="9"/>
|
||||
</Unit6>
|
||||
<Unit7>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/graphics.pp"/>
|
||||
<UnitName Value="Graphics"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="1426"/>
|
||||
<CursorPos X="15" Y="1478"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit7>
|
||||
<Unit8>
|
||||
<Filename Value="/usr/lib/lazarus/1.8.2/lcl/include/fpimagebitmap.inc"/>
|
||||
<EditorIndex Value="-1"/>
|
||||
<TopLine Value="100"/>
|
||||
<CursorPos Y="141"/>
|
||||
<UsageCount Value="10"/>
|
||||
</Unit8>
|
||||
</Units>
|
||||
<JumpHistory Count="30" HistoryIndex="29">
|
||||
<Position1>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="172" Column="11" TopLine="71"/>
|
||||
<Caret Line="115" Column="25" TopLine="61"/>
|
||||
</Position1>
|
||||
<Position2>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="173" Column="45" TopLine="120"/>
|
||||
<Caret Line="58" Column="57" TopLine="17"/>
|
||||
</Position2>
|
||||
<Position3>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="179" TopLine="139"/>
|
||||
<Caret Line="101" Column="63" TopLine="61"/>
|
||||
</Position3>
|
||||
<Position4>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="175" TopLine="138"/>
|
||||
<Caret Line="109" Column="30" TopLine="69"/>
|
||||
</Position4>
|
||||
<Position5>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="154" Column="5" TopLine="138"/>
|
||||
<Caret Line="208" Column="15" TopLine="199"/>
|
||||
</Position5>
|
||||
<Position6>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="30" Column="73"/>
|
||||
<Caret Line="214" Column="15" TopLine="199"/>
|
||||
</Position6>
|
||||
<Position7>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="140" Column="144" TopLine="137"/>
|
||||
<Caret Line="241" Column="104" TopLine="199"/>
|
||||
</Position7>
|
||||
<Position8>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="132" Column="3" TopLine="126"/>
|
||||
<Caret Line="97" Column="54" TopLine="40"/>
|
||||
</Position8>
|
||||
<Position9>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="107" Column="27" TopLine="96"/>
|
||||
<Caret Line="75" Column="122" TopLine="35"/>
|
||||
</Position9>
|
||||
<Position10>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="141" Column="32" TopLine="118"/>
|
||||
<Caret Line="18" Column="14" TopLine="5"/>
|
||||
</Position10>
|
||||
<Position11>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="142" Column="32" TopLine="119"/>
|
||||
<Caret Line="102" Column="18" TopLine="69"/>
|
||||
</Position11>
|
||||
<Position12>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="143" Column="32" TopLine="120"/>
|
||||
<Caret Line="105" Column="24" TopLine="64"/>
|
||||
</Position12>
|
||||
<Position13>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="144" Column="32" TopLine="121"/>
|
||||
<Caret Line="9" Column="27"/>
|
||||
</Position13>
|
||||
<Position14>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="145" Column="32" TopLine="122"/>
|
||||
<Caret Line="125" Column="25" TopLine="64"/>
|
||||
</Position14>
|
||||
<Position15>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="146" Column="32" TopLine="123"/>
|
||||
<Caret Line="141" Column="178" TopLine="85"/>
|
||||
</Position15>
|
||||
<Position16>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="147" Column="32" TopLine="124"/>
|
||||
<Caret Line="122" Column="9" TopLine="73"/>
|
||||
</Position16>
|
||||
<Position17>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="18" Column="12"/>
|
||||
<Caret Line="123" Column="30" TopLine="68"/>
|
||||
</Position17>
|
||||
<Position18>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="36" Column="61"/>
|
||||
<Caret Line="125" Column="18" TopLine="83"/>
|
||||
</Position18>
|
||||
<Position19>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="171" Column="79" TopLine="156"/>
|
||||
<Caret Line="85" Column="5" TopLine="61"/>
|
||||
</Position19>
|
||||
<Position20>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="202" Column="3" TopLine="162"/>
|
||||
<Caret Line="86" Column="5" TopLine="62"/>
|
||||
</Position20>
|
||||
<Position21>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="124" Column="63" TopLine="108"/>
|
||||
<Caret Line="85" Column="5" TopLine="61"/>
|
||||
</Position21>
|
||||
<Position22>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="196" Column="89" TopLine="164"/>
|
||||
<Caret Line="84" Column="5" TopLine="60"/>
|
||||
</Position22>
|
||||
<Position23>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="67" Column="27" TopLine="31"/>
|
||||
<Caret Line="179" TopLine="139"/>
|
||||
</Position23>
|
||||
<Position24>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="69" Column="34" TopLine="34"/>
|
||||
<Caret Line="270" TopLine="84"/>
|
||||
</Position24>
|
||||
<Position25>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="74" Column="17" TopLine="36"/>
|
||||
<Caret Line="51" Column="20" TopLine="11"/>
|
||||
</Position25>
|
||||
<Position26>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="79" Column="66" TopLine="36"/>
|
||||
<Caret Line="175" Column="53" TopLine="111"/>
|
||||
</Position26>
|
||||
<Position27>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="74" Column="28" TopLine="41"/>
|
||||
<Caret Line="174" Column="53" TopLine="110"/>
|
||||
</Position27>
|
||||
<Position28>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="97" Column="69" TopLine="59"/>
|
||||
<Caret Line="148" Column="26" TopLine="110"/>
|
||||
</Position28>
|
||||
<Position29>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="74" Column="77" TopLine="65"/>
|
||||
<Caret Line="176" Column="28" TopLine="136"/>
|
||||
</Position29>
|
||||
<Position30>
|
||||
<Filename Value="scanner.pas"/>
|
||||
<Caret Line="9" Column="17"/>
|
||||
<Caret Line="266" Column="5" TopLine="212"/>
|
||||
</Position30>
|
||||
</JumpHistory>
|
||||
</ProjectSession>
|
||||
|
||||
148
scanner.lfm
148
scanner.lfm
@@ -1,70 +1,50 @@
|
||||
object ScanForm: TScanForm
|
||||
Left = 1901
|
||||
Height = 180
|
||||
Top = 631
|
||||
Width = 663
|
||||
Left = 1534
|
||||
Height = 1018
|
||||
Top = 299
|
||||
Width = 1215
|
||||
Caption = 'Belegscanner'
|
||||
ClientHeight = 180
|
||||
ClientWidth = 663
|
||||
ClientHeight = 1018
|
||||
ClientWidth = 1215
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.8.2.0'
|
||||
object DateView: TLabel
|
||||
Left = 8
|
||||
Height = 19
|
||||
Top = 8
|
||||
Width = 150
|
||||
Caption = 'Datum auswählen!'
|
||||
Font.Height = -16
|
||||
Font.Name = 'Sans'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object dateButton: TButton
|
||||
Left = 232
|
||||
Height = 25
|
||||
Top = 8
|
||||
Width = 75
|
||||
Caption = 'ändern'
|
||||
OnClick = dateButtonClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object TypeSelector: TComboBox
|
||||
Left = 8
|
||||
Left = 344
|
||||
Height = 29
|
||||
Top = 40
|
||||
Top = 32
|
||||
Width = 216
|
||||
Enabled = False
|
||||
ItemHeight = 0
|
||||
OnChange = TypeSelectorChange
|
||||
TabOrder = 1
|
||||
TabOrder = 3
|
||||
Text = 'Select Type'
|
||||
end
|
||||
object Origin: TComboBox
|
||||
Left = 232
|
||||
Left = 568
|
||||
Height = 29
|
||||
Top = 40
|
||||
Width = 184
|
||||
Top = 32
|
||||
Width = 192
|
||||
Enabled = False
|
||||
ItemHeight = 0
|
||||
OnChange = OriginChange
|
||||
TabOrder = 2
|
||||
TabOrder = 5
|
||||
Text = 'Start'
|
||||
end
|
||||
object Destination: TComboBox
|
||||
Left = 424
|
||||
Left = 948
|
||||
Height = 29
|
||||
Top = 40
|
||||
Top = 32
|
||||
Width = 196
|
||||
Enabled = False
|
||||
ItemHeight = 0
|
||||
OnChange = DestinationChange
|
||||
TabOrder = 3
|
||||
TabOrder = 7
|
||||
Text = 'Ziel'
|
||||
end
|
||||
object FolderName: TLabel
|
||||
Left = 8
|
||||
Left = 344
|
||||
Height = 19
|
||||
Top = 96
|
||||
Top = 64
|
||||
Width = 103
|
||||
Caption = 'Ordnername'
|
||||
Font.Height = -16
|
||||
@@ -73,10 +53,10 @@ object ScanForm: TScanForm
|
||||
ParentFont = False
|
||||
end
|
||||
object Product: TComboBox
|
||||
Left = 232
|
||||
Left = 568
|
||||
Height = 29
|
||||
Top = 40
|
||||
Width = 184
|
||||
Top = 32
|
||||
Width = 192
|
||||
Enabled = False
|
||||
ItemHeight = 0
|
||||
OnChange = ProductChange
|
||||
@@ -84,74 +64,75 @@ object ScanForm: TScanForm
|
||||
Text = 'Produkt'
|
||||
Visible = False
|
||||
end
|
||||
object ScnaButton: TButton
|
||||
Left = 545
|
||||
Height = 25
|
||||
Top = 72
|
||||
Width = 75
|
||||
object ScanButton: TButton
|
||||
Left = 664
|
||||
Height = 49
|
||||
Top = 88
|
||||
Width = 112
|
||||
Caption = 'scannen!'
|
||||
Enabled = False
|
||||
OnClick = ScnaButtonClick
|
||||
TabOrder = 5
|
||||
OnClick = ScanButtonClick
|
||||
TabOrder = 8
|
||||
end
|
||||
object IWidth: TEdit
|
||||
Left = 320
|
||||
Left = 344
|
||||
Height = 27
|
||||
Top = 8
|
||||
Top = 88
|
||||
Width = 80
|
||||
Alignment = taRightJustify
|
||||
TabOrder = 6
|
||||
TabOrder = 0
|
||||
Text = '209'
|
||||
end
|
||||
object Times: TLabel
|
||||
Left = 402
|
||||
Left = 426
|
||||
Height = 17
|
||||
Top = 13
|
||||
Top = 93
|
||||
Width = 6
|
||||
Caption = 'x'
|
||||
ParentColor = False
|
||||
end
|
||||
object IHeight: TEdit
|
||||
Left = 416
|
||||
Left = 440
|
||||
Height = 27
|
||||
Top = 8
|
||||
Top = 88
|
||||
Width = 80
|
||||
TabOrder = 7
|
||||
TabOrder = 1
|
||||
Text = '297'
|
||||
end
|
||||
object Pixels: TLabel
|
||||
Left = 500
|
||||
Left = 524
|
||||
Height = 17
|
||||
Top = 13
|
||||
Top = 93
|
||||
Width = 27
|
||||
Caption = 'px @'
|
||||
ParentColor = False
|
||||
end
|
||||
object Resolution: TComboBox
|
||||
Left = 536
|
||||
Left = 560
|
||||
Height = 29
|
||||
Top = 8
|
||||
Top = 88
|
||||
Width = 68
|
||||
ItemHeight = 0
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'150'
|
||||
'300'
|
||||
)
|
||||
TabOrder = 8
|
||||
TabOrder = 2
|
||||
Text = '150'
|
||||
end
|
||||
object DPI: TLabel
|
||||
Left = 608
|
||||
Left = 632
|
||||
Height = 17
|
||||
Top = 13
|
||||
Top = 93
|
||||
Width = 17
|
||||
Caption = 'dpi'
|
||||
ParentColor = False
|
||||
end
|
||||
object BaseFolder: TLabel
|
||||
Left = 8
|
||||
Left = 344
|
||||
Height = 19
|
||||
Top = 76
|
||||
Top = 8
|
||||
Width = 88
|
||||
Caption = 'BaseFolder'
|
||||
Font.Height = -16
|
||||
@@ -160,15 +141,36 @@ object ScanForm: TScanForm
|
||||
ParentFont = False
|
||||
OnClick = BaseFolderClick
|
||||
end
|
||||
object DateSelector: TCalendarDialog
|
||||
Date = 43775
|
||||
OKCaption = '&Ok'
|
||||
CancelCaption = 'Abbrechen'
|
||||
left = 352
|
||||
top = 72
|
||||
object Stop: TComboBox
|
||||
Left = 768
|
||||
Height = 29
|
||||
Top = 32
|
||||
Width = 176
|
||||
Enabled = False
|
||||
ItemHeight = 0
|
||||
OnChange = StopChange
|
||||
TabOrder = 6
|
||||
Text = 'Zwischenhalt'
|
||||
end
|
||||
object Preview: TImage
|
||||
Left = 8
|
||||
Height = 800
|
||||
Top = 208
|
||||
Width = 1200
|
||||
Center = True
|
||||
Proportional = True
|
||||
end
|
||||
object Calendar: TCalendar
|
||||
Left = 8
|
||||
Height = 190
|
||||
Top = 8
|
||||
Width = 324
|
||||
DateTime = 43775
|
||||
OnChange = CalendarChange
|
||||
TabOrder = 9
|
||||
end
|
||||
object BaseFolderDialog: TSelectDirectoryDialog
|
||||
left = 251
|
||||
top = 85
|
||||
left = 520
|
||||
top = 128
|
||||
end
|
||||
end
|
||||
|
||||
99
scanner.pas
99
scanner.pas
@@ -6,13 +6,27 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtDlgs,
|
||||
StdCtrls, Unix;
|
||||
StdCtrls, ExtCtrls, Calendar, Unix;
|
||||
|
||||
type
|
||||
|
||||
{ TScanForm }
|
||||
{ ScanThread }
|
||||
ScanThread = class(TThread)
|
||||
private
|
||||
btn : TButton;
|
||||
folder,w,h,r :String;
|
||||
p:TImage;
|
||||
protected
|
||||
procedure Execute; override;
|
||||
public
|
||||
constructor Create(button: TButton; dir: String; width: String; height: String; resolution: String; preview: TImage);
|
||||
end;
|
||||
|
||||
{ TScanForm }
|
||||
TScanForm = class(TForm)
|
||||
Calendar: TCalendar;
|
||||
Preview: TImage;
|
||||
Stop: TComboBox;
|
||||
DPI: TLabel;
|
||||
BaseFolder: TLabel;
|
||||
Resolution: TComboBox;
|
||||
@@ -21,30 +35,27 @@ type
|
||||
BaseFolderDialog: TSelectDirectoryDialog;
|
||||
Times: TLabel;
|
||||
IWidth: TEdit;
|
||||
ScnaButton: TButton;
|
||||
ScanButton: TButton;
|
||||
Product: TComboBox;
|
||||
Destination: TComboBox;
|
||||
FolderName: TLabel;
|
||||
Origin: TComboBox;
|
||||
TypeSelector: TComboBox;
|
||||
dateButton: TButton;
|
||||
DateSelector: TCalendarDialog;
|
||||
DateView: TLabel;
|
||||
|
||||
procedure BaseFolderClick(Sender: TObject);
|
||||
procedure CalendarChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ProductChange(Sender: TObject);
|
||||
procedure DestinationChange(Sender: TObject);
|
||||
procedure dateButtonClick(Sender: TObject);
|
||||
procedure OriginChange(Sender: TObject);
|
||||
procedure ScnaButtonClick(Sender: TObject);
|
||||
procedure ScanButtonClick(Sender: TObject);
|
||||
procedure StopChange(Sender: TObject);
|
||||
procedure TypeSelectorChange(Sender: TObject);
|
||||
function ExportConfig(): string;
|
||||
function ExportOptions(dropDown: TComboBox): string;
|
||||
procedure UpdateTypes();
|
||||
procedure UpdateFolder();
|
||||
procedure MixLocations(d1: TComboBox; d2: TComboBox);
|
||||
procedure ScanImage();
|
||||
procedure MixLocations(d1: TComboBox; d2: TComboBox; d3: TComboBox);
|
||||
private
|
||||
date: TDateTime;
|
||||
public
|
||||
@@ -58,14 +69,44 @@ implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TScanForm }
|
||||
{ ScanThread }
|
||||
|
||||
procedure TScanForm.ScanImage();
|
||||
constructor ScanThread.Create(button: TButton; dir: String; width: String; height: String; resolution: String; preview: TImage);
|
||||
begin
|
||||
fpSystem('scanimage -x '+IWidth.Caption+' -y '+IHeight.Caption+' --mode Gray --resolution '+Resolution.Caption+' --format jpeg > /home/srichter/tmp/test.jpg');
|
||||
btn := button;
|
||||
folder:=dir;
|
||||
w:=width;
|
||||
h:=height;
|
||||
r:=resolution;
|
||||
p:=preview;
|
||||
inherited Create(false);
|
||||
end;
|
||||
|
||||
procedure TScanForm.MixLocations(d1: TComboBox; d2: TComboBox);
|
||||
procedure ScanThread.Execute;
|
||||
var
|
||||
fname: String;
|
||||
num: Integer;
|
||||
pic: TPicture;
|
||||
begin
|
||||
ForceDirectories(folder);
|
||||
num := 0;
|
||||
repeat
|
||||
num := num +1;
|
||||
fname := '/scan_';
|
||||
if (num<10) then fname:=fname+'0';
|
||||
fname := fname+IntToStr(num)+'.jpg';
|
||||
until not FileExists(folder+fname);
|
||||
fpSystem('scanimage -x '+w+' -y '+h+' --mode Color --resolution '+r+' --format jpeg > "'+folder+fname+'"');
|
||||
try
|
||||
pic:=TPicture.Create;
|
||||
pic.LoadFromFile(folder+fname);
|
||||
p.Picture:=pic;
|
||||
finally
|
||||
end;
|
||||
btn.Enabled:=true;
|
||||
end;
|
||||
|
||||
procedure TScanForm.MixLocations(d1: TComboBox; d2: TComboBox; d3: TComboBox);
|
||||
var
|
||||
list: TStringList;
|
||||
begin
|
||||
@@ -73,17 +114,20 @@ begin
|
||||
list.Sorted := True;
|
||||
d1.Items.Add(d1.Text);
|
||||
d2.Items.Add(d2.Text);
|
||||
if not (d3.Text = '') then d3.Items.Add(d3.Text);
|
||||
list.Assign(d1.Items);
|
||||
list.AddStrings(d2.Items);
|
||||
list.AddStrings(d3.Items);
|
||||
d1.Items.Assign(list);
|
||||
d2.Items.Assign(list);
|
||||
d3.Items.Assign(list);
|
||||
end;
|
||||
|
||||
function TScanForm.ExportConfig(): string;
|
||||
begin
|
||||
Result := 'types:' + ExportOptions(TypeSelector) + #13;
|
||||
Result := Result + 'items:' + ExportOptions(Product) + #13;
|
||||
MixLocations(Origin, Destination);
|
||||
MixLocations(Origin, Destination, Stop);
|
||||
Result := Result + 'locations:' + ExportOPtions(Origin) + #13;
|
||||
end;
|
||||
|
||||
@@ -116,18 +160,19 @@ begin
|
||||
state := TypeSelector.Text = 'Ticket';
|
||||
Origin.Enabled := state;
|
||||
Origin.Visible := state;
|
||||
Stop.Enabled := state;
|
||||
Stop.Visible := state;
|
||||
Destination.Enabled := state;
|
||||
Destination.Visible := state;
|
||||
Product.Enabled := not state;
|
||||
Product.Visible := not state;
|
||||
ScnaButton.Enabled:=true;
|
||||
ScanButton.Enabled:=true;
|
||||
UpdateFolder();
|
||||
end;
|
||||
|
||||
procedure TScanForm.dateButtonClick(Sender: TObject);
|
||||
procedure TScanForm.CalendarChange(Sender: TObject);
|
||||
begin
|
||||
DateSelector.Execute;
|
||||
date := DateSelector.Date;
|
||||
DateView.Caption := FormatDateTime('YYYY-MM-DD', date);
|
||||
date := Calendar.DateTime;
|
||||
UpdateTypes();
|
||||
TypeSelector.Enabled := True;
|
||||
UpdateFolder();
|
||||
@@ -139,12 +184,13 @@ begin
|
||||
UpdateFolder();
|
||||
end;
|
||||
|
||||
procedure TScanForm.ScnaButtonClick(Sender: TObject);
|
||||
procedure TScanForm.ScanButtonClick(Sender: TObject);
|
||||
var
|
||||
config: TFileStream;
|
||||
filename: string;
|
||||
json: string;
|
||||
begin
|
||||
ScanButton.Enabled:=false;
|
||||
filename := GetEnvironmentVariable('HOME') + '/.config/belegscanner.conf';
|
||||
json := ExportConfig();
|
||||
try
|
||||
@@ -153,7 +199,13 @@ begin
|
||||
finally
|
||||
config.Free;
|
||||
end;
|
||||
ScanImage();
|
||||
ScanThread.Create(ScanButton,BaseFolder.Caption+FolderName.Caption,IWidth.Caption,IHeight.Caption,Resolution.Caption,Preview);
|
||||
end;
|
||||
|
||||
procedure TScanForm.StopChange(Sender: TObject);
|
||||
begin
|
||||
Stop.Tag := 1;
|
||||
UpdateFolder();
|
||||
end;
|
||||
|
||||
procedure TScanForm.DestinationChange(Sender: TObject);
|
||||
@@ -198,6 +250,7 @@ begin
|
||||
line := line.Substring(10);
|
||||
Origin.Items.AddStrings(line.Split(','));
|
||||
Destination.Items.AddStrings(line.Split(','));
|
||||
Stop.Items.AddStrings(line.Split(','));
|
||||
end;
|
||||
end
|
||||
finally
|
||||
@@ -223,6 +276,8 @@ begin
|
||||
tx := tx + TypeSelector.Text;
|
||||
if (Origin.Enabled and (Origin.Tag > 0)) then
|
||||
tx := tx + ': ' + Origin.Text;
|
||||
if (Stop.Enabled and (Stop.Tag > 0) and not (Stop.Text = '')and not (Stop.Text = 'Zwischenhalt')) then
|
||||
tx := tx + ' - ' + Stop.Text;
|
||||
if (Destination.Enabled and (Destination.Tag > 0)) then
|
||||
tx := tx + ' - ' + Destination.Text;
|
||||
FolderName.Caption := tx;
|
||||
|
||||
Reference in New Issue
Block a user