reduced message window selection events

git-svn-id: trunk@7985 -
This commit is contained in:
mattias 2005-10-23 06:02:04 +00:00
parent adcfb30dbe
commit e4c6c02a98
2 changed files with 23 additions and 8 deletions

View File

@ -105,8 +105,10 @@ type
function GetMessage: string; function GetMessage: string;
function GetVisibleItems(Index: integer): TMessageLine; function GetVisibleItems(Index: integer): TMessageLine;
procedure SetLastLineIsProgress(const AValue: boolean); procedure SetLastLineIsProgress(const AValue: boolean);
procedure DoSelectionChange;
protected protected
fBlockCount: integer; fBlockCount: integer;
FLastSelectedIndex: integer;
function GetSelectedLineIndex: integer; function GetSelectedLineIndex: integer;
procedure SetSelectedLineIndex(const AValue: integer); procedure SetSelectedLineIndex(const AValue: integer);
public public
@ -114,7 +116,7 @@ type
destructor Destroy; override; destructor Destroy; override;
procedure DeleteLine(Index: integer); procedure DeleteLine(Index: integer);
procedure Add(const Msg, CurDir: string; procedure Add(const Msg, CurDir: string;
ProgressLine, VisibleLine: boolean; OriginalIndex: integer); ProgressLine, VisibleLine: boolean; OriginalIndex: integer);
procedure AddMsg(const Msg, CurDir: string; OriginalIndex: integer); procedure AddMsg(const Msg, CurDir: string; OriginalIndex: integer);
procedure AddProgress(const Msg, CurDir: string); procedure AddProgress(const Msg, CurDir: string);
procedure AddSeparator; procedure AddSeparator;
@ -186,6 +188,7 @@ begin
Name := NonModalIDEWindowNames[nmiwMessagesViewName]; Name := NonModalIDEWindowNames[nmiwMessagesViewName];
FItems := TList.Create; FItems := TList.Create;
FVisibleItems := TList.Create; FVisibleItems := TList.Create;
FLastSelectedIndex := -1;
Caption := lisMenuViewMessages; Caption := lisMenuViewMessages;
@ -443,9 +446,7 @@ procedure TMessagesView.MessageViewDblClicked(Sender: TObject);
begin begin
if not EnvironmentOptions.MsgViewDblClickJumps then if not EnvironmentOptions.MsgViewDblClickJumps then
exit; exit;
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then DoSelectionChange;
if Assigned(OnSelectionChanged) then
OnSelectionChanged(self);
end; end;
procedure TMessagesView.CopyAllMenuItemClick(Sender: TObject); procedure TMessagesView.CopyAllMenuItemClick(Sender: TObject);
@ -469,9 +470,7 @@ procedure TMessagesView.MessageViewClicked(Sender: TObject);
begin begin
if EnvironmentOptions.MsgViewDblClickJumps then if EnvironmentOptions.MsgViewDblClickJumps then
exit; exit;
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then DoSelectionChange;
if Assigned(OnSelectionChanged) then
OnSelectionChanged(self);
end; end;
procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: word; procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: word;
@ -542,6 +541,20 @@ begin
FLastLineIsProgress := AValue; FLastLineIsProgress := AValue;
end; end;
procedure TMessagesView.DoSelectionChange;
var
NewSelectedIndex: LongInt;
begin
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then begin
NewSelectedIndex:=GetSelectedLineIndex;
if NewSelectedIndex<>FLastSelectedIndex then begin
FLastSelectedIndex:=NewSelectedIndex;
if Assigned(OnSelectionChanged) then
OnSelectionChanged(Self);
end;
end;
end;
procedure TMessagesView.SetSelectedLineIndex(const AValue: integer); procedure TMessagesView.SetSelectedLineIndex(const AValue: integer);
begin begin
MessageView.ItemIndex := AValue; MessageView.ItemIndex := AValue;

View File

@ -847,9 +847,11 @@ begin
and FActiveControl.Visible and FActiveControl.Enabled and FActiveControl.Visible and FActiveControl.Enabled
and ([csLoading,csDestroying]*ComponentState=[]) and ([csLoading,csDestroying]*ComponentState=[])
and not FActiveControl.ParentDestroyingHandle and not FActiveControl.ParentDestroyingHandle
then then begin
// get or create handle of FActiveControl // get or create handle of FActiveControl
FocusHandle := FActiveControl.Handle; FocusHandle := FActiveControl.Handle;
//debugln('TCustomForm.WndProc A ',DbgSName(Self),' FActiveControl=',DbgSName(FActiveControl),' FocusHandle=',dbgs(FocusHandle));
end;
end; end;
TheMessage.Result:=0; TheMessage.Result:=0;