diff --git a/applications/lazimageeditor/DLBitmap.pas b/applications/lazimageeditor/DLBitmap.pas index e5c9f23dc..4661365d7 100644 --- a/applications/lazimageeditor/DLBitmap.pas +++ b/applications/lazimageeditor/DLBitmap.pas @@ -80,6 +80,8 @@ type FCanvas: TCanvas; protected procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure DoEnter; override; + procedure DoExit; override; public Editor: TTextEditor; constructor Create(AOwner: TComponent); override; @@ -455,6 +457,17 @@ begin end; end; +procedure TTextEdit.DoEnter; +begin + inherited; +end; + +procedure TTextEdit.DoExit; +begin + inherited; + Editor.StopEdit; +end; + constructor TTextEditor.Create(AOwner: TComponent); begin inherited; @@ -497,7 +510,6 @@ end; procedure TTextEditor.DrawFlashLine(Sender: TObject); var FlashLeft: integer; LeftText: string; begin - FEdit.SetFocus; flashnum := flashnum + 1; if flashnum > 1000 then flashnum := 0; @@ -505,8 +517,10 @@ begin Canvas.Pen.Color := clWhite else Canvas.Pen.Color := clBlack; + FEdit.Font.Assign(IMGCanvas.Font); + Height := FEdit.Height - 3; LeftText := Copy(FEdit.Text, 1, PositionIndex); - FlashLeft := StartX + Canvas.TextWidth(LeftText); + FlashLeft := StartX + IMGCanvas.TextWidth(LeftText); Left := FlashLeft; Top := StartY; Canvas.Line(0, 0, 0, Height); @@ -525,6 +539,7 @@ begin FEdit.Text := ''; Show; FTimer.Enabled := True; + FEdit.SetFocus; end; procedure TTextEditor.StopEdit; @@ -538,7 +553,7 @@ var TextLeft: integer; LeftText, RightText: string; begin LeftText := Copy(FEdit.Text, 1, PositionIndex); RightText := Copy(FEdit.Text, PositionIndex + 1, Length(FEdit.text)); - TextLeft := TextX + Canvas.TextWidth(LeftText); + TextLeft := TextX + IMGCanvas.TextWidth(LeftText); if IMGCanvas = nil then Exit; //IMGCanvas.TextOut(22, 22, FEdit.Text); diff --git a/applications/lazimageeditor/lazimageeditor.lpi b/applications/lazimageeditor/lazimageeditor.lpi index 59a1a9dba..37e22c55c 100644 --- a/applications/lazimageeditor/lazimageeditor.lpi +++ b/applications/lazimageeditor/lazimageeditor.lpi @@ -46,12 +46,10 @@ - - - + @@ -63,21 +61,19 @@ - - - + + + - - - + + - @@ -179,11 +175,11 @@ - + - - - + + + @@ -358,11 +354,11 @@ - + - - - + + + @@ -385,17 +381,17 @@ - - + + - + - - - + + + @@ -410,123 +406,123 @@ - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/applications/lazimageeditor/main.lfm b/applications/lazimageeditor/main.lfm index 2005040a1..df5dada76 100644 --- a/applications/lazimageeditor/main.lfm +++ b/applications/lazimageeditor/main.lfm @@ -2,10 +2,10 @@ Left = 260 Height = 681 Top = 147 - Width = 935 + Width = 920 Caption = 'Lazarus Image Editor' ClientHeight = 659 - ClientWidth = 935 + ClientWidth = 920 Font.CharSet = GB2312_CHARSET Font.Height = -13 Font.Name = '微软雅黑' @@ -176,7 +176,7 @@ Left = 0 Height = 22 Top = 637 - Width = 935 + Width = 920 Panels = < item Width = 250 @@ -201,7 +201,7 @@ SimplePanel = False end object PanelPallete: TPanel - Left = 860 + Left = 845 Height = 532 Top = 105 Width = 75 @@ -228,17 +228,17 @@ Left = 0 Height = 105 Top = 0 - Width = 935 + Width = 920 Align = alTop BevelOuter = bvNone ClientHeight = 105 - ClientWidth = 935 + ClientWidth = 920 TabOrder = 2 object Bevel1: TBevel Left = 0 Height = 2 Top = 69 - Width = 935 + Width = 920 Align = alTop Shape = bsBottomLine end @@ -246,7 +246,7 @@ Left = 0 Height = 2 Top = 33 - Width = 935 + Width = 920 Align = alTop Shape = bsBottomLine end @@ -254,7 +254,7 @@ Left = 0 Height = 33 Top = 0 - Width = 935 + Width = 920 ButtonHeight = 32 ButtonWidth = 36 Color = clBtnFace @@ -445,10 +445,10 @@ Left = 542 Height = 32 Top = 0 - Width = 168 + Width = 170 BevelOuter = bvNone ClientHeight = 32 - ClientWidth = 168 + ClientWidth = 170 TabOrder = 1 object FontListBox: TComboBox Left = 2 @@ -476,13 +476,13 @@ Left = 0 Height = 34 Top = 35 - Width = 935 + Width = 920 Align = alTop BorderSpacing.InnerBorder = 4 BorderSpacing.CellAlignVertical = ccaCenter BevelOuter = bvNone ClientHeight = 34 - ClientWidth = 935 + ClientWidth = 920 TabOrder = 1 object LabelFillOutline: TLabel Left = 103 @@ -518,7 +518,7 @@ ParentColor = False end object PanelColors: TPanel - Left = 723 + Left = 708 Height = 34 Top = 0 Width = 212 @@ -1110,11 +1110,11 @@ Left = 0 Height = 34 Top = 71 - Width = 935 + Width = 920 Align = alTop BevelOuter = bvNone ClientHeight = 34 - ClientWidth = 935 + ClientWidth = 920 TabOrder = 2 object LabelSize: TLabel Left = 0 @@ -1361,7 +1361,7 @@ Left = 40 Height = 532 Top = 105 - Width = 820 + Width = 805 Align = alClient BevelOuter = bvLowered TabOrder = 3 diff --git a/applications/lazimageeditor/main.lrs b/applications/lazimageeditor/main.lrs index 0cbd51797..72b0bc678 100644 --- a/applications/lazimageeditor/main.lrs +++ b/applications/lazimageeditor/main.lrs @@ -2,8 +2,8 @@ LazarusResources.Add('TMainForm','FORMDATA',[ 'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#4#1#6'Height'#3#169#2#3'Top'#3#147#0 - +#5'Width'#3#167#3#7'Caption'#6#20'Lazarus Image Editor'#12'ClientHeight'#3 - +#147#2#11'ClientWidth'#3#167#3#12'Font.CharSet'#7#14'GB2312_CHARSET'#11'Font' + +#5'Width'#3#152#3#7'Caption'#6#20'Lazarus Image Editor'#12'ClientHeight'#3 + +#147#2#11'ClientWidth'#3#152#3#12'Font.CharSet'#7#14'GB2312_CHARSET'#11'Font' +'.Height'#2#243#9'Font.Name'#6#12#229#190#174#232#189#175#233#155#133#233#187 +#145#10'Font.Pitch'#7#10'fpVariable'#12'Font.Quality'#7#7'fqDraft'#4'Menu'#7 +#8'MainMenu'#12'OnCloseQuery'#7#14'FormCloseQuery'#8'OnCreate'#7#10'FormCrea' @@ -47,23 +47,23 @@ LazarusResources.Add('TMainForm','FORMDATA',[ +'oolBrushClick'#0#0#11'TToolButton'#8'ToolText'#4'Left'#2#0#4'Hint'#6#4'Text' +#3'Top'#3#186#1#7'Caption'#6#9'ToolBrush'#7'Grouped'#9#10'ImageIndex'#2#5#7 +'OnClick'#7#13'ToolTextClick'#0#0#0#0#10'TStatusBar'#9'StatusBar'#4'Left'#2#0 - +#6'Height'#2#22#3'Top'#3'}'#2#5'Width'#3#167#3#6'Panels'#14#1#5'Width'#3#250 + +#6'Height'#2#22#3'Top'#3'}'#2#5'Width'#3#152#3#6'Panels'#14#1#5'Width'#3#250 +#0#0#1#9'Alignment'#7#8'taCenter'#5'Width'#2'P'#0#1#9'Alignment'#7#8'taCente' +'r'#5'Width'#2'P'#0#1#5'Width'#2'P'#0#1#5'Width'#2'P'#0#1#5'Width'#2'2'#0#0 - +#11'SimplePanel'#8#0#0#6'TPanel'#12'PanelPallete'#4'Left'#3'\'#3#6'Height'#3 + +#11'SimplePanel'#8#0#0#6'TPanel'#12'PanelPallete'#4'Left'#3'M'#3#6'Height'#3 +#20#2#3'Top'#2'i'#5'Width'#2'K'#5'Align'#7#7'alRight'#8'AutoSize'#9#10'Bevel' +'Outer'#7#6'bvNone'#12'ClientHeight'#3#20#2#11'ClientWidth'#2'K'#8'TabOrder' +#2#1#0#13'TColorPalette'#7'Palette'#4'Left'#2#0#6'Height'#3#20#2#3'Top'#2#0#5 +'Width'#2'K'#5'Align'#7#8'alClient'#11'ButtonWidth'#2#12#12'ButtonHeight'#2 +#12#8'DragMode'#7#11'dmAutomatic'#16'OnColorMouseMove'#7#21'PaletteColorMous' +'eMove'#11'OnColorPick'#7#16'PaletteColorPick'#0#0#0#6'TPanel'#12'PanelToolB' - +'ar'#4'Left'#2#0#6'Height'#2'i'#3'Top'#2#0#5'Width'#3#167#3#5'Align'#7#5'alT' - +'op'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'i'#11'ClientWidth'#3#167#3 + +'ar'#4'Left'#2#0#6'Height'#2'i'#3'Top'#2#0#5'Width'#3#152#3#5'Align'#7#5'alT' + +'op'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'i'#11'ClientWidth'#3#152#3 +#8'TabOrder'#2#2#0#6'TBevel'#6'Bevel1'#4'Left'#2#0#6'Height'#2#2#3'Top'#2'E' - +#5'Width'#3#167#3#5'Align'#7#5'alTop'#5'Shape'#7#12'bsBottomLine'#0#0#6'TBev' - +'el'#6'Bevel2'#4'Left'#2#0#6'Height'#2#2#3'Top'#2'!'#5'Width'#3#167#3#5'Alig' + +#5'Width'#3#152#3#5'Align'#7#5'alTop'#5'Shape'#7#12'bsBottomLine'#0#0#6'TBev' + +'el'#6'Bevel2'#4'Left'#2#0#6'Height'#2#2#3'Top'#2'!'#5'Width'#3#152#3#5'Alig' +'n'#7#5'alTop'#5'Shape'#7#12'bsBottomLine'#0#0#8'TToolBar'#7'ToolBar'#4'Left' - +#2#0#6'Height'#2'!'#3'Top'#2#0#5'Width'#3#167#3#12'ButtonHeight'#2' '#11'But' + +#2#0#6'Height'#2'!'#3'Top'#2#0#5'Width'#3#152#3#12'ButtonHeight'#2' '#11'But' +'tonWidth'#2'$'#5'Color'#7#9'clBtnFace'#11'EdgeBorders'#11#0#6'Images'#7#16 ,'ImageListActions'#11'ParentColor'#8#8'TabOrder'#2#0#0#11'TToolButton'#9'Too' +'lClose'#4'Left'#2'm'#4'Hint'#6#5'Close'#3'Top'#2#0#7'Caption'#6#6'&Close'#10 @@ -109,17 +109,17 @@ LazarusResources.Add('TMainForm','FORMDATA',[ +'ZoomOutBtn'#10'ImageIndex'#2#11#7'OnClick'#7#15'ZoomOutBtnClick'#0#0#11'TTo' +'olButton'#11'ToolButton1'#4'Left'#3#22#2#3'Top'#2#0#5'Width'#2#8#7'Caption' +#6#11'ToolButton1'#5'Style'#7#12'tbsSeparator'#0#0#6'TPanel'#6'Panel1'#4'Lef' - +'t'#3#30#2#6'Height'#2' '#3'Top'#2#0#5'Width'#3#168#0#10'BevelOuter'#7#6'bvN' - +'one'#12'ClientHeight'#2' '#11'ClientWidth'#3#168#0#8'TabOrder'#2#1#0#9'TCom' + +'t'#3#30#2#6'Height'#2' '#3'Top'#2#0#5'Width'#3#170#0#10'BevelOuter'#7#6'bvN' + +'one'#12'ClientHeight'#2' '#11'ClientWidth'#3#170#0#8'TabOrder'#2#1#0#9'TCom' +'boBox'#11'FontListBox'#4'Left'#2#2#6'Height'#2#27#3'Top'#2#3#5'Width'#2'p' +#10'ItemHeight'#2#19#8'OnChange'#7#17'FontListBoxChange'#7'OnClick'#7#16'Fon' +'tListBoxClick'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#9'TSpinEdi' +'t'#8'FontSize'#4'Left'#2'u'#6'Height'#2#27#3'Top'#2#3#5'Width'#2'2'#8'OnCha' +'nge'#7#14'FontSizeChange'#8'TabOrder'#2#1#5'Value'#2#10#0#0#0#0#6'TPanel'#12 - +'PanelOptions'#4'Left'#2#0#6'Height'#2'"'#3'Top'#2'#'#5'Width'#3#167#3#5'Ali' + +'PanelOptions'#4'Left'#2#0#6'Height'#2'"'#3'Top'#2'#'#5'Width'#3#152#3#5'Ali' +'gn'#7#5'alTop'#25'BorderSpacing.InnerBorder'#2#4#31'BorderSpacing.CellAlign' +'Vertical'#7#9'ccaCenter'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'"'#11 - +'ClientWidth'#3#167#3#8'TabOrder'#2#1#0#6'TLabel'#16'LabelFillOutline'#4'Lef' + +'ClientWidth'#3#152#3#8'TabOrder'#2#1#0#6'TLabel'#16'LabelFillOutline'#4'Lef' +'t'#2'g'#6'Height'#2'"'#3'Top'#2#0#5'Width'#2'H'#5'Align'#7#6'alLeft'#7'Capt' +'ion'#6#14'Fill, Outline:'#21'Constraints.MinHeight'#2' '#6'Layout'#7#8'tlCe' +'nter'#11'ParentColor'#8#0#0#6'TLabel'#10'LabelShape'#4'Left'#2#0#6'Height'#2 @@ -128,7 +128,7 @@ LazarusResources.Add('TMainForm','FORMDATA',[ +'TLabel'#13'LabelMaskTool'#4'Left'#3#2#1#6'Height'#2'"'#3'Top'#2#0#5'Width'#2 +'C'#5'Align'#7#6'alLeft'#7'Caption'#6#10'Mask Tool:'#21'Constraints.MinHeigh' +'t'#2' '#6'Layout'#7#8'tlCenter'#11'ParentColor'#8#0#0#6'TPanel'#11'PanelCol' - +'ors'#4'Left'#3#211#2#6'Height'#2'"'#3'Top'#2#0#5'Width'#3#212#0#5'Align'#7#7 + +'ors'#4'Left'#3#196#2#6'Height'#2'"'#3'Top'#2#0#5'Width'#3#212#0#5'Align'#7#7 ,'alRight'#8'AutoSize'#9#25'BorderSpacing.InnerBorder'#2#4'!BorderSpacing.Cel' +'lAlignHorizontal'#7#10'ccaLeftTop'#31'BorderSpacing.CellAlignVertical'#7#9 +'ccaCenter'#10'BevelOuter'#7#6'bvNone'#12'ClientHeight'#2'"'#11'ClientWidth' @@ -691,8 +691,8 @@ LazarusResources.Add('TMainForm','FORMDATA',[ +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0 +#255#255#255#0#255#255#255#0#10'GroupIndex'#2#1#9'NumGlyphs'#2#0#7'OnClick'#7 +#22'ToolMaskFloodFillClick'#0#0#0#0#6'TPanel'#16'PanelToolOptions'#4'Left'#2 - +#0#6'Height'#2'"'#3'Top'#2'G'#5'Width'#3#167#3#5'Align'#7#5'alTop'#10'BevelO' - +'uter'#7#6'bvNone'#12'ClientHeight'#2'"'#11'ClientWidth'#3#167#3#8'TabOrder' + +#0#6'Height'#2'"'#3'Top'#2'G'#5'Width'#3#152#3#5'Align'#7#5'alTop'#10'BevelO' + +'uter'#7#6'bvNone'#12'ClientHeight'#2'"'#11'ClientWidth'#3#152#3#8'TabOrder' +#2#2#0#6'TLabel'#9'LabelSize'#4'Left'#2#0#6'Height'#2'"'#3'Top'#2#0#5'Width' +#2#28#5'Align'#7#6'alLeft'#7'Caption'#6#5'Size:'#21'Constraints.MinHeight'#2 +' '#6'Layout'#7#8'tlCenter'#11'ParentColor'#8#0#0#6'TLabel'#12'LabelDensity' @@ -749,7 +749,7 @@ LazarusResources.Add('TMainForm','FORMDATA',[ +#30#8'TabOrder'#2#5#0#9'TCheckBox'#10'checkFuzzy'#4'Left'#2#4#6'Height'#2#19 +#3'Top'#2#9#5'Width'#2#20#8'OnChange'#7#16'checkFuzzyChange'#8'TabOrder'#2#0 +#0#0#0#0#0#6'TPanel'#13'PanelPictures'#4'Left'#2'('#6'Height'#3#20#2#3'Top'#2 - +'i'#5'Width'#3'4'#3#5'Align'#7#8'alClient'#10'BevelOuter'#7#9'bvLowered'#8'T' + +'i'#5'Width'#3'%'#3#5'Align'#7#8'alClient'#10'BevelOuter'#7#9'bvLowered'#8'T' +'abOrder'#2#3#0#0#9'TMainMenu'#8'MainMenu'#6'Images'#7#16'ImageListActions'#4 +'left'#2'r'#3'top'#2'~'#0#9'TMenuItem'#12'MenuItemFile'#7'Caption'#6#5'&File' +#0#9'TMenuItem'#11'MenuItemNew'#7'Caption'#6#7'&New...'#11'Bitmap.Data'#10'z' diff --git a/applications/lazimageeditor/main.pas b/applications/lazimageeditor/main.pas index 1b2fd2638..698834fe4 100644 --- a/applications/lazimageeditor/main.pas +++ b/applications/lazimageeditor/main.pas @@ -32,7 +32,7 @@ interface uses Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Menus, ExtCtrls, ComCtrls, ActnList, StdActns, ExtDlgs, Buttons, StdCtrls, Spin, - NewDialog, ResizeDialog, ResizePaperDialog, AboutDialog, DLBitmap, + ColorBox, NewDialog, ResizeDialog, ResizePaperDialog, AboutDialog, DLBitmap, PictureManager, PictureCtrls, ColorPalette; type @@ -1192,7 +1192,9 @@ end; procedure TMainForm.FontListBoxChange(Sender: TObject); begin - ActivePictureEdit.Canvas.Font.Name := FontListBox.Text; + //ActivePictureEdit.Canvas.Font.Name := FontListBox.Text; + ActivePictureEdit.Picture.Canvas.Font.Name := FontListBox.Text; + ActivePictureEdit.Picture.Canvas.Font.Color := PanelOutline.Color; if ActivePictureEdit.Tool <> ptText then TextEditor.StopEdit; end; @@ -1204,7 +1206,8 @@ end; procedure TMainForm.FontSizeChange(Sender: TObject); begin - ActivePictureEdit.Canvas.Font.Size := FontSize.Value; + ActivePictureEdit.Picture.Canvas.Font.Size := FontSize.Value; + ActivePictureEdit.Picture.Canvas.Font.Color := PanelOutline.Color; end; procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);