From a3c0c0d43995657e2a67844ca9851822b5fad808 Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 3 Aug 2013 18:39:14 +0000 Subject: [PATCH] IDE: further migration external tools git-svn-id: trunk@42292 - --- .gitattributes | 2 + components/synedit/syneditmarks.pp | 7 +- components/synedit/synguttermarks.pp | 6 +- ide/codehelp.pas | 4 + ide/etmessageframe.pas | 8 +- ide/etmessageswnd.lfm | 24 ++++++ ide/etmessageswnd.pas | 116 +++++++++++++++++++++++++++ ide/etquickfixes.pas | 4 +- ide/etsrceditmarks.pas | 19 ++--- ide/idehelpmanager.pas | 5 +- ide/lazarus.lpi | 12 ++- ide/main.pp | 6 +- ide/mainbase.pas | 5 +- ide/msgview.pp | 4 + ide/sourceeditor.pp | 8 +- ide/sourcefilemanager.pas | 8 +- 16 files changed, 207 insertions(+), 31 deletions(-) create mode 100644 ide/etmessageswnd.lfm create mode 100644 ide/etmessageswnd.pas diff --git a/.gitattributes b/.gitattributes index e36f199925..ec10d4f59d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4958,6 +4958,8 @@ ide/etfpcmsgparser.pas svneol=native#text/plain ide/etmakemsgparser.pas svneol=native#text/plain ide/etmessageframe.lfm svneol=native#text/plain ide/etmessageframe.pas svneol=native#text/plain +ide/etmessageswnd.lfm svneol=native#text/plain +ide/etmessageswnd.pas svneol=native#text/plain ide/etquickfixes.pas svneol=native#text/plain ide/etsrceditmarks.pas svneol=native#text/plain ide/examplemanager.lfm svneol=native#text/plain diff --git a/components/synedit/syneditmarks.pp b/components/synedit/syneditmarks.pp index f36f08fb72..ca57ba4890 100644 --- a/components/synedit/syneditmarks.pp +++ b/components/synedit/syneditmarks.pp @@ -11,7 +11,8 @@ unit SynEditMarks; interface uses - Classes, Controls, SysUtils, math, SynEditMiscClasses, LazSynEditText, LCLProc; + Classes, Controls, SysUtils, math, SynEditMiscClasses, LazSynEditText, + LCLProc, ImgList; type @@ -49,7 +50,7 @@ type TSynEditMark = class private - FImageList: TImageList; + FImageList: TCustomImageList; FMarkLine: TSynEditMarkLine; FMarkList: TSynEditMarkList; FLine: Integer; // Only valid, if not part of a TSynEditMarkLine @@ -103,7 +104,7 @@ type property ImageIndex: integer read FImage write SetImage; // ImageList: If assigned, then use instead of "BookMarkOpt.BookmarkImages" // Must have same width as "BookMarkOpt.BookmarkImages" - property ImageList: TImageList read FImageList write FImageList; + property ImageList: TCustomImageList read FImageList write FImageList; end; { TSynEditMarkLine } diff --git a/components/synedit/synguttermarks.pp b/components/synedit/synguttermarks.pp index 12d02b15ad..10c9bb9c19 100644 --- a/components/synedit/synguttermarks.pp +++ b/components/synedit/synguttermarks.pp @@ -5,8 +5,8 @@ unit SynGutterMarks; interface uses - Classes, SysUtils, Graphics, LCLType, LCLIntf, LCLProc, Controls, math, - SynGutterBase, SynEditMiscClasses, SynEditMarks; + Classes, SysUtils, Graphics, LCLType, LCLIntf, LCLProc, Controls, ImgList, + math, SynGutterBase, SynEditMiscClasses, SynEditMarks; type @@ -77,7 +77,7 @@ var procedure DoPaintMark(CurMark: TSynEditMark; aRect: TRect); var - img: TImageList; + img: TCustomImageList; begin if CurMark.InternalImage or ( (not assigned(FBookMarkOpt.BookmarkImages)) and diff --git a/ide/codehelp.pas b/ide/codehelp.pas index 0991bf8b8f..4068f11dbf 100644 --- a/ide/codehelp.pas +++ b/ide/codehelp.pas @@ -1410,8 +1410,12 @@ begin if ADocFile.DocErrorMsg<>'' then begin if not (chofQuiet in Flags) then begin // for example: Filename(y,x) Error: description + {$IFDEF EnableNewExtTools} + IDEMessagesWindow.addcu + {$ELSE} IDEMessagesWindow.AddMsg(ADocFile.DocErrorMsg, ExtractFilePath(ADocFile.CodeBuffer.Filename),-1); + {$ENDIF} end; // no update needed exit(chprFailed); diff --git a/ide/etmessageframe.pas b/ide/etmessageframe.pas index be6109a5f7..00cc19cc48 100644 --- a/ide/etmessageframe.pas +++ b/ide/etmessageframe.pas @@ -2475,7 +2475,7 @@ function TMessagesCtrl.GetHeaderText(View: TLMsgWndView): string; //debugln(['GetStats cat=',dbgs(c),' count=',Lines.UrgencyCounts[c]]); if c>=mluError then inc(ErrCnt,Lines.UrgencyCounts[c]) - else if c=mluWarn then + else if c=mluWarning then inc(WarnCnt,Lines.UrgencyCounts[c]) else if c in [mluHint,mluNote] then inc(HintCnt,Lines.UrgencyCounts[c]); @@ -2971,7 +2971,7 @@ begin MinUrgency:=MessagesCtrl.ActiveFilter.MinUrgency; HideWarningsMenuItem.Checked:=MinUrgency in [mluError..mluPanic]; - HideNotesMenuItem.Checked:=MinUrgency in [mluWarn,mluImportant]; + HideNotesMenuItem.Checked:=MinUrgency in [mluWarning,mluImportant]; HideHintsMenuItem.Checked:=MinUrgency=mluNote; HideVerboseMenuItem.Checked:=MinUrgency=mluHint; HideDebugMenuItem.Checked:=MinUrgency in [mluProgress..mluVerbose]; @@ -3147,7 +3147,7 @@ begin if Sender=HideWarningsMenuItem then MinUrgency:=mluError else if Sender=HideNotesMenuItem then - MinUrgency:=mluWarn + MinUrgency:=mluWarning else if Sender=HideHintsMenuItem then MinUrgency:=mluNote else if Sender=HideVerboseMenuItem then @@ -3391,7 +3391,7 @@ begin UrgencyStyles[mluVerbose].SetValues('Ausfuerhlich',5,clDefault); UrgencyStyles[mluHint].SetValues('Hinweis',4,clDefault); UrgencyStyles[mluNote].SetValues('Note',3,clDefault); - UrgencyStyles[mluWarn].SetValues('Warnung',2,clDefault); + UrgencyStyles[mluWarning].SetValues('Warnung',2,clDefault); UrgencyStyles[mluImportant].SetValues('Sonstiges',4,clDefault); UrgencyStyles[mluError].SetValues('Fehler',1,clDefault); UrgencyStyles[mluFatal].SetValues('Fatal',0,clDefault); diff --git a/ide/etmessageswnd.lfm b/ide/etmessageswnd.lfm new file mode 100644 index 0000000000..5dd5600c24 --- /dev/null +++ b/ide/etmessageswnd.lfm @@ -0,0 +1,24 @@ +object MessagesView: TMessagesView + Left = 213 + Height = 128 + Top = 586 + Width = 639 + Caption = 'MessagesView' + ClientHeight = 128 + ClientWidth = 639 + OnCreate = FormCreate + OnDestroy = FormDestroy + LCLVersion = '1.1' + inline MessagesFrame1: TMessagesFrame + Height = 128 + Width = 639 + Align = alClient + ClientHeight = 128 + ClientWidth = 639 + inherited SearchPanel: TPanel + Top = 101 + Width = 639 + ClientWidth = 639 + end + end +end diff --git a/ide/etmessageswnd.pas b/ide/etmessageswnd.pas new file mode 100644 index 0000000000..fc9e332258 --- /dev/null +++ b/ide/etmessageswnd.pas @@ -0,0 +1,116 @@ +{ + *************************************************************************** + * * + * This source is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This code is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * General Public License for more details. * + * * + * A copy of the GNU General Public License is available on the World * + * Wide Web at . You can also * + * obtain it by writing to the Free Software Foundation, * + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * * + *************************************************************************** + + Author: Mattias Gaertner + + Abstract: + Window for (compiler) messages. +} +unit etMessagesWnd; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, FileUtil, IDEMsgIntf, IDEImagesIntf, IDEExternToolIntf, + Forms, Controls, Graphics, Dialogs, etMessageFrame, etSrcEditMarks; + +type + + { TMessagesView } + + TMessagesView = class(TIDEMessagesWindowInterface) + MessagesFrame1: TMessagesFrame; + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + function OnOpenMessage(Sender: TObject; Msg: TMessageLine): boolean; + private + ImgIDNone: integer; + ImgIDInformation: integer; + ImgIDHint: integer; + ImgIDNote: integer; + ImgIDWarning: integer; + ImgIDError: integer; + ImgIDFatal: integer; + public + SourceMarks: TETMarks; + end; + +var + MessagesView: TMessagesView; + +const + MessagesMenuRootName = 'Messages'; + +procedure RegisterStandardMessagesViewMenuItems; + +implementation + +procedure RegisterStandardMessagesViewMenuItems; +begin + +end; + +{$R *.lfm} + +{ TMessagesView } + +procedure TMessagesView.FormCreate(Sender: TObject); +begin + IDEMessagesWindow:=Self; + + SourceMarks:=TETMarks.Create(Self); + with SourceMarks do begin + ImageList:=IDEImages.Images_12; + //OnGetSynEditOfFile:=@SourceMarksGetSynEditOfFile; + MarkStyles[mluNone].ImageIndex:=-1; + MarkStyles[mluProgress].ImageIndex:=-1; + MarkStyles[mluDebug].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_information'); + MarkStyles[mluVerbose3].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_information'); + MarkStyles[mluVerbose2].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_information'); + MarkStyles[mluVerbose].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_information'); + MarkStyles[mluHint].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_hint'); + MarkStyles[mluNote].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_note'); + MarkStyles[mluWarning].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_warning'); + MarkStyles[mluImportant].ImageIndex:=-1; + MarkStyles[mluError].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_error'); + MarkStyles[mluFatal].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_fatal'); + MarkStyles[mluPanic].ImageIndex:=IDEImages.LoadImage(12, 'state12x12_fatal'); + end; + MessagesFrame1.MessagesCtrl.SourceMarks:=SourceMarks; + MessagesFrame1.MessagesCtrl.OnOpenMessage:=@OnOpenMessage; + + ActiveControl:=MessagesFrame1.MessagesCtrl; +end; + +procedure TMessagesView.FormDestroy(Sender: TObject); +begin + IDEMessagesWindow:=nil; +end; + +function TMessagesView.OnOpenMessage(Sender: TObject; Msg: TMessageLine + ): boolean; +begin + +end; + +end. + diff --git a/ide/etquickfixes.pas b/ide/etquickfixes.pas index bd973ce96d..ec9185e458 100644 --- a/ide/etquickfixes.pas +++ b/ide/etquickfixes.pas @@ -30,8 +30,8 @@ unit etQuickFixes; interface uses - Classes, SysUtils, IDEExternToolIntf, Menus, CodeToolManager, CodeCache, - LazLogger, AvgLvlTree, LazFileUtils; + Classes, SysUtils, IDEExternToolIntf, IDEMsgIntf, Menus, CodeToolManager, + CodeCache, LazLogger, AvgLvlTree, LazFileUtils; type diff --git a/ide/etsrceditmarks.pas b/ide/etsrceditmarks.pas index 80df30edb4..bf3490e96d 100644 --- a/ide/etsrceditmarks.pas +++ b/ide/etsrceditmarks.pas @@ -32,7 +32,7 @@ interface uses Classes, SysUtils, math, SynGutterLineOverview, SynEditMarkupGutterMark, SynEditMarks, SynEditMiscClasses, SynEditTypes, SynEdit, LazSynEditText, - LazLogger, LazFileUtils, AvgLvlTree, Graphics, Controls, Forms, + LazLogger, LazFileUtils, AvgLvlTree, Graphics, Controls, Forms, ImgList, IDEExternToolIntf; type @@ -86,7 +86,7 @@ type TETMarks = class(TComponent) private - FImageList: TImageList; + FImageList: TCustomImageList; fMarkStyles: array[TMessageLineUrgency] of TETMarkStyle; FOnGetSynEditOfFile: TOnGetSynEditOfFile; FPriority: integer; @@ -96,7 +96,7 @@ type destructor Destroy; override; function CreateMark(MsgLine: TMessageLine; aSynEdit: TSynEdit = nil): TETMark; procedure RemoveMarks(aSynEdit: TSynEdit); - property ImageList: TImageList read FImageList write FImageList; // must have same Width/Height as the TSynEdits bookmarkimages + property ImageList: TCustomImageList read FImageList write FImageList; // must have same Width/Height as the TSynEdits bookmarkimages property OnGetSynEditOfFile: TOnGetSynEditOfFile read FOnGetSynEditOfFile write FOnGetSynEditOfFile; property MarkStyles[Urgency: TMessageLineUrgency]: TETMarkStyle read GetMarkStyles; property Priority: integer read FPriority write FPriority; @@ -128,7 +128,7 @@ type function AsString: string; end; - { TETSrcChanges } + { TETSrcChanges - edits of single file} TETSrcChanges = class private @@ -155,7 +155,7 @@ type procedure WriteDebugReport(Title: string); end; - { TETMultiSrcChanges } + { TETMultiSrcChanges - edits of all files } TETMultiSrcChanges = class private @@ -727,7 +727,7 @@ end; function TETSrcChanges.Add(Action: TETSrcChangeAction; FromPosY, FromPosX, ToPosY, ToPosX: integer): TETSrcChange; - procedure RaiseFromBehindFrom; + procedure RaiseFromBehindToPos; begin raise Exception.CreateFmt('TETSrcChanges.Add FromPos=%s,%s behind ToPos=%s,%s',[FromPosY,FromPosX,ToPosY,ToPosX]); end; @@ -783,7 +783,7 @@ begin // consistency check if IsCaretInFront(ToPosY,ToPosX,FromPosY,FromPosX) then - RaiseFromBehindFrom; + RaiseFromBehindToPos; Result:=TETSrcChange.Create(Action, FromPosY, FromPosX, ToPosY, ToPosX); @@ -922,7 +922,8 @@ begin end else if aLineBrkCnt<0 then begin // delete line breaks / empty lines FChanges.Add(etscaDelete,aLinePos,aBytePos,aLinePos-aLineBrkCnt,1); - end; + end else + exit; SyncQueued:=true; end; @@ -967,7 +968,7 @@ begin fMarkStyles[u]:=TETMarkStyle.Create(u,clNone); fMarkStyles[mluHint].Color:=clGreen; fMarkStyles[mluNote].Color:=clGreen; - fMarkStyles[mluWarn].Color:=clYellow; + fMarkStyles[mluWarning].Color:=clYellow; fMarkStyles[mluError].Color:=clRed; fMarkStyles[mluFatal].Color:=clRed; fMarkStyles[mluPanic].Color:=clRed; diff --git a/ide/idehelpmanager.pas b/ide/idehelpmanager.pas index cf3e7678d2..9b35513df3 100644 --- a/ide/idehelpmanager.pas +++ b/ide/idehelpmanager.pas @@ -45,10 +45,11 @@ uses IDEMsgIntf, PackageIntf, LazIDEIntf, HelpIntfs, IDEHelpIntf, // IDE LazarusIDEStrConsts, TransferMacros, DialogProcs, IDEOptionDefs, - ObjInspExt, EnvironmentOpts, AboutFrm, MsgView, Project, MainBar, + ObjInspExt, EnvironmentOpts, AboutFrm, Project, MainBar, {$IFDEF EnableNewExtTools} + etMessagesWnd, {$ELSE} - OutputFilter, + OutputFilter, MsgView, {$ENDIF} IDEFPDocFileSearch, PackageDefs, PackageSystem, HelpOptions, MainIntf, LazConf, HelpFPCMessages, CodeHelp, diff --git a/ide/lazarus.lpi b/ide/lazarus.lpi index 9f3d37c149..59adacc2cc 100644 --- a/ide/lazarus.lpi +++ b/ide/lazarus.lpi @@ -66,7 +66,7 @@ - + @@ -797,7 +797,9 @@ + + @@ -810,6 +812,14 @@ + + + + + + + + diff --git a/ide/main.pp b/ide/main.pp index 02f0fb2dd8..bcf57f1c1b 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -107,9 +107,9 @@ uses CodeToolsDefines, DiffDialog, DiskDiffsDialog, UnitInfoDlg, EditorOptions, SourceEditProcs, ViewUnit_dlg, FPDocEditWindow, {$IFDEF EnableNewExtTools} - etQuickFixes, + etQuickFixes, etMessagesWnd, {$ELSE} - OutputFilter, MsgQuickFixes, + OutputFilter, MsgQuickFixes, MsgView, {$ENDIF} // converter ChgEncodingDlg, ConvertDelphi, ConvCodeTool, MissingPropertiesDlg, LazXMLForms, @@ -143,7 +143,7 @@ uses package_usage_options, package_description_options, package_integration_options, package_provides_options, package_i18n_options, // rest of the ide - Splash, IDEDefs, LazarusIDEStrConsts, LazConf, MsgView, SearchResultView, + Splash, IDEDefs, LazarusIDEStrConsts, LazConf, SearchResultView, CodeTemplatesDlg, CodeBrowser, FindUnitDlg, InspectChksumChangedDlg, IdeOptionsDlg, EditDefineTree, PublishModule, EnvironmentOpts, TransferMacros, KeyMapping, IDETranslations, IDEProcs, ExtToolDialog, ExtToolEditDlg, diff --git a/ide/mainbase.pas b/ide/mainbase.pas index a9c7903b96..92c34b33bc 100644 --- a/ide/mainbase.pas +++ b/ide/mainbase.pas @@ -65,10 +65,11 @@ uses LazConf, LazarusIDEStrConsts, ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler, ComponentReg, {$IFDEF EnableNewExtTools} + etMessagesWnd, {$ELSE} - OutputFilter, + OutputFilter, MsgView, {$ENDIF} - TransferMacros, ObjectInspector, PropEdits, IDEDefs, MsgView, + TransferMacros, ObjectInspector, PropEdits, IDEDefs, EnvironmentOpts, EditorOptions, CompilerOptions, KeyMapping, IDEProcs, Debugger, IDEOptionDefs, CodeToolsDefines, Splash, Designer, SourceEditor, BuildManager, FindInFilesDlg, diff --git a/ide/msgview.pp b/ide/msgview.pp index e82bd5fb12..84f4aad8cd 100644 --- a/ide/msgview.pp +++ b/ide/msgview.pp @@ -32,6 +32,10 @@ } unit MsgView; +{$IFDEF EnableNewExtTools} + {$Error obsolete} +{$ENDIF} + {$mode objfpc}{$H+} interface diff --git a/ide/sourceeditor.pp b/ide/sourceeditor.pp index c911b76903..5b55104a78 100644 --- a/ide/sourceeditor.pp +++ b/ide/sourceeditor.pp @@ -63,7 +63,13 @@ uses IDEDialogs, LazarusIDEStrConsts, IDECommands, EditorOptions, EnvironmentOpts, WordCompletion, FindReplaceDialog, IDEProcs, IDEOptionDefs, IDEHelpManager, MacroPromptDlg, TransferMacros, CodeContextForm, - SrcEditHintFrm, MsgView, InputHistory, + SrcEditHintFrm, + {$IFDEF EnableNewExtTools} + etMessagesWnd, + {$ELSE} + MsgView, + {$ENDIF} + InputHistory, CodeMacroPrompt, CodeTemplatesDlg, CodeToolsOptions, SortSelectionDlg, EncloseSelectionDlg, ConDef, InvertAssignTool, SourceEditProcs, SourceMarks, CharacterMapDlg, SearchFrm, diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas index b0004f7d10..d9c90333ac 100644 --- a/ide/sourcefilemanager.pas +++ b/ide/sourcefilemanager.pas @@ -41,7 +41,13 @@ uses SourceEditor, EditorOptions, CustomFormEditor, FormEditor, EmptyMethodsDlg, BaseDebugManager, ControlSelection, TransferMacros, EnvironmentOpts, BuildManager, Designer, EditorMacroListViewer, KeywordFuncLists, - FindRenameIdentifier, MsgView, InputHistory, CheckLFMDlg, LCLMemManager, + FindRenameIdentifier, + {$IFDEF EnableNewExtTools} + etMessagesWnd, + {$ELSE} + MsgView, + {$ENDIF} + InputHistory, CheckLFMDlg, LCLMemManager, CodeToolManager, CodeToolsStructs, ConvCodeTool, CodeCache, CodeTree, FindDeclarationTool, BasicCodeTools, SynEdit, UnitResources;