mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 01:39:25 +02:00
converted msgview to lfm from Darius
git-svn-id: trunk@7910 -
This commit is contained in:
parent
5c7856fa49
commit
db444336d3
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -917,6 +917,8 @@ ide/mainbase.pas svneol=native#text/pascal
|
||||
ide/mainintf.pas svneol=native#text/pascal
|
||||
ide/makeresstrdlg.pas svneol=native#text/pascal
|
||||
ide/miscoptions.pas svneol=native#text/pascal
|
||||
ide/msgview.lfm svneol=native#text/plain
|
||||
ide/msgview.lrs svneol=native#text/plain
|
||||
ide/msgview.pp svneol=native#text/pascal
|
||||
ide/msgvieweditor.lfm svneol=native#text/plain
|
||||
ide/msgvieweditor.lrs svneol=native#text/pascal
|
||||
|
29
ide/msgview.lfm
Normal file
29
ide/msgview.lfm
Normal file
@ -0,0 +1,29 @@
|
||||
object MessagesView: TMessagesView
|
||||
BorderStyle = bsSizeToolWin
|
||||
Caption = 'MessagesView'
|
||||
ClientHeight = 79
|
||||
ClientWidth = 722
|
||||
KeyPreview = True
|
||||
OnKeyDown = MessagesViewKeyDown
|
||||
PixelsPerInch = 96
|
||||
Position = poScreenCenter
|
||||
HorzScrollBar.Page = 721
|
||||
VertScrollBar.Page = 78
|
||||
Left = 262
|
||||
Height = 79
|
||||
Top = 518
|
||||
Width = 722
|
||||
object MessageView: TListBox
|
||||
Align = alClient
|
||||
BorderSpacing.OnChange = nil
|
||||
MultiSelect = True
|
||||
PopupMenu = MainPopupMenu
|
||||
TabOrder = 0
|
||||
Height = 79
|
||||
Width = 722
|
||||
end
|
||||
object MainPopupMenu: TPopupMenu
|
||||
left = 46
|
||||
top = 41
|
||||
end
|
||||
end
|
12
ide/msgview.lrs
Normal file
12
ide/msgview.lrs
Normal file
@ -0,0 +1,12 @@
|
||||
{ This is an automatically generated lazarus resource file }
|
||||
|
||||
LazarusResources.Add('TMessagesView','FORMDATA',[
|
||||
'TPF0'#13'TMessagesView'#12'MessagesView'#11'BorderStyle'#7#13'bsSizeToolWin'
|
||||
+#7'Caption'#6#12'MessagesView'#12'ClientHeight'#2'O'#11'ClientWidth'#3#210#2
|
||||
+#10'KeyPreview'#9#9'OnKeyDown'#7#19'MessagesViewKeyDown'#13'PixelsPerInch'#2
|
||||
+'`'#8'Position'#7#14'poScreenCenter'#18'HorzScrollBar.Page'#3#209#2#18'VertS'
|
||||
+'crollBar.Page'#2'N'#4'Left'#3#6#1#6'Height'#2'O'#3'Top'#3#6#2#5'Width'#3#210
|
||||
+#2#0#8'TListBox'#11'MessageView'#5'Align'#7#8'alClient'#11'MultiSelect'#9#9
|
||||
+'PopupMenu'#7#13'MainPopupMenu'#8'TabOrder'#2#0#6'Height'#2'O'#5'Width'#3#210
|
||||
+#2#0#0#10'TPopupMenu'#13'MainPopupMenu'#4'left'#2'.'#3'top'#2')'#0#0#0
|
||||
]);
|
262
ide/msgview.pp
262
ide/msgview.pp
@ -37,15 +37,29 @@ unit MsgView;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Controls, StdCtrls, Forms, Menus, LResources,
|
||||
ClipBrd, Dialogs, InputHistory, FileUtil,
|
||||
Classes,
|
||||
ClipBrd,
|
||||
Controls,
|
||||
DialogProcs,
|
||||
Dialogs,
|
||||
EnvironmentOpts,
|
||||
FileUtil,
|
||||
Forms,
|
||||
IDECommands,
|
||||
IDEOptionDefs,
|
||||
IDEProcs,
|
||||
InputHistory,
|
||||
KeyMapping,
|
||||
LazarusIDEStrConsts,
|
||||
LCLProc,
|
||||
LResources,
|
||||
MenuIntf,
|
||||
IDEProcs, IDEOptionDefs, DialogProcs, IDECommands, EnvironmentOpts,
|
||||
LazarusIDEStrConsts, KeyMapping;
|
||||
Menus,
|
||||
StdCtrls,
|
||||
SysUtils;
|
||||
|
||||
type
|
||||
{ TMessageLine }
|
||||
|
||||
TMessageLine = class
|
||||
private
|
||||
FDirectory: string;
|
||||
@ -59,21 +73,17 @@ type
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property Msg: string read FMsg write SetMsg;
|
||||
property Directory: string read FDirectory write SetDirectory;
|
||||
property Position: integer read FPosition;
|
||||
property VisiblePosition: integer read FVisiblePosition;
|
||||
property OriginalIndex: integer read FOriginalIndex;
|
||||
property Parts: TStrings read FParts write FParts;
|
||||
property Msg: string Read FMsg Write SetMsg;
|
||||
property Directory: string Read FDirectory Write SetDirectory;
|
||||
property Position: integer Read FPosition;
|
||||
property VisiblePosition: integer Read FVisiblePosition;
|
||||
property OriginalIndex: integer Read FOriginalIndex;
|
||||
property Parts: TStrings Read FParts Write FParts;
|
||||
end;
|
||||
|
||||
|
||||
{ TMessagesView }
|
||||
|
||||
TOnFilterLine = procedure(MsgLine: TMessageLine; var Show: boolean) of object;
|
||||
|
||||
{ TMessagesView }
|
||||
|
||||
TMessagesView = class(TForm)
|
||||
MessageView: TListBox;
|
||||
MainPopupMenu: TPopupMenu;
|
||||
@ -81,8 +91,8 @@ type
|
||||
procedure CopyMenuItemClick(Sender: TObject);
|
||||
procedure HelpMenuItemClick(Sender: TObject);
|
||||
procedure MessageViewDblClicked(Sender: TObject);
|
||||
Procedure MessageViewClicked(sender : TObject);
|
||||
procedure MessagesViewKeyDown(Sender: TObject; var Key: Word;
|
||||
procedure MessageViewClicked(Sender: TObject);
|
||||
procedure MessagesViewKeyDown(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState);
|
||||
procedure SaveAllToFileMenuItemClick(Sender: TObject);
|
||||
private
|
||||
@ -92,21 +102,21 @@ type
|
||||
FOnSelectionChanged: TNotifyEvent;
|
||||
function GetDirectory: string;
|
||||
function GetItems(Index: integer): TMessageLine;
|
||||
Function GetMessage: String;
|
||||
function GetMessage: string;
|
||||
function GetVisibleItems(Index: integer): TMessageLine;
|
||||
procedure SetLastLineIsProgress(const AValue: boolean);
|
||||
protected
|
||||
fBlockCount: integer;
|
||||
Function GetSelectedLineIndex: Integer;
|
||||
procedure SetSelectedLineIndex(const AValue: Integer);
|
||||
function GetSelectedLineIndex: integer;
|
||||
procedure SetSelectedLineIndex(const AValue: integer);
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure DeleteLine(Index: integer);
|
||||
procedure Add(const Msg, CurDir: String; ProgressLine,
|
||||
VisibleLine: boolean; OriginalIndex: integer);
|
||||
procedure AddMsg(const Msg, CurDir: String; OriginalIndex: integer);
|
||||
procedure AddProgress(const Msg, CurDir: String);
|
||||
procedure Add(const Msg, CurDir: string;
|
||||
ProgressLine, VisibleLine: boolean; OriginalIndex: integer);
|
||||
procedure AddMsg(const Msg, CurDir: string; OriginalIndex: integer);
|
||||
procedure AddProgress(const Msg, CurDir: string);
|
||||
procedure AddSeparator;
|
||||
procedure ClearTillLastSeparator;
|
||||
procedure ShowTopMessage;
|
||||
@ -121,16 +131,16 @@ type
|
||||
procedure FilterLines(Filter: TOnFilterLine);
|
||||
procedure SaveMessagesToFile(const Filename: string);
|
||||
public
|
||||
property LastLineIsProgress: boolean read FLastLineIsProgress
|
||||
write SetLastLineIsProgress;
|
||||
property Message: String read GetMessage;
|
||||
property Directory: string read GetDirectory;
|
||||
property SelectedMessageIndex: Integer read GetSelectedLineIndex // visible index
|
||||
write SetSelectedLineIndex;
|
||||
property OnSelectionChanged: TNotifyEvent read FOnSelectionChanged
|
||||
write FOnSelectionChanged;
|
||||
property Items[Index: integer]: TMessageLine read GetItems;
|
||||
property VisibleItems[Index: integer]: TMessageLine read GetVisibleItems;
|
||||
property LastLineIsProgress: boolean Read FLastLineIsProgress
|
||||
Write SetLastLineIsProgress;
|
||||
property Message: string Read GetMessage;
|
||||
property Directory: string Read GetDirectory;
|
||||
property SelectedMessageIndex: integer Read GetSelectedLineIndex // visible index
|
||||
Write SetSelectedLineIndex;
|
||||
property OnSelectionChanged: TNotifyEvent
|
||||
Read FOnSelectionChanged Write FOnSelectionChanged;
|
||||
property Items[Index: integer]: TMessageLine Read GetItems;
|
||||
property VisibleItems[Index: integer]: TMessageLine Read GetVisibleItems;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -147,11 +157,12 @@ procedure RegisterStandardMessagesViewMenuItems;
|
||||
|
||||
implementation
|
||||
|
||||
const SeparatorLine = '---------------------------------------------';
|
||||
const
|
||||
SeparatorLine = '---------------------------------------------';
|
||||
|
||||
procedure RegisterStandardMessagesViewMenuItems;
|
||||
var
|
||||
Path: String;
|
||||
Path: string;
|
||||
begin
|
||||
MessagesMenuRoot := RegisterIDEMenuRoot(MessagesMenuRootName);
|
||||
Path := MessagesMenuRoot.Name;
|
||||
@ -161,32 +172,22 @@ begin
|
||||
lisCopyAllMessagesToClipboard);
|
||||
MsgHelpIDEMenuCommand := RegisterIDEMenuCommand(Path, 'Help',
|
||||
srVK_HELP);
|
||||
MsgSaveAllToFileIDEMenuCommand:=RegisterIDEMenuCommand(Path,'Copy selected',
|
||||
MsgSaveAllToFileIDEMenuCommand :=
|
||||
RegisterIDEMenuCommand(Path, 'Copy selected',
|
||||
lisSaveAllMessagesToFile);
|
||||
end;
|
||||
|
||||
{ TMessagesView }
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TMessagesView.Create
|
||||
------------------------------------------------------------------------------}
|
||||
constructor TMessagesView.Create(TheOwner: TComponent);
|
||||
Begin
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
Name := NonModalIDEWindowNames[nmiwMessagesViewName];
|
||||
FItems := TList.Create;
|
||||
FVisibleItems := TList.Create;
|
||||
|
||||
Caption := lisMenuViewMessages;
|
||||
MessageView := TListBox.Create(Self);
|
||||
With MessageView do Begin
|
||||
Parent:= Self;
|
||||
Align:= alClient;
|
||||
end;
|
||||
|
||||
MainPopupMenu:=TPopupMenu.Create(Self);
|
||||
MessageView.PopupMenu:=MainPopupMenu;
|
||||
|
||||
// assign the root TMenuItem to the registered menu root.
|
||||
// This will automatically create all registered items
|
||||
@ -199,8 +200,6 @@ Begin
|
||||
MsgSaveAllToFileIDEMenuCommand.OnClick := @SaveAllToFileMenuItemClick;
|
||||
|
||||
EnvironmentOptions.IDEWindowLayoutList.Apply(Self, Name);
|
||||
KeyPreview:=true;
|
||||
OnKeyDown:=@MessagesViewKeyDown;
|
||||
end;
|
||||
|
||||
destructor TMessagesView.Destroy;
|
||||
@ -214,35 +213,37 @@ end;
|
||||
procedure TMessagesView.DeleteLine(Index: integer);
|
||||
var
|
||||
Line: TMessageLine;
|
||||
VisibleIndex: Integer;
|
||||
i: Integer;
|
||||
VisibleIndex: integer;
|
||||
i: integer;
|
||||
begin
|
||||
Line := Items[Index];
|
||||
FItems.Delete(Line.Position);
|
||||
VisibleIndex := Line.VisiblePosition;
|
||||
if VisibleIndex>=0 then begin
|
||||
if VisibleIndex >= 0 then
|
||||
begin
|
||||
MessageView.Items.Delete(VisibleIndex);
|
||||
FVisibleItems.Delete(VisibleIndex);
|
||||
end;
|
||||
Line.Free;
|
||||
// adjust Positions
|
||||
for i:=Index to FItems.Count-1 do begin
|
||||
for i := Index to FItems.Count - 1 do
|
||||
begin
|
||||
Line := Items[i];
|
||||
dec(Line.FPosition);
|
||||
Dec(Line.FPosition);
|
||||
if Line.VisiblePosition > VisibleIndex then
|
||||
dec(Line.FVisiblePosition);
|
||||
Dec(Line.FVisiblePosition);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
TMessagesView.Add
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TMessagesView.Add(const Msg, CurDir: String; ProgressLine,
|
||||
VisibleLine: boolean; OriginalIndex: integer);
|
||||
procedure TMessagesView.Add(const Msg, CurDir: string;
|
||||
ProgressLine, VisibleLine: boolean; OriginalIndex: integer);
|
||||
var
|
||||
NewMsg: TMessageLine;
|
||||
i: Integer;
|
||||
Begin
|
||||
i: integer;
|
||||
begin
|
||||
NewMsg := TMessageLine.Create;
|
||||
NewMsg.Msg := Msg;
|
||||
NewMsg.Directory := CurDir;
|
||||
@ -250,17 +251,19 @@ Begin
|
||||
NewMsg.FOriginalIndex := OriginalIndex;
|
||||
FItems.Add(NewMsg);
|
||||
|
||||
if VisibleLine then begin
|
||||
if FLastLineIsProgress then begin
|
||||
if VisibleLine then
|
||||
begin
|
||||
if FLastLineIsProgress then
|
||||
begin
|
||||
// replace old progress line
|
||||
i := FVisibleItems.Count - 1;
|
||||
VisibleItems[i].FVisiblePosition := -1;
|
||||
FVisibleItems.Delete(i);
|
||||
MessageView.Items[i] := Msg;
|
||||
end else begin
|
||||
// add line
|
||||
MessageView.Items.Add(Msg);
|
||||
end;
|
||||
end
|
||||
else
|
||||
MessageView.Items.Add(Msg)// add line
|
||||
;
|
||||
NewMsg.FVisiblePosition := FVisibleItems.Count;
|
||||
FVisibleItems.Add(NewMsg);
|
||||
FLastLineIsProgress := ProgressLine;
|
||||
@ -268,34 +271,34 @@ Begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.AddMsg(const Msg, CurDir: String;
|
||||
OriginalIndex: integer);
|
||||
procedure TMessagesView.AddMsg(const Msg, CurDir: string; OriginalIndex: integer);
|
||||
begin
|
||||
Add(Msg,CurDir,false,true,OriginalIndex);
|
||||
Add(Msg, CurDir, False, True, OriginalIndex);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.AddProgress(const Msg, CurDir: String);
|
||||
procedure TMessagesView.AddProgress(const Msg, CurDir: string);
|
||||
begin
|
||||
Add(Msg,CurDir,true,true,-1);
|
||||
Add(Msg, CurDir, True, True, -1);
|
||||
end;
|
||||
|
||||
Procedure TMessagesView.AddSeparator;
|
||||
procedure TMessagesView.AddSeparator;
|
||||
begin
|
||||
Add(SeparatorLine,'',false,true,-1);
|
||||
Add(SeparatorLine, '', False, True, -1);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.ClearTillLastSeparator;
|
||||
var LastSeparator: integer;
|
||||
var
|
||||
LastSeparator: integer;
|
||||
begin
|
||||
BeginBlock;
|
||||
LastSeparator := VisibleItemCount - 1;
|
||||
while (LastSeparator>=0)
|
||||
and (VisibleItems[LastSeparator].Msg<>SeparatorLine) do
|
||||
dec(LastSeparator);
|
||||
if LastSeparator>=0 then begin
|
||||
while (LastSeparator >= 0) and (VisibleItems[LastSeparator].Msg <> SeparatorLine) do
|
||||
Dec(LastSeparator);
|
||||
if LastSeparator >= 0 then
|
||||
begin
|
||||
while (VisibleItemCount > LastSeparator) do
|
||||
DeleteLine(ItemCount - 1);
|
||||
FLastLineIsProgress:=false;
|
||||
FLastLineIsProgress := False;
|
||||
end;
|
||||
EndBlock;
|
||||
end;
|
||||
@ -314,28 +317,32 @@ end;
|
||||
procedure TMessagesView.FilterLines(Filter: TOnFilterLine);
|
||||
// recalculate visible lines
|
||||
var
|
||||
i: Integer;
|
||||
i: integer;
|
||||
Line: TMessageLine;
|
||||
ShowLine: Boolean;
|
||||
ShowLine: boolean;
|
||||
begin
|
||||
// remove temporary lines
|
||||
ClearTillLastSeparator;
|
||||
FLastLineIsProgress:=false;
|
||||
FLastLineIsProgress := False;
|
||||
// recalculate visible lines
|
||||
FVisibleItems.Clear;
|
||||
for i:=0 to FItems.Count-1 do begin
|
||||
for i := 0 to FItems.Count - 1 do
|
||||
begin
|
||||
Line := Items[i];
|
||||
ShowLine:=true;
|
||||
ShowLine := True;
|
||||
Filter(Line, ShowLine);
|
||||
if ShowLine then begin
|
||||
if ShowLine then
|
||||
begin
|
||||
Line.FVisiblePosition := FVisibleItems.Count;
|
||||
FVisibleItems.Add(Line);
|
||||
end else
|
||||
end
|
||||
else
|
||||
Line.FVisiblePosition := -1;
|
||||
end;
|
||||
// rebuild MessageView.Items
|
||||
MessageView.Items.BeginUpdate;
|
||||
for i:=0 to FVisibleItems.Count-1 do begin
|
||||
for i := 0 to FVisibleItems.Count - 1 do
|
||||
begin
|
||||
Line := VisibleItems[i];
|
||||
if MessageView.Items.Count > i then
|
||||
MessageView.Items[i] := Line.Msg
|
||||
@ -355,10 +362,11 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
TMessagesView.Clear
|
||||
------------------------------------------------------------------------------}
|
||||
Procedure TMessagesView.Clear;
|
||||
Begin
|
||||
if fBlockCount>0 then exit;
|
||||
FLastLineIsProgress:=false;
|
||||
procedure TMessagesView.Clear;
|
||||
begin
|
||||
if fBlockCount > 0 then
|
||||
exit;
|
||||
FLastLineIsProgress := False;
|
||||
ClearItems;
|
||||
if not Assigned(MessageView.OnClick) then
|
||||
MessageView.OnClick := @MessageViewClicked;
|
||||
@ -385,20 +393,22 @@ end;
|
||||
procedure TMessagesView.BeginBlock;
|
||||
begin
|
||||
Clear;
|
||||
inc(fBlockCount);
|
||||
Inc(fBlockCount);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.EndBlock;
|
||||
begin
|
||||
if fBlockCount<=0 then RaiseException('TMessagesView.EndBlock Internal Error');
|
||||
dec(fBlockCount);
|
||||
if fBlockCount <= 0 then
|
||||
RaiseException('TMessagesView.EndBlock Internal Error');
|
||||
Dec(fBlockCount);
|
||||
end;
|
||||
|
||||
procedure TMessagesView.ClearItems;
|
||||
var
|
||||
i: Integer;
|
||||
i: integer;
|
||||
begin
|
||||
for i:=0 to FItems.Count-1 do TObject(FItems[i]).Free;
|
||||
for i := 0 to FItems.Count - 1 do
|
||||
TObject(FItems[i]).Free;
|
||||
FItems.Clear;
|
||||
FVisibleItems.Clear;
|
||||
MessageView.Clear;
|
||||
@ -417,8 +427,8 @@ end;
|
||||
{------------------------------------------------------------------------------
|
||||
TMessagesView.GetMessage
|
||||
------------------------------------------------------------------------------}
|
||||
Function TMessagesView.GetMessage: String;
|
||||
Begin
|
||||
function TMessagesView.GetMessage: string;
|
||||
begin
|
||||
Result := '';
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then
|
||||
Result := MessageView.Items.Strings[GetSelectedLineIndex];
|
||||
@ -431,12 +441,12 @@ end;
|
||||
|
||||
procedure TMessagesView.MessageViewDblClicked(Sender: TObject);
|
||||
begin
|
||||
if not EnvironmentOptions.MsgViewDblClickJumps then exit;
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then Begin
|
||||
If Assigned(OnSelectionChanged) then
|
||||
if not EnvironmentOptions.MsgViewDblClickJumps then
|
||||
exit;
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then
|
||||
if Assigned(OnSelectionChanged) then
|
||||
OnSelectionChanged(self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.CopyAllMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
@ -445,7 +455,8 @@ end;
|
||||
|
||||
procedure TMessagesView.CopyMenuItemClick(Sender: TObject);
|
||||
begin
|
||||
if MessageView.ItemIndex<0 then exit;
|
||||
if MessageView.ItemIndex < 0 then
|
||||
exit;
|
||||
Clipboard.AsText := MessageView.GetSelectedText;
|
||||
end;
|
||||
|
||||
@ -454,16 +465,16 @@ begin
|
||||
ExecuteIDECommand(Self, ecContextHelp);
|
||||
end;
|
||||
|
||||
Procedure TMessagesView.MessageViewClicked(sender : TObject);
|
||||
procedure TMessagesView.MessageViewClicked(Sender: TObject);
|
||||
begin
|
||||
if EnvironmentOptions.MsgViewDblClickJumps then exit;
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then Begin
|
||||
If Assigned(OnSelectionChanged) then
|
||||
if EnvironmentOptions.MsgViewDblClickJumps then
|
||||
exit;
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then
|
||||
if Assigned(OnSelectionChanged) then
|
||||
OnSelectionChanged(self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: Word;
|
||||
procedure TMessagesView.MessagesViewKeyDown(Sender: TObject; var Key: word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
//debugln('TMessagesView.MessagesViewKeyDown ',dbgs(Key));
|
||||
@ -480,7 +491,8 @@ begin
|
||||
InputHistories.ApplyFileDialogSettings(SaveDialog);
|
||||
SaveDialog.Title := 'Save messages to file (*.txt)';
|
||||
SaveDialog.Options := SaveDialog.Options + [ofPathMustExist];
|
||||
if SaveDialog.Execute then begin
|
||||
if SaveDialog.Execute then
|
||||
begin
|
||||
AFilename := CleanAndExpandFilename(SaveDialog.Filename);
|
||||
if ExtractFileExt(AFilename) = '' then
|
||||
AFilename := AFilename + '.txt';
|
||||
@ -494,7 +506,7 @@ end;
|
||||
|
||||
function TMessagesView.GetDirectory: string;
|
||||
var
|
||||
i: Integer;
|
||||
i: integer;
|
||||
begin
|
||||
Result := '';
|
||||
i := GetSelectedLineIndex;
|
||||
@ -507,32 +519,30 @@ begin
|
||||
Result := TMessageLine(FItems[Index]);
|
||||
end;
|
||||
|
||||
Function TMessagesView.GetSelectedLineIndex : Integer;
|
||||
function TMessagesView.GetSelectedLineIndex: integer;
|
||||
var
|
||||
I : Integer;
|
||||
Begin
|
||||
I: integer;
|
||||
begin
|
||||
Result := -1;
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then Begin
|
||||
if (MessageView.Items.Count > 0) and (MessageView.SelCount > 0) then
|
||||
for i := 0 to MessageView.Items.Count - 1 do
|
||||
Begin
|
||||
if MessageView.Selected[I] then
|
||||
Begin
|
||||
begin
|
||||
Result := I;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.SetLastLineIsProgress(const AValue: boolean);
|
||||
begin
|
||||
if FLastLineIsProgress=AValue then exit;
|
||||
if FLastLineIsProgress = AValue then
|
||||
exit;
|
||||
if FLastLineIsProgress then
|
||||
MessageView.Items.Delete(MessageView.Items.Count - 1);
|
||||
FLastLineIsProgress := AValue;
|
||||
end;
|
||||
|
||||
procedure TMessagesView.SetSelectedLineIndex(const AValue: Integer);
|
||||
procedure TMessagesView.SetSelectedLineIndex(const AValue: integer);
|
||||
begin
|
||||
MessageView.ItemIndex := AValue;
|
||||
MessageView.TopIndex := MessageView.ItemIndex;
|
||||
@ -542,13 +552,15 @@ end;
|
||||
|
||||
procedure TMessageLine.SetDirectory(const AValue: string);
|
||||
begin
|
||||
if FDirectory=AValue then exit;
|
||||
if FDirectory = AValue then
|
||||
exit;
|
||||
FDirectory := AValue;
|
||||
end;
|
||||
|
||||
procedure TMessageLine.SetMsg(const AValue: string);
|
||||
begin
|
||||
if FMsg=AValue then exit;
|
||||
if FMsg = AValue then
|
||||
exit;
|
||||
FMsg := AValue;
|
||||
end;
|
||||
|
||||
@ -566,6 +578,6 @@ end;
|
||||
|
||||
initialization
|
||||
MessagesView := nil;
|
||||
{$I msgview.lrs}
|
||||
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user