Changeset 37
- Timestamp:
- May 9, 2018, 1:22:44 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 28 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 3 3 lib 4 4 backup 5 LibrePaint.exe 6 *.lrj
-
- Property svn:ignore
-
trunk/Forms
-
Property svn:ignore
set to
*.lrj
-
Property svn:ignore
set to
-
trunk/Forms/UFormMain.lfm
r36 r37 52 52 Top = 0 53 53 Width = 920 54 Caption = 'ToolBar1'55 54 TabOrder = 1 56 55 object ToolButton1: TToolButton … … 60 59 end 61 60 object ColorButton1: TColorButton 62 Left = 2463 Height = 2 261 Left = 30 62 Height = 28 64 63 Top = 2 65 64 Width = 43 … … 69 68 end 70 69 object ToolButton2: TToolButton 71 Left = 6770 Left = 73 72 71 Top = 2 73 72 Action = Core.AToolMove 74 73 end 75 74 object ToolButton3: TToolButton 76 Left = 9075 Left = 102 77 76 Top = 2 78 77 Action = Core.AToolPen 79 end80 object ToolButton4: TToolButton81 Left = 11382 Top = 283 Caption = 'ToolButton4'84 OnClick = ToolButton4Click85 78 end 86 79 end … … 161 154 end 162 155 end 156 object MenuItem24: TMenuItem 157 Caption = 'General' 158 object MenuItem25: TMenuItem 159 Action = Core.ASettings 160 end 161 end 163 162 end 164 163 object Timer1: TTimer … … 172 171 MaxCount = 10 173 172 OnChange = LastOpenedList1Change 174 left = 292173 left = 304 175 174 top = 112 176 175 end -
trunk/Forms/UFormMain.pas
r36 r37 32 32 MenuItem22: TMenuItem; 33 33 MenuItem23: TMenuItem; 34 MenuItem24: TMenuItem; 35 MenuItem25: TMenuItem; 34 36 MenuItemRecentFiles: TMenuItem; 35 37 MenuItem15: TMenuItem; … … 50 52 ToolButton2: TToolButton; 51 53 ToolButton3: TToolButton; 52 ToolButton4: TToolButton;53 54 procedure FormActivate(Sender: TObject); 54 55 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); -
trunk/Forms/UFormNew.lfm
r33 r37 7 7 ClientHeight = 300 8 8 ClientWidth = 497 9 DesignTimePPI = 120 9 10 OnClose = FormClose 10 11 OnCreate = FormCreate 11 12 OnShow = FormShow 12 LCLVersion = '1. 6.0.4'13 LCLVersion = '1.8.2.0' 13 14 object SpinEditWidth: TSpinEdit 14 15 Left = 168 15 Height = 3416 Height = 28 16 17 Top = 24 17 18 Width = 122 … … 22 23 object Label1: TLabel 23 24 Left = 15 24 Height = 2 425 Height = 20 25 26 Top = 26 26 Width = 5627 Width = 43 27 28 Caption = 'Width:' 28 29 ParentColor = False … … 30 31 object Label2: TLabel 31 32 Left = 15 32 Height = 2 433 Height = 20 33 34 Top = 64 34 Width = 6235 Width = 48 35 36 Caption = 'Height:' 36 37 ParentColor = False … … 38 39 object SpinEditHeight: TSpinEdit 39 40 Left = 168 40 Height = 3441 Height = 28 41 42 Top = 64 42 43 Width = 122 … … 47 48 object Label3: TLabel 48 49 Left = 15 49 Height = 2 450 Height = 20 50 51 Top = 104 51 Width = 9652 Width = 73 52 53 Caption = 'Resolution:' 53 54 ParentColor = False … … 55 56 object SpinEditDPI: TSpinEdit 56 57 Left = 168 57 Height = 3458 Height = 28 58 59 Top = 104 59 60 Width = 122 … … 64 65 object Label4: TLabel 65 66 Left = 15 66 Height = 2 467 Height = 20 67 68 Top = 167 68 Width = 10569 Width = 82 69 70 Caption = 'Color depth:' 70 71 ParentColor = False … … 72 73 object ComboBoxColorFormat: TComboBox 73 74 Left = 167 74 Height = 3875 Height = 28 75 76 Top = 157 76 77 Width = 209 77 ItemHeight = 078 ItemHeight = 20 78 79 OnChange = SpinEditWidthChange 79 80 Style = csDropDownList … … 91 92 end 92 93 object Button2: TButton 93 Left = 2 2494 Left = 232 94 95 Height = 25 95 96 Top = 256 … … 101 102 object Label5: TLabel 102 103 Left = 16 103 Height = 2 4104 Height = 20 104 105 Top = 224 105 Width = 1 52106 Width = 118 106 107 Caption = 'Memory required:' 107 108 ParentColor = False … … 109 110 object LabelMemRequire: TLabel 110 111 Left = 192 111 Height = 2 4112 Height = 20 112 113 Top = 224 113 Width = 1 5114 Width = 12 114 115 Caption = ' ' 115 116 ParentColor = False -
trunk/LibrePaint.lpi
r35 r37 12 12 </General> 13 13 <i18n> 14 <EnableI18N LFM="False"/> 14 <EnableI18N Value="True"/> 15 <OutDir Value="Languages"/> 15 16 </i18n> 16 17 <BuildModes Count="2"> … … 20 21 <Version Value="11"/> 21 22 <Target> 22 <Filename Value=" lib/$(TargetCPU)-$(TargetOS)/LibrePaint"/>23 <Filename Value="LibrePaint"/> 23 24 </Target> 24 25 <SearchPaths> 25 26 <IncludeFiles Value="$(ProjOutDir)"/> 26 27 <OtherUnitFiles Value="Forms"/> 27 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS) "/>28 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 28 29 </SearchPaths> 29 30 <Parsing> … … 63 64 </local> 64 65 </RunParams> 65 <RequiredPackages Count=" 4">66 <RequiredPackages Count="5"> 66 67 <Item1> 68 <PackageName Value="CoolTranslator"/> 69 <DefaultFilename Value="Packages/CoolTranslator/CoolTranslator.lpk" Prefer="True"/> 70 </Item1> 71 <Item2> 67 72 <PackageName Value="Common"/> 68 73 <DefaultFilename Value="Packages/Common/Common.lpk" Prefer="True"/> 69 </Item 1>70 <Item 2>74 </Item2> 75 <Item3> 71 76 <PackageName Value="TemplateGenerics"/> 72 77 <DefaultFilename Value="Packages/TemplateGenerics/TemplateGenerics.lpk" Prefer="True"/> 73 </Item 2>74 <Item 3>78 </Item3> 79 <Item4> 75 80 <PackageName Value="FastGraphics"/> 76 81 <DefaultFilename Value="Packages/FastGraphics/FastGraphics.lpk" Prefer="True"/> 77 </Item 3>78 <Item 4>82 </Item4> 83 <Item5> 79 84 <PackageName Value="LCL"/> 80 </Item 4>85 </Item5> 81 86 </RequiredPackages> 82 <Units Count=" 5">87 <Units Count="6"> 83 88 <Unit0> 84 89 <Filename Value="LibrePaint.lpr"/> … … 110 115 <ResourceBaseClass Value="Form"/> 111 116 </Unit4> 117 <Unit5> 118 <Filename Value="Forms/UFormSettings.pas"/> 119 <IsPartOfProject Value="True"/> 120 <ComponentName Value="FormSettings"/> 121 <ResourceBaseClass Value="Form"/> 122 </Unit5> 112 123 </Units> 113 124 </ProjectOptions> … … 115 126 <Version Value="11"/> 116 127 <Target> 117 <Filename Value=" lib/$(TargetCPU)-$(TargetOS)/LibrePaint"/>128 <Filename Value="LibrePaint"/> 118 129 </Target> 119 130 <SearchPaths> 120 131 <IncludeFiles Value="$(ProjOutDir)"/> 121 132 <OtherUnitFiles Value="Forms"/> 122 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS) "/>133 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 123 134 </SearchPaths> 124 135 <Parsing> -
trunk/LibrePaint.lpr
r30 r37 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 SysUtils, Forms, UCore, UProject, TemplateGenerics, Common, UFormNew,11 UForm Main;10 SysUtils, Forms, UCore, UProject, CoolTranslator, TemplateGenerics, Common, 11 UFormNew, UFormMain, UFormSettings; 12 12 13 13 {$R *.res} -
trunk/Packages/Common/UMemory.pas
r28 r37 10 10 type 11 11 12 { T Memory}13 14 T Memory= class12 { TBlock } 13 14 TBlock = class 15 15 private 16 16 FData: PByte; 17 17 FSize: Integer; 18 function GetItem(Index: Integer): Byte; 19 procedure SetItem(Index: Integer; AValue: Byte); 20 procedure SetSize(AValue: Integer); virtual; 21 public 22 procedure Clear(Value: Byte = 0); 23 procedure Assign(Source: TMemory); 18 function GetItem(Index: Integer): Byte; virtual; abstract; 19 procedure SetItem(Index: Integer; AValue: Byte); virtual; abstract; 20 procedure SetSize(AValue: Integer); virtual; abstract; 21 public 22 procedure ReadBlock(Block: TBlock; Position: Integer); virtual; 23 procedure WriteBlock(Block: TBlock; Position: Integer); virtual; 24 procedure Clear(Value: Byte = 0); virtual; 25 procedure Assign(Source: TBlock); virtual; 26 property Size: Integer read FSize write SetSize; 27 property Items[Index: Integer]: Byte read GetItem write SetItem; default; 28 end; 29 30 { TMemory } 31 32 TMemory = class(TBlock) 33 private 34 FData: PByte; 35 FSize: Integer; 36 function GetItem(Index: Integer): Byte; override; 37 procedure SetItem(Index: Integer; AValue: Byte); override; 38 procedure SetSize(AValue: Integer); override; 39 public 40 procedure Clear(Value: Byte = 0); override; 41 procedure Assign(Source: TBlock); override; 24 42 constructor Create; 25 43 destructor Destroy; override; 26 44 property Data: PByte read FData; 27 property Size: Integer read FSize write SetSize;28 property Items[Index: Integer]: Byte read GetItem write SetItem; default;29 45 end; 30 46 … … 42 58 end; 43 59 60 { TBitBlock } 61 62 TBitBlock = class 63 private 64 function GetItem(Index: Integer): Byte; virtual; 65 function GetSize: Integer; virtual; 66 procedure SetItem(Index: Integer; AValue: Byte); virtual; 67 procedure SetSize(AValue: Integer); virtual; 68 public 69 procedure Invert; virtual; 70 function GetInteger: Integer; virtual; 71 procedure SetInteger(Value: Integer); virtual; 72 procedure ReadBlock(Block: TBitBlock; Position: Integer); virtual; 73 procedure WriteBlock(Block: TBitBlock; Position: Integer); virtual; 74 procedure Clear(Value: Byte = 0); virtual; 75 procedure Assign(Source: TBlock); virtual; 76 property Size: Integer read GetSize write SetSize; 77 property Items[Index: Integer]: Byte read GetItem write SetItem; default; 78 end; 79 80 { TBitMemory } 81 82 TBitMemory = class(TBitBlock) 83 private 84 FData: PByte; 85 FSize: Integer; 86 function GetSize: Integer; override; 87 procedure SetSize(AValue: Integer); override; 88 function GetItem(Index: Integer): Byte; override; 89 procedure SetItem(Index: Integer; AValue: Byte); override; 90 public 91 constructor Create; 92 destructor Destroy; override; 93 function GetInteger: Integer; override; 94 procedure SetInteger(Value: Integer); override; 95 procedure Clear(Value: Byte = 0); override; 96 procedure ReadBlock(Block: TBitBlock; Position: Integer); override; 97 procedure WriteBlock(Block: TBitBlock; Position: Integer); override; 98 property Data: PByte read FData; 99 procedure Invert; override; 100 end; 101 102 44 103 implementation 104 105 { TBitMemory } 106 107 procedure TBitMemory.Clear(Value: Byte); 108 begin 109 if (Size and 7) = 0 then begin 110 if Value = 0 then FillChar(FData^, Size shr 3, 0) 111 else FillChar(FData^, Size shr 3, $ff); 112 end else inherited; 113 end; 114 115 procedure TBitMemory.ReadBlock(Block: TBitBlock; Position: Integer); 116 begin 117 if Block is TBitMemory then begin 118 if (Position and 7) = 0 then begin 119 if (Block.Size and 7) = 0 then 120 Move(PByte(FData + Position shr 3)^, TBitMemory(Block).Data^, Block.Size shr 3) 121 else inherited; 122 end else inherited; 123 end else inherited; 124 end; 125 126 procedure TBitMemory.WriteBlock(Block: TBitBlock; Position: Integer); 127 begin 128 if Block is TBitMemory then begin 129 if (Position and 7) = 0 then begin 130 if (Block.Size and 7) = 0 then 131 Move(TBitMemory(Block).Data^, PByte(FData + Position shr 3)^, Block.Size shr 3) 132 else inherited; 133 end else inherited; 134 end else inherited; 135 end; 136 137 procedure TBitMemory.Invert; 138 var 139 I: Integer; 140 begin 141 if (Size and 7) = 0 then begin 142 for I := 0 to (Size shr 3) - 1 do 143 PByte(FData + I)^ := PByte(FData + I)^ xor $ff; 144 end 145 else inherited; 146 147 end; 148 149 function TBitMemory.GetInteger: Integer; 150 var 151 I: Integer; 152 V: Integer; 153 begin 154 Result := 0; 155 I := 0; 156 while (I < 32) and (I < Size) do begin 157 V := FData[I shr 3]; 158 V := V shl I; 159 Result := Result or V; 160 // Result := Result or (FData[I shr 3] shl I); 161 Inc(I, 8); 162 end; 163 if Size < 32 then 164 Result := Result and ((1 shl Size) - 1); 165 end; 166 167 procedure TBitMemory.SetInteger(Value: Integer); 168 var 169 I: Integer; 170 begin 171 I := 0; 172 while (I < 32) and (I < Size) do begin 173 FData[I shr 3] := (Value shr I) and $ff; 174 Inc(I, 8); 175 end; 176 end; 177 178 function TBitMemory.GetSize: Integer; 179 begin 180 Result := FSize; 181 end; 182 183 procedure TBitMemory.SetSize(AValue: Integer); 184 var 185 ByteSize: Integer; 186 begin 187 if AValue = FSize then Exit; 188 FSize := AValue; 189 ByteSize := FSize shr 3; 190 if (FSize and 7) > 0 then Inc(ByteSize); 191 FData := ReAllocMem(FData, ByteSize); 192 end; 193 194 function TBitMemory.GetItem(Index: Integer): Byte; 195 begin 196 if Index >= Size then raise Exception.Create('Out of range'); 197 Result := (PByte(FData + (Index shr 3))^ shr (Index and 7)) and 1; 198 end; 199 200 procedure TBitMemory.SetItem(Index: Integer; AValue: Byte); 201 begin 202 if Index >= Size then raise Exception.Create('Out of range, Size:' + IntToStr(Size) + ', Index:' + IntToStr(Index)); 203 PByte(FData + (Index shr 3))^ := PByte(FData + (Index shr 3))^ and not (1 shl (Index and 7)) 204 or ((AValue and 1) shl (Index and 7)); 205 end; 206 207 constructor TBitMemory.Create; 208 begin 209 FData := nil; 210 end; 211 212 destructor TBitMemory.Destroy; 213 begin 214 FreeMem(FData); 215 inherited Destroy; 216 end; 217 218 { TBitBlock } 219 220 function TBitBlock.GetItem(Index: Integer): Byte; 221 begin 222 Result := 0; 223 end; 224 225 function TBitBlock.GetSize: Integer; 226 begin 227 Result := 0; 228 end; 229 230 procedure TBitBlock.SetItem(Index: Integer; AValue: Byte); 231 begin 232 233 end; 234 235 procedure TBitBlock.SetSize(AValue: Integer); 236 begin 237 end; 238 239 procedure TBitBlock.Invert; 240 var 241 I: Integer; 242 begin 243 for I := 0 to Size - 1 do 244 Items[I] := not Items[I]; 245 end; 246 247 function TBitBlock.GetInteger: Integer; 248 begin 249 Result := 0; 250 end; 251 252 procedure TBitBlock.SetInteger(Value: Integer); 253 begin 254 255 end; 256 257 procedure TBitBlock.ReadBlock(Block: TBitBlock; Position: Integer); 258 var 259 I: Integer; 260 begin 261 for I := 0 to Block.Size - 1 do 262 Block.Items[I] := Items[Position + I]; 263 end; 264 265 procedure TBitBlock.WriteBlock(Block: TBitBlock; Position: Integer); 266 var 267 I: Integer; 268 begin 269 for I := 0 to Block.Size - 1 do 270 Items[Position + I] := Block.Items[I]; 271 end; 272 273 procedure TBitBlock.Clear(Value: Byte); 274 var 275 I: Integer; 276 begin 277 for I := 0 to Size - 1 do 278 Items[I] := Value; 279 end; 280 281 procedure TBitBlock.Assign(Source: TBlock); 282 var 283 I: Integer; 284 begin 285 Size := Source.Size; 286 for I := 0 to Size - 1 do 287 Items[I] := Source.Items[I]; 288 end; 289 290 { TBlock } 291 292 procedure TBlock.ReadBlock(Block: TBlock; Position: Integer); 293 var 294 I: Integer; 295 begin 296 if Position + Block.Size > Size then raise Exception.Create(''); 297 for I := 0 to Block.Size - 1 do 298 Items[I] := Items[Position + I]; 299 end; 300 301 procedure TBlock.WriteBlock(Block: TBlock; Position: Integer); 302 var 303 I: Integer; 304 begin 305 if Position + Block.Size > Size then raise Exception.Create(''); 306 for I := 0 to Block.Size - 1 do 307 Items[Position + I] := Items[I]; 308 end; 309 310 procedure TBlock.Clear(Value: Byte); 311 var 312 I: Integer; 313 begin 314 for I := 0 to Size - 1 do 315 Items[I] := Value; 316 end; 317 318 procedure TBlock.Assign(Source: TBlock); 319 var 320 I: Integer; 321 begin 322 Size := Source.Size; 323 for I := 0 to Size - 1 do 324 Items[I] := Source.Items[I]; 325 end; 45 326 46 327 { TPositionMemory } … … 90 371 end; 91 372 92 procedure TMemory.Assign(Source: TMemory); 93 begin 94 Size := Source.Size; 95 Move(Source.Data^, FData^, Size); 373 procedure TMemory.Assign(Source: TBlock); 374 begin 375 if Source is TMemory then begin 376 Size := Source.Size; 377 Move(TMemory(Source).Data^, FData^, Size); 378 end else inherited; 96 379 end; 97 380 -
trunk/UCore.lfm
r36 r37 106 106 OnExecute = AToolMoveExecute 107 107 end 108 object ASettings: TAction 109 Caption = 'Settings' 110 OnExecute = ASettingsExecute 111 end 108 112 end 109 113 object ImageList1: TImageList … … 143 147 top = 166 144 148 end 149 object CoolTranslator1: TCoolTranslator 150 POFilesFolder = 'Languages' 151 left = 250 152 top = 72 153 end 145 154 end -
trunk/UCore.pas
r36 r37 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, ActnList, UProject, UFGraphics, UPersistentForm, 9 Controls, Graphics, ExtDlgs, ExtCtrls, URegistry, UApplicationInfo, Registry; 8 Classes, SysUtils, FileUtil, ActnList, UProject, UCoolTranslator, UFGraphics, 9 UPersistentForm, Controls, Graphics, ExtDlgs, ExtCtrls, URegistry, 10 UApplicationInfo, Registry; 10 11 11 12 const … … 16 17 17 18 TCore = class(TDataModule) 19 ASettings: TAction; 18 20 AToolMove: TAction; 19 21 AToolPen: TAction; … … 36 38 AFileNew: TAction; 37 39 ActionList1: TActionList; 40 CoolTranslator1: TCoolTranslator; 38 41 ImageList1: TImageList; 39 42 OpenPictureDialog1: TOpenPictureDialog; … … 52 55 procedure AImageNegativeExecute(Sender: TObject); 53 56 procedure AImageRandomExecute(Sender: TObject); 57 procedure ASettingsExecute(Sender: TObject); 54 58 procedure AToolMoveExecute(Sender: TObject); 55 59 procedure AToolPenExecute(Sender: TObject); … … 82 86 uses 83 87 UFormNew, UFormMain, Forms, UColorRGBA8, UColorGray8, UColorGray1, UColorGray4, 84 UColorRGB565 ;88 UColorRGB565, UFormSettings; 85 89 86 90 { TCore } … … 151 155 LastImageSize.X := ReadIntegerWithDefault('LastImageSizeX', 600); 152 156 LastImageSize.Y := ReadIntegerWithDefault('LastImageSizeY', 400); 157 if ValueExists('LanguageCode') then 158 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')) 159 else CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(''); 153 160 finally 154 161 Free; … … 166 173 WriteInteger('LastImageSizeX', LastImageSize.X); 167 174 WriteInteger('LastImageSizeY', LastImageSize.Y); 175 if Assigned(CoolTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then 176 WriteString('LanguageCode', CoolTranslator1.Language.Code) 177 else DeleteValue('LanguageCode'); 168 178 finally 169 179 Free; … … 300 310 end; 301 311 312 procedure TCore.ASettingsExecute(Sender: TObject); 313 begin 314 FormSettings := TFormSettings.Create(nil); 315 try 316 FormSettings.Load; 317 if FormSettings.ShowModal = mrOk then begin 318 FormSettings.Save; 319 end; 320 finally 321 FormSettings.Free; 322 end; 323 end; 324 302 325 procedure TCore.AToolMoveExecute(Sender: TObject); 303 326 begin
Note:
See TracChangeset
for help on using the changeset viewer.