* Refactoring

git-svn-id: https://svn.code.sf.net/p/kolmck/code@164 91bb2d04-0c0c-4d2d-88a5-bbb6f4c1fa07
This commit is contained in:
dkolmck
2017-09-20 09:42:57 +00:00
parent 7020f027c5
commit 7c9fe13a5a
5 changed files with 161 additions and 167 deletions

View File

@@ -38,11 +38,16 @@ requires
vclx; vclx;
contains contains
KolZLibBzip in 'KolZLibBzip.pas',
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
KOLFontEditor in 'KOLFontEditor.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KOLCCtrls in 'KOLCCtrls.pas', KOLCCtrls in 'KOLCCtrls.pas',
mckCCtrls in 'mckCCtrls.pas', mckCCtrls in 'mckCCtrls.pas',
KOLHashs in 'KOLHashs.PAS', KOLHashs in 'KOLHashs.PAS',
mckHashs in 'mckHashs.pas', mckHashs in 'mckHashs.pas',
KOLFontEditor in 'KOLFontEditor.pas',
KOLmhxp in 'KOLmhxp.pas', KOLmhxp in 'KOLmhxp.pas',
MCKMHXP in 'MCKMHXP.pas', MCKMHXP in 'MCKMHXP.pas',
mckEcmListEdit in 'mckEcmListEdit.pas', mckEcmListEdit in 'mckEcmListEdit.pas',
@@ -50,11 +55,6 @@ contains
mckBlockCipher in 'mckBlockCipher.pas', mckBlockCipher in 'mckBlockCipher.pas',
KOLBlockCipher in 'KOLBlockCipher.pas', KOLBlockCipher in 'KOLBlockCipher.pas',
mckXPMenus in 'mckXPMenus.pas', mckXPMenus in 'mckXPMenus.pas',
XPMenus in 'XPMenus.pas', XPMenus in 'XPMenus.pas';
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KolZLibBzip in 'KolZLibBzip.pas';
end. end.

View File

@@ -39,11 +39,16 @@ requires
vclx; vclx;
contains contains
KolZLibBzip in 'KolZLibBzip.pas',
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
KOLFontEditor in 'KOLFontEditor.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KOLCCtrls in 'KOLCCtrls.pas', KOLCCtrls in 'KOLCCtrls.pas',
mckCCtrls in 'mckCCtrls.pas', mckCCtrls in 'mckCCtrls.pas',
KOLHashs in 'KOLHashs.PAS', KOLHashs in 'KOLHashs.PAS',
mckHashs in 'mckHashs.pas', mckHashs in 'mckHashs.pas',
KOLFontEditor in 'KOLFontEditor.pas',
KOLmhxp in 'KOLmhxp.pas', KOLmhxp in 'KOLmhxp.pas',
MCKMHXP in 'MCKMHXP.pas', MCKMHXP in 'MCKMHXP.pas',
mckEcmListEdit in 'mckEcmListEdit.pas', mckEcmListEdit in 'mckEcmListEdit.pas',
@@ -51,11 +56,6 @@ contains
mckBlockCipher in 'mckBlockCipher.pas', mckBlockCipher in 'mckBlockCipher.pas',
KOLBlockCipher in 'KOLBlockCipher.pas', KOLBlockCipher in 'KOLBlockCipher.pas',
mckXPMenus in 'mckXPMenus.pas', mckXPMenus in 'mckXPMenus.pas',
XPMenus in 'XPMenus.pas', XPMenus in 'XPMenus.pas';
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KolZLibBzip in 'KolZLibBzip.pas';
end. end.

View File

@@ -39,11 +39,16 @@ requires
vclx; vclx;
contains contains
KolZLibBzip in 'KolZLibBzip.pas',
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
KOLFontEditor in 'KOLFontEditor.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KOLCCtrls in 'KOLCCtrls.pas', KOLCCtrls in 'KOLCCtrls.pas',
mckCCtrls in 'mckCCtrls.pas', mckCCtrls in 'mckCCtrls.pas',
KOLHashs in 'KOLHashs.PAS', KOLHashs in 'KOLHashs.PAS',
mckHashs in 'mckHashs.pas', mckHashs in 'mckHashs.pas',
KOLFontEditor in 'KOLFontEditor.pas',
KOLmhxp in 'KOLmhxp.pas', KOLmhxp in 'KOLmhxp.pas',
MCKMHXP in 'MCKMHXP.pas', MCKMHXP in 'MCKMHXP.pas',
mckEcmListEdit in 'mckEcmListEdit.pas', mckEcmListEdit in 'mckEcmListEdit.pas',
@@ -51,11 +56,6 @@ contains
mckBlockCipher in 'mckBlockCipher.pas', mckBlockCipher in 'mckBlockCipher.pas',
KOLBlockCipher in 'KOLBlockCipher.pas', KOLBlockCipher in 'KOLBlockCipher.pas',
mckXPMenus in 'mckXPMenus.pas', mckXPMenus in 'mckXPMenus.pas',
XPMenus in 'XPMenus.pas', XPMenus in 'XPMenus.pas';
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KolZLibBzip in 'KolZLibBzip.pas';
end. end.

View File

@@ -36,11 +36,16 @@ requires
vclx; vclx;
contains contains
KolZLibBzip in 'KolZLibBzip.pas',
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
KOLFontEditor in 'KOLFontEditor.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KOLCCtrls in 'KOLCCtrls.pas', KOLCCtrls in 'KOLCCtrls.pas',
mckCCtrls in 'mckCCtrls.pas', mckCCtrls in 'mckCCtrls.pas',
KOLHashs in 'KOLHashs.PAS', KOLHashs in 'KOLHashs.PAS',
mckHashs in 'mckHashs.pas', mckHashs in 'mckHashs.pas',
KOLFontEditor in 'KOLFontEditor.pas',
KOLmhxp in 'KOLmhxp.pas', KOLmhxp in 'KOLmhxp.pas',
MCKMHXP in 'MCKMHXP.pas', MCKMHXP in 'MCKMHXP.pas',
mckEcmListEdit in 'mckEcmListEdit.pas', mckEcmListEdit in 'mckEcmListEdit.pas',
@@ -48,11 +53,6 @@ contains
mckBlockCipher in 'mckBlockCipher.pas', mckBlockCipher in 'mckBlockCipher.pas',
KOLBlockCipher in 'KOLBlockCipher.pas', KOLBlockCipher in 'KOLBlockCipher.pas',
mckXPMenus in 'mckXPMenus.pas', mckXPMenus in 'mckXPMenus.pas',
XPMenus in 'XPMenus.pas', XPMenus in 'XPMenus.pas';
tinyPNG in 'tinyPNG.pas',
tinyJPGGIFBMP in 'tinyJPGGIFBMP.pas',
mckWebBrowser in 'mckWebBrowser.pas',
mckDHTML in 'mckDHTML.pas',
KolZLibBzip in 'KolZLibBzip.pas';
end. end.

View File

@@ -144,7 +144,7 @@ type
Options: TEditOptions; Options: TEditOptions;
end; end;
TOnEditText = procedure(Sender: PControl; ACol, ARow: Integer; var Value: string) of object; TOnEditText = procedure(Sender: PControl; ACol, ARow: Integer; var Value: KOLString) of object;
TOnEditChar = procedure(Sender: PControl; ACol, ARow: Integer; var Key: KOLChar; Shift: DWORD) of object; TOnEditChar = procedure(Sender: PControl; ACol, ARow: Integer; var Key: KOLChar; Shift: DWORD) of object;
TOnEndEdit = procedure(Sender: PControl; ACol, ARow: Integer; CellChanged: Boolean) of object; TOnEndEdit = procedure(Sender: PControl; ACol, ARow: Integer; CellChanged: Boolean) of object;
TOnCreateEdit = procedure(Sender: PControl; ACol: Integer; var Editor: PControl; var ReadOnly: Boolean; var AutoHide: Boolean) of object; TOnCreateEdit = procedure(Sender: PControl; ACol: Integer; var Editor: PControl; var ReadOnly: Boolean; var AutoHide: Boolean) of object;
@@ -304,11 +304,13 @@ begin
with PEcmListEdit(Sender.CustomObj)^ do begin with PEcmListEdit(Sender.CustomObj)^ do begin
case Msg.message of case Msg.message of
LVM_INSERTCOLUMNA, LVM_INSERTCOLUMNW, LVM_DELETECOLUMN: LVM_INSERTCOLUMNA, LVM_INSERTCOLUMNW, LVM_DELETECOLUMN:
begin
PostMessage(Msg.hwnd, LEN_COL_ADJUST, 0, 0); PostMessage(Msg.hwnd, LEN_COL_ADJUST, 0, 0);
end;
LEN_COL_ADJUST: LEN_COL_ADJUST:
begin
DoColAdjust(Sender.LVColCount); DoColAdjust(Sender.LVColCount);
end;
WM_LBUTTONDOWN{$IFDEF rbutton_sel}, WM_RBUTTONDOWN{$ENDIF}: WM_LBUTTONDOWN{$IFDEF rbutton_sel}, WM_RBUTTONDOWN{$ENDIF}:
begin begin
NewLine := GetLVItemAtPos(TSmallPoint(Msg.lParam), NewCurIdx); NewLine := GetLVItemAtPos(TSmallPoint(Msg.lParam), NewCurIdx);
@@ -316,16 +318,15 @@ begin
Sender.Focused := True; Sender.Focused := True;
Result := True; Result := True;
end; end;
WM_LBUTTONDBLCLK{$IFDEF rbutton_sel}, WM_RBUTTONDBLCLK{$ENDIF}: WM_LBUTTONDBLCLK{$IFDEF rbutton_sel}, WM_RBUTTONDBLCLK{$ENDIF}:
begin begin
NewLine := GetLVItemAtPos(TSmallPoint(Msg.lParam), NewCurIdx); NewLine := GetLVItemAtPos(TSmallPoint(Msg.lParam), NewCurIdx);
SetCurLVPos(NewLine, NewCurIdx); SetCurLVPos(NewLine, NewCurIdx);
if (NewLine <> -1) and (NewCurIdx <> -1) then StartEdit; if (NewLine <> -1) and (NewCurIdx <> -1) then
StartEdit;
Sender.Tabstop := False; Sender.Tabstop := False;
Result := True; Result := True;
end; end;
WM_KEYDOWN: WM_KEYDOWN:
begin begin
if (Msg.WParam = VK_RETURN) then if (Msg.WParam = VK_RETURN) then
@@ -340,11 +341,9 @@ begin
end; end;
SetEditPos; SetEditPos;
end; end;
//fInPlaceEd.Click; //.DroppedDown := True;
end; end;
WM_CHAR: // by SeM
// by SeM begin
WM_CHAR:
if (GetKeyState(VK_CONTROL) >= 0) then begin // ! by Matveev Dmitry if (GetKeyState(VK_CONTROL) >= 0) then begin // ! by Matveev Dmitry
case Msg.wParam of case Msg.wParam of
VK_ESCAPE, VK_RETURN, VK_TAB: VK_ESCAPE, VK_RETURN, VK_TAB:
@@ -353,12 +352,12 @@ begin
StartEdit; StartEdit;
Sender.Tabstop := False; Sender.Tabstop := False;
if Assigned(fInPlaceEd) then if Assigned(fInPlaceEd) then
PostMessage(fInPlaceEd.Handle, Msg.message, Msg.wParam, Msg.lParam); fInPlaceEd.Postmsg(Msg.message, Msg.wParam, Msg.lParam);
Result := True; Result := True;
end; end;
end; end;
end; end;
end;
WM_NCPAINT, WM_PAINT: WM_NCPAINT, WM_PAINT:
begin begin
{$IFDEF _LE_DEBUG_} {$IFDEF _LE_DEBUG_}
@@ -366,9 +365,6 @@ begin
{$ENDIF} {$ENDIF}
SetEditPos(); SetEditPos();
end; end;
// WM_ERASEBKGND: Result := True;
// �����-�� ���� � ����������� ����� � ������ lvoGridLines ��� ������������� // �����-�� ���� � ����������� ����� � ������ lvoGridLines ��� �������������
// ���� XP - ��� ��������� ScrollBar(������ �������� "�����","����") ���������� // ���� XP - ��� ��������� ScrollBar(������ �������� "�����","����") ����������
// ������ ���������� ����� - � ���������� �������� ������ ���������� �������������� // ������ ���������� ����� - � ���������� �������� ������ ���������� ��������������
@@ -423,22 +419,20 @@ begin
case Msg.message of case Msg.message of
WM_KEYDOWN: WM_KEYDOWN:
begin begin
if Msg.wParam = VK_ESCAPE then if (Msg.wParam = VK_ESCAPE) then
PEcmListEdit(Sender.Parent.CustomObj).StopEdit(False); PEcmListEdit(Sender.Parent.CustomObj).StopEdit(False);
end; end;
WM_KILLFOCUS: WM_KILLFOCUS:
begin begin
pLE := PEcmListEdit(Sender.Parent.CustomObj); pLE := PEcmListEdit(Sender.Parent.CustomObj);
if Assigned(pLE) then begin if Assigned(pLE) then begin
with pLE^ do if pLE.fEmbedEd and pLE.fAutoHide then begin
if (fEmbedEd and fAutoHide) then begin pLE.InternalStopEdit(True);
InternalStopEdit(True); pLE.HideInPlaceEd(True);
HideInPlaceEd(True);
end; end;
end; end;
end; end;
// D[u]fa WM_CHAR: //+dufa
WM_CHAR:
if (Msg.wParam = VK_RETURN) then begin if (Msg.wParam = VK_RETURN) then begin
Msg.message := WM_KILLFOCUS; Msg.message := WM_KILLFOCUS;
WndProcInPlaceEd(Sender, Msg, Rslt); WndProcInPlaceEd(Sender, Msg, Rslt);
@@ -447,7 +441,7 @@ begin
end; end;
end; end;
// ��������� � ������� ������� ���������� �� ������� "��������" ��� ��������� // ��������� � ������� ������� ���������� �� ������� "��������" ��� ���������
// ��������. ����� �������������� ��� ������������ KOLListView. // ��������. ����� �������������� ��� ������������ KOLListView.
// ��� ���������� ����� �������� ListView-� (ListEdit-�) ���������� ������������ // ��� ���������� ����� �������� ListView-� (ListEdit-�) ���������� ������������
// ������ ������� ������� ListViewXXX.AttachProc(@WndProcListViewWOResizeFlicks); // ������ ������� ������� ListViewXXX.AttachProc(@WndProcListViewWOResizeFlicks);
@@ -471,6 +465,7 @@ begin
FillRect(Msg.wParam, rRight, Sender.Canvas.Brush.Handle); FillRect(Msg.wParam, rRight, Sender.Canvas.Brush.Handle);
end else end else
rUnder := rClient; rUnder := rClient;
FillRect(Msg.wParam, rUnder, Sender.Canvas.Brush.Handle); FillRect(Msg.wParam, rUnder, Sender.Canvas.Brush.Handle);
Result := True; Result := True;
end; end;
@@ -484,7 +479,9 @@ var
mOpt: TListViewOptions; mOpt: TListViewOptions;
begin begin
mOpt := Options + [lvoHideSel, lvoOwnerDrawFixed]; mOpt := Options + [lvoHideSel, lvoOwnerDrawFixed];
if ((Style <> lvsDetail) and (Style <> lvsDetailNoHeader)) then Style := lvsDetail; if ((Style <> lvsDetail) and (Style <> lvsDetailNoHeader)) then
Style := lvsDetail;
Result := NewListView(AParent, Style, mOpt, ImageListSmall, ImageListNormal, ImageListState); Result := NewListView(AParent, Style, mOpt, ImageListSmall, ImageListNormal, ImageListState);
New(pLD, Create); New(pLD, Create);
pLD.fOwner := Result; pLD.fOwner := Result;
@@ -512,7 +509,8 @@ end;
procedure TEcmListEdit.EditOnKeyDown(Sender: PControl; var Key: Longint; Shift: DWORD); procedure TEcmListEdit.EditOnKeyDown(Sender: PControl; var Key: Longint; Shift: DWORD);
begin begin
if (fScroll <> 0) then if (fScroll <> 0) then
PostMessage(fOwner.Handle, LVM_SCROLL, fScroll, 0); fOwner.Postmsg(LVM_SCROLL, fScroll, 0);
case key of case key of
// VK_RETURN: // VK_RETURN:
// StoreEditValues; // StoreEditValues;
@@ -541,8 +539,7 @@ begin
AddLog(Self.fOwner, 'DestroyInPlaceEditor'); AddLog(Self.fOwner, 'DestroyInPlaceEditor');
{$ENDIF} {$ENDIF}
if fEmbedEd and Assigned(fInPlaceEd) then if fEmbedEd and Assigned(fInPlaceEd) then
fInPlaceEd.Free; Free_And_Nil(fInPlaceEd);
fInPlaceEd := nil;
end; end;
procedure TEcmListEdit.SetEditPos; procedure TEcmListEdit.SetEditPos;
@@ -564,7 +561,7 @@ begin
GetWindowRect(Header, Re); GetWindowRect(Header, Re);
HeaderHeight := Re.Bottom - Re.Top; HeaderHeight := Re.Bottom - Re.Top;
if (R.Top >= HeaderHeight) then begin if (R.Top >= HeaderHeight) then begin
if fEmbedEd and (fInPlaceEd.Perform(EM_GETRECT, 0, Integer(@Re)) > 0) then begin if fEmbedEd and (fInPlaceEd.Perform(EM_GETRECT, 0, LPARAM(@Re)) > 0) then begin
if (R.Bottom - R.Top) > (Re.Bottom - Re.Top) then begin if (R.Bottom - R.Top) > (Re.Bottom - Re.Top) then begin
cw := ((R.Bottom - R.Top) - (Re.Bottom - Re.Top)) div 2; cw := ((R.Bottom - R.Top) - (Re.Bottom - Re.Top)) div 2;
Inc(R.Top, cw); Inc(R.Top, cw);
@@ -579,8 +576,7 @@ begin
Dec(R.Right, Right); Dec(R.Right, Right);
Inc(R.Top, Top); Inc(R.Top, Top);
Dec(R.Bottom, Bottom); Dec(R.Bottom, Bottom);
// if fEmbedEd then //?
if fEmbedEd then
Dec(R.Left, 2); Dec(R.Left, 2);
end; end;
end else end else
@@ -604,8 +600,8 @@ end;
procedure TEcmListEdit.LoadEditValues; procedure TEcmListEdit.LoadEditValues;
var var
i: Integer; i: Integer;
S: String; S: KOLString;
V: String; V: KOLString;
begin begin
{$IFDEF _LE_DEBUG_} {$IFDEF _LE_DEBUG_}
AddLog(Self.fOwner, 'LoadEditValues'); AddLog(Self.fOwner, 'LoadEditValues');
@@ -617,7 +613,7 @@ begin
if IsComboEditor then begin if IsComboEditor then begin
IsComboEditor := False; IsComboEditor := False;
fInPlaceEd.CurIndex := fInPlaceEd.IndexOf(S); fInPlaceEd.CurIndex := fInPlaceEd.IndexOf(S);
//fInPlaceEd.DroppedDown := True; //fInPlaceEd.DroppedDown := True; <-- unfortunly don'work... combobox force close after open
end else begin //if fEmbedEd then begin end else begin //if fEmbedEd then begin
if (fInPlaceEd.SubClassName = 'obj_COMBOBOX') then begin if (fInPlaceEd.SubClassName = 'obj_COMBOBOX') then begin
i := fInPlaceEd.IndexOf(S); i := fInPlaceEd.IndexOf(S);
@@ -690,13 +686,15 @@ begin
{$IFDEF _LE_DEBUG_} {$IFDEF _LE_DEBUG_}
AddLog(Self.fOwner, 'StartEdit'); AddLog(Self.fOwner, 'StartEdit');
{$ENDIF} {$ENDIF}
if (fOwner.LVColCount = 0) or (fOwner.LVCount = 0) or fStarted or (fCurIdx = -1) then Exit; if (fOwner.LVColCount = 0) or (fOwner.LVCount = 0) or fStarted or (fCurIdx = -1) then
Exit;
fCurLine := fOwner.LVCurItem; fCurLine := fOwner.LVCurItem;
if (fCurLine = -1) then begin if (fCurLine = -1) then begin
fCurLine := 0; fCurLine := 0;
fOwner.LVCurItem := 0; fOwner.LVCurItem := 0;
end; end;
//CreateInPlaceEditor(fOwner.LVColCount);
if not fStarted then begin if not fStarted then begin
DestroyInPlaceEditor; DestroyInPlaceEditor;
if (fOwner.LVColCount > 0) then begin if (fOwner.LVColCount > 0) then begin
@@ -704,6 +702,7 @@ begin
fInPlaceEd := NewInPlaceEdit(pEO.Options, pEO.TextAlign); fInPlaceEd := NewInPlaceEdit(pEO.Options, pEO.TextAlign);
end; end;
end; end;
if Assigned(fInPlaceEd) then begin if Assigned(fInPlaceEd) then begin
fStarted := True; fStarted := True;
SetEditPos; SetEditPos;
@@ -748,35 +747,32 @@ begin
end; end;
end; end;
if Assigned(fOnEditChar) then begin if Assigned(fOnEditChar) then begin
case Key of // BackSpace! - ������ ������������
#08: // BackSpace! - ������ ������������ if (Key <> #08) then // wtf? backspace is 9!
else
fOnEditChar(fInPlaceEd, fCurIdx, fOwner.LVCurItem, Key, Shift); fOnEditChar(fInPlaceEd, fCurIdx, fOwner.LVCurItem, Key, Shift);
end; end;
end; end;
end;
function TEcmListEdit.LVDrawItem(Sender: PObj; DC: HDC; const Rect: TRect; ItemIdx: Integer; DrawAction: TDrawAction; ItemState: TDrawState): Boolean; function TEcmListEdit.LVDrawItem(Sender: PObj; DC: HDC; const Rect: TRect; ItemIdx: Integer; DrawAction: TDrawAction; ItemState: TDrawState): Boolean;
var var
fBr: HBRUSH; fBr: HBRUSH;
cBr: TColor; cBr: TColor;
i: Integer; i: Integer;
S: String; S: KOLString;
P: TPoint; P: TPoint;
R: TRect; R: TRect;
dt: DWORD; dt: DWORD;
pEO: PEditorOptions; pEO: PEditorOptions;
begin begin
with fOwner^ do begin
fShift := 0; fShift := 0;
for i := 0 to LVColCount - 1 do begin for i := 0 to fOwner.LVColCount - 1 do begin
R := LVSubItemRect(ItemIdx, i); R := fOwner.LVSubItemRect(ItemIdx, i);
P := LVItemPos[i]; P := fOwner.LVItemPos[i];
if (i = 0) then begin if (i = 0) then begin
R.Right := R.Left + LVColWidth[0]; R.Right := R.Left + fOwner.LVColWidth[0];
fShift := P.X - R.Left + 1; // dufa. 9.05.13, ������ ���� 2. � 1 ����� ListView + LVSCW_AUTOSIZE �������� ��� ����; fShift := P.X - R.Left + 1; // dufa. 9.05.13, ������ ���� 2. � 1 ����� ListView + LVSCW_AUTOSIZE �������� ��� ����;
end; end;
if (Perform(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) and LVS_EX_GRIDLINES) <> 0 then begin if (fOwner.Perform(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) and LVS_EX_GRIDLINES) <> 0 then begin
Inc(R.Left); Inc(R.Left);
Dec(R.Bottom); Dec(R.Bottom);
end; end;
@@ -789,7 +785,7 @@ begin
cBr := clBtnFace; cBr := clBtnFace;
if (ItemIdx = fCurLine) then begin if (ItemIdx = fCurLine) then begin
if (fOwner.Focused or (Assigned(fInPlaceEd) and fInPlaceEd.Visible)) and Enabled then begin if (fOwner.Focused or (Assigned(fInPlaceEd) and fInPlaceEd.Visible)) and fOwner.Enabled then begin
if (i = fCurIdx) then begin if (i = fCurIdx) then begin
if fStarted then if fStarted then
cBr := fOwner.LVTextBkColor cBr := fOwner.LVTextBkColor
@@ -797,13 +793,13 @@ begin
cBr := clHighlight; cBr := clHighlight;
SetTextColor(DC, Color2RGB(clHighlightText)); SetTextColor(DC, Color2RGB(clHighlightText));
end else begin end else begin
if (Perform(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) and LVS_EX_FULLROWSELECT) <> 0 then if (fOwner.Perform(LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0) and LVS_EX_FULLROWSELECT) <> 0 then
cBr := $F3E6CD; cBr := $F3E6CD;
SetTextColor(DC, Color2RGB(fOwner.Font.Color)); SetTextColor(DC, Color2RGB(fOwner.Font.Color));
end end
end else begin end else begin
SetTextColor(DC, Color2RGB(fOwner.Font.Color)); SetTextColor(DC, Color2RGB(fOwner.Font.Color));
if Enabled then begin if fOwner.Enabled then begin
if (i = fCurIdx) then begin if (i = fCurIdx) then begin
if fStarted then if fStarted then
cBr := fOwner.LVTextBkColor cBr := fOwner.LVTextBkColor
@@ -821,25 +817,22 @@ begin
FillRect(DC, R, fBr); FillRect(DC, R, fBr);
DeleteObject(fBr); DeleteObject(fBr);
if not ((ItemIdx = LVCurItem) and (fStarted) and (i = fCurIdx)) then begin if not ((ItemIdx = fOwner.LVCurItem) and (fStarted) and (i = fCurIdx)) then begin
S := fOwner.LVItems[ItemIdx, i]; S := fOwner.LVItems[ItemIdx, i];
dt := DT_END_ELLIPSIS or DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX; dt := DT_END_ELLIPSIS or DT_SINGLELINE or DT_VCENTER or DT_NOPREFIX;
if (fColOptions.Count <> LVColCount) then if (fColOptions.Count <> fOwner.LVColCount) then
DoColAdjust(LVColCount); DoColAdjust(fOwner.LVColCount);
pEO := fColOptions.Items[i]; pEO := fColOptions.Items[i];
case pEO.TextAlign of case pEO.TextAlign of
taRight: taRight: dt := dt or DT_RIGHT;
dt := dt or DT_RIGHT; taCenter: dt := dt or DT_CENTER;
taCenter:
dt := dt or DT_CENTER;
end; end;
Dec(R.Right, fShift); Dec(R.Right, fShift);
Inc(R.Left, fShift); Inc(R.Left, fShift);
DrawText(DC, @S[1], Length(S), R, dt); DrawText(DC, @S[1], Length(S), R, dt);
end; end;
end; end;
end;
Result := True; Result := True;
end; end;
@@ -849,11 +842,12 @@ var
pEO: PEditorOptions; pEO: PEditorOptions;
begin begin
if (ColCount <> fColOptions.Count) then begin if (ColCount <> fColOptions.Count) then begin
for i := fColOptions.Count - 1 downto 0 do // downto - for what? //for i := fColOptions.Count - 1 downto 0 do // downto - for what?
FreeMem(fColOptions.Items[i]); // FreeMem(fColOptions.Items[i]);
fColOptions.Clear; //fColOptions.Clear;
fColOptions.ReleaseItems;
for i := 0 to ColCount - 1 do begin for i := 0 to Pred(ColCount) do begin
New(pEO); New(pEO);
ZeroMemory(pEO, SizeOf(TEditorOptions)); ZeroMemory(pEO, SizeOf(TEditorOptions));
pEO.TextAlign := fOwner.LVColAlign[i]; pEO.TextAlign := fOwner.LVColAlign[i];
@@ -904,7 +898,7 @@ end;
procedure TEcmListEdit.InternalStopEdit(const Store: Boolean); procedure TEcmListEdit.InternalStopEdit(const Store: Boolean);
var var
i: Integer; i: Integer;
newValue: String; newValue: KOLString;
fCellChanged: Boolean; fCellChanged: Boolean;
begin begin
if fStarted then begin if fStarted then begin