mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 14:29:07 +02:00
added package prettymessages - an IDE add-on to reduce FPC hints
git-svn-id: trunk@11002 -
This commit is contained in:
parent
06e9d893e8
commit
029d4f6327
9
.gitattributes
vendored
9
.gitattributes
vendored
@ -333,6 +333,14 @@ components/prettyformat/pfidesource.pas svneol=native#text/plain
|
|||||||
components/prettyformat/prettyformat.lpk svneol=native#text/plain
|
components/prettyformat/prettyformat.lpk svneol=native#text/plain
|
||||||
components/prettyformat/prettyformat.pas svneol=native#text/plain
|
components/prettyformat/prettyformat.pas svneol=native#text/plain
|
||||||
components/prettyformat/ptopu.pp svneol=native#text/plain
|
components/prettyformat/ptopu.pp svneol=native#text/plain
|
||||||
|
components/prettymessages/README.txt svneol=native#text/plain
|
||||||
|
components/prettymessages/hidefpchints.pas svneol=native#text/plain
|
||||||
|
components/prettymessages/prettymessages.lpk svneol=native#text/plain
|
||||||
|
components/prettymessages/prettymessages.pas svneol=native#text/plain
|
||||||
|
components/prettymessages/prettymsgoptions.pas svneol=native#text/plain
|
||||||
|
components/prettymessages/prettymsgoptionsdlg.lfm svneol=native#text/plain
|
||||||
|
components/prettymessages/prettymsgoptionsdlg.lrs svneol=native#text/plain
|
||||||
|
components/prettymessages/prettymsgoptionsdlg.pas svneol=native#text/plain
|
||||||
components/printers/Makefile svneol=native#text/plain
|
components/printers/Makefile svneol=native#text/plain
|
||||||
components/printers/Makefile.fpc svneol=native#text/plain
|
components/printers/Makefile.fpc svneol=native#text/plain
|
||||||
components/printers/design/Makefile svneol=native#text/plain
|
components/printers/design/Makefile svneol=native#text/plain
|
||||||
@ -2843,6 +2851,7 @@ packager/globallinks/lazopenglcontext-0.lpl svneol=native#text/plain
|
|||||||
packager/globallinks/macosfiles-0.lpl svneol=native#text/plain
|
packager/globallinks/macosfiles-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/popupnotifierlaz-0.lpl svneol=native#text/plain
|
packager/globallinks/popupnotifierlaz-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/prettyformat-0.lpl svneol=native#text/plain
|
packager/globallinks/prettyformat-0.lpl svneol=native#text/plain
|
||||||
|
packager/globallinks/prettymessages-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/printer4lazarus-0.5.lpl svneol=native#text/plain
|
packager/globallinks/printer4lazarus-0.5.lpl svneol=native#text/plain
|
||||||
packager/globallinks/printers4lazide-0.lpl svneol=native#text/plain
|
packager/globallinks/printers4lazide-0.lpl svneol=native#text/plain
|
||||||
packager/globallinks/projtemplates-0.lpl svneol=native#text/plain
|
packager/globallinks/projtemplates-0.lpl svneol=native#text/plain
|
||||||
|
@ -54,7 +54,7 @@ function FindNextIncludeDirective(const ASource: string;
|
|||||||
out FilenameStartPos, FileNameEndPos,
|
out FilenameStartPos, FileNameEndPos,
|
||||||
CommentStartPos, CommentEndPos: integer): integer;
|
CommentStartPos, CommentEndPos: integer): integer;
|
||||||
function FindNextIDEDirective(const ASource: string; StartPos: integer;
|
function FindNextIDEDirective(const ASource: string; StartPos: integer;
|
||||||
NestedComments: boolean): integer;
|
NestedComments: boolean; EndPos: integer = 0): integer;
|
||||||
function CleanCodeFromComments(const DirtyCode: string;
|
function CleanCodeFromComments(const DirtyCode: string;
|
||||||
NestedComments: boolean): string;
|
NestedComments: boolean): string;
|
||||||
function FindMainUnitHint(const ASource: string; var Filename: string): boolean;
|
function FindMainUnitHint(const ASource: string; var Filename: string): boolean;
|
||||||
@ -2400,11 +2400,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function FindNextIDEDirective(const ASource: string; StartPos: integer;
|
function FindNextIDEDirective(const ASource: string; StartPos: integer;
|
||||||
NestedComments: boolean): integer;
|
NestedComments: boolean; EndPos: integer): integer;
|
||||||
var
|
var
|
||||||
MaxPos: integer;
|
MaxPos: integer;
|
||||||
begin
|
begin
|
||||||
MaxPos:=length(ASource);
|
MaxPos:=length(ASource);
|
||||||
|
if (EndPos>0) and (EndPos<=MaxPos) then
|
||||||
|
MaxPos:=EndPos-1;
|
||||||
Result:=StartPos;
|
Result:=StartPos;
|
||||||
while (Result<=MaxPos) do begin
|
while (Result<=MaxPos) do begin
|
||||||
case ASource[Result] of
|
case ASource[Result] of
|
||||||
@ -2453,7 +2455,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
if Result>MaxPos+1 then Result:=MaxPos+1;
|
Result:=-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function CleanCodeFromComments(const DirtyCode: string;
|
function CleanCodeFromComments(const DirtyCode: string;
|
||||||
|
@ -111,7 +111,7 @@ type
|
|||||||
Data: Pointer;
|
Data: Pointer;
|
||||||
function LineCount: integer;
|
function LineCount: integer;
|
||||||
function GetLine(Index: integer): string;
|
function GetLine(Index: integer): string;
|
||||||
procedure GetLineRange(Index: integer; var LineRange: TLineRange);
|
procedure GetLineRange(Index: integer; out LineRange: TLineRange);
|
||||||
property Items[Index: integer]: TSourceLogEntry
|
property Items[Index: integer]: TSourceLogEntry
|
||||||
read GetItems write SetItems; default;
|
read GetItems write SetItems; default;
|
||||||
function Count: integer; // # Items
|
function Count: integer; // # Items
|
||||||
@ -286,7 +286,7 @@ begin
|
|||||||
Result:='';
|
Result:='';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSourceLog.GetLineRange(Index: integer; var LineRange: TLineRange);
|
procedure TSourceLog.GetLineRange(Index: integer; out LineRange: TLineRange);
|
||||||
begin
|
begin
|
||||||
BuildLineRanges;
|
BuildLineRanges;
|
||||||
LineRange:=FLineRanges[Index];
|
LineRange:=FLineRanges[Index];
|
||||||
|
@ -3396,7 +3396,7 @@ begin
|
|||||||
EndPos:=1;
|
EndPos:=1;
|
||||||
repeat
|
repeat
|
||||||
StartPos:=FindNextIDEDirective(Src,EndPos,Scanner.NestedComments);
|
StartPos:=FindNextIDEDirective(Src,EndPos,Scanner.NestedComments);
|
||||||
if StartPos>SrcLen then break;
|
if StartPos<1 then break;
|
||||||
EndPos:=FindCommentEnd(Src,StartPos,Scanner.NestedComments);
|
EndPos:=FindCommentEnd(Src,StartPos,Scanner.NestedComments);
|
||||||
DirectiveList.Add(copy(Src,StartPos,EndPos-StartPos));
|
DirectiveList.Add(copy(Src,StartPos,EndPos-StartPos));
|
||||||
if EndPos>SrcLen then break;
|
if EndPos>SrcLen then break;
|
||||||
@ -3421,7 +3421,7 @@ begin
|
|||||||
|
|
||||||
// find first old IDE directive
|
// find first old IDE directive
|
||||||
InsertPos:=FindNextIDEDirective(Src,1,Scanner.NestedComments);
|
InsertPos:=FindNextIDEDirective(Src,1,Scanner.NestedComments);
|
||||||
if InsertPos>SrcLen then InsertPos:=0;
|
if InsertPos<1 then InsertPos:=0;
|
||||||
|
|
||||||
// remove all old IDE directives
|
// remove all old IDE directives
|
||||||
if InsertPos>=1 then
|
if InsertPos>=1 then
|
||||||
@ -3431,7 +3431,7 @@ begin
|
|||||||
repeat
|
repeat
|
||||||
// find next IDE directive
|
// find next IDE directive
|
||||||
StartPos:=FindNextIDEDirective(Src,EndPos,Scanner.NestedComments);
|
StartPos:=FindNextIDEDirective(Src,EndPos,Scanner.NestedComments);
|
||||||
if StartPos>SrcLen then break;
|
if StartPos<1 then break;
|
||||||
EndPos:=FindCommentEnd(Src,StartPos,Scanner.NestedComments);
|
EndPos:=FindCommentEnd(Src,StartPos,Scanner.NestedComments);
|
||||||
// remove also space in front of directive
|
// remove also space in front of directive
|
||||||
while (StartPos>1) and (Src[StartPos-1] in [' ',#9]) do dec(StartPos);
|
while (StartPos>1) and (Src[StartPos-1] in [' ',#9]) do dec(StartPos);
|
||||||
|
@ -66,7 +66,6 @@ var
|
|||||||
begin
|
begin
|
||||||
if (not AWinControl.HandleAllocated) then exit;
|
if (not AWinControl.HandleAllocated) then exit;
|
||||||
Widget:=PGtkWidget(AWinControl.Handle);
|
Widget:=PGtkWidget(AWinControl.Handle);
|
||||||
if not GTK_WIDGET_MAPPED(Widget) then exit;
|
|
||||||
Info:=PLOpenGLInfo(gtk_object_get_data(PGtkObject(Widget),'LOpenGLInfo'));
|
Info:=PLOpenGLInfo(gtk_object_get_data(PGtkObject(Widget),'LOpenGLInfo'));
|
||||||
|
|
||||||
DebugLn(['InternalResizeWnd ',dbgs(AWinControl.BoundsRect)]);
|
DebugLn(['InternalResizeWnd ',dbgs(AWinControl.BoundsRect)]);
|
||||||
|
@ -25,7 +25,7 @@ uses
|
|||||||
Classes, SysUtils, LCLProc, LCLType, X, XUtil, XLib, gl, InterfaceBase,
|
Classes, SysUtils, LCLProc, LCLType, X, XUtil, XLib, gl, InterfaceBase,
|
||||||
WSLCLClasses, GtkWSControls,
|
WSLCLClasses, GtkWSControls,
|
||||||
{$IFDEF LCLGTK2}
|
{$IFDEF LCLGTK2}
|
||||||
gdk2x, glib2, gdk2, gtk2, Gtk2Int,
|
GtkDef, gdk2x, glib2, gdk2, gtk2, Gtk2Int,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF LCLGTK}
|
{$IFDEF LCLGTK}
|
||||||
glib, gdk, gtk, GtkInt,
|
glib, gdk, gtk, GtkInt,
|
||||||
@ -74,9 +74,9 @@ type
|
|||||||
function gdk_gl_query: boolean;
|
function gdk_gl_query: boolean;
|
||||||
function gdk_gl_choose_visual(attrlist: Plongint): PGdkVisual;
|
function gdk_gl_choose_visual(attrlist: Plongint): PGdkVisual;
|
||||||
function gdk_gl_get_config(visual: PGdkVisual; attrib: longint):longint;
|
function gdk_gl_get_config(visual: PGdkVisual; attrib: longint):longint;
|
||||||
function gdk_gl_context_new(visual: PGdkVisual): PGdkGLContext;
|
function gdk_gl_context_new(visual: PGdkVisual; attrlist: PlongInt): PGdkGLContext;
|
||||||
function gdk_gl_context_share_new(visual: PGdkVisual; sharelist: PGdkGLContext;
|
function gdk_gl_context_share_new(visual: PGdkVisual; sharelist: PGdkGLContext;
|
||||||
direct: Integer): PGdkGLContext;
|
direct: Integer; attrlist: plongint): PGdkGLContext;
|
||||||
function gdk_gl_context_attrlist_share_new(attrlist: Plongint;
|
function gdk_gl_context_attrlist_share_new(attrlist: Plongint;
|
||||||
sharelist: PGdkGLContext; direct: Integer): PGdkGLContext;
|
sharelist: PGdkGLContext; direct: Integer): PGdkGLContext;
|
||||||
function gdk_gl_context_ref(context: PGdkGLContext): PGdkGLContext;
|
function gdk_gl_context_ref(context: PGdkGLContext): PGdkGLContext;
|
||||||
@ -274,6 +274,7 @@ begin
|
|||||||
DebugLn('get_xvisualinfo dpy=',XDisplayAsString(dpy));
|
DebugLn('get_xvisualinfo dpy=',XDisplayAsString(dpy));
|
||||||
|
|
||||||
DebugLn('get_xvisualinfo visual=',GdkVisualAsString(Visual));
|
DebugLn('get_xvisualinfo visual=',GdkVisualAsString(Visual));
|
||||||
|
RaiseGDBException('not implemented for gtk2');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// 'GLX uses VisualInfo records because they uniquely identify
|
// 'GLX uses VisualInfo records because they uniquely identify
|
||||||
@ -341,6 +342,11 @@ var
|
|||||||
vi: PXVisualInfo;
|
vi: PXVisualInfo;
|
||||||
visual: PGdkVisual;
|
visual: PGdkVisual;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF lclgtk2}
|
||||||
|
DebugLn(['gdk_gl_choose_visual not implemented yet for gtk2']);
|
||||||
|
RaiseGDBException('');
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
//writeln('gdk_gl_choose_visual A ');
|
//writeln('gdk_gl_choose_visual A ');
|
||||||
if attrList=nil then begin
|
if attrList=nil then begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
@ -381,13 +387,13 @@ begin
|
|||||||
XFree(vi);
|
XFree(vi);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function gdk_gl_context_new(visual: PGdkVisual): PGdkGLContext;
|
function gdk_gl_context_new(visual: PGdkVisual; attrlist: PlongInt): PGdkGLContext;
|
||||||
begin
|
begin
|
||||||
Result:=gdk_gl_context_share_new(visual,nil,0);
|
Result:=gdk_gl_context_share_new(visual,nil,0,attrlist);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function gdk_gl_context_share_new(visual: PGdkVisual; sharelist: PGdkGLContext;
|
function gdk_gl_context_share_new(visual: PGdkVisual; sharelist: PGdkGLContext;
|
||||||
direct: integer): PGdkGLContext;
|
direct: integer; attrlist: plongint): PGdkGLContext;
|
||||||
var
|
var
|
||||||
dpy: PDisplay;
|
dpy: PDisplay;
|
||||||
vi: PXVisualInfo;
|
vi: PXVisualInfo;
|
||||||
@ -396,18 +402,25 @@ var
|
|||||||
glxcontext: TGLXContext;
|
glxcontext: TGLXContext;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
if visual=nil then exit;
|
|
||||||
|
|
||||||
vi := get_xvisualinfo(visual);
|
|
||||||
|
|
||||||
dpy := GetDefaultXDisplay;
|
dpy := GetDefaultXDisplay;
|
||||||
|
|
||||||
|
{$IFDEF lclgtk2}
|
||||||
|
DebugLn(['gdk_gl_context_share_new AAA1']);
|
||||||
|
vi:=glXChooseVisual(dpy, DefaultScreen(dpy), @attrList[0]);
|
||||||
|
DebugLn(['gdk_gl_context_share_new AAA2']);
|
||||||
|
{$ELSE}
|
||||||
|
if visual=nil then exit;
|
||||||
|
vi := get_xvisualinfo(visual);
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
PrivateShareList:=PGdkGLContextPrivate(sharelist);
|
PrivateShareList:=PGdkGLContextPrivate(sharelist);
|
||||||
if (sharelist<>nil) then
|
if (sharelist<>nil) then
|
||||||
glxcontext := glXCreateContext(dpy, vi, PrivateShareList^.glxcontext,
|
glxcontext := glXCreateContext(dpy, vi, PrivateShareList^.glxcontext,
|
||||||
direct=1)
|
direct=1)
|
||||||
else
|
else
|
||||||
glxcontext := glXCreateContext(dpy, vi, nil, direct=1);
|
glxcontext := glXCreateContext(dpy, vi, nil, direct=1);
|
||||||
|
DebugLn(['gdk_gl_context_share_new AAA3']);
|
||||||
|
|
||||||
XFree(vi);
|
XFree(vi);
|
||||||
if (glxcontext = nil) then exit;
|
if (glxcontext = nil) then exit;
|
||||||
@ -425,11 +438,16 @@ function gdk_gl_context_attrlist_share_new(attrlist: Plongint;
|
|||||||
var
|
var
|
||||||
visual: PGdkVisual;
|
visual: PGdkVisual;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF lclgtk2}
|
||||||
|
visual :=nil;
|
||||||
|
Result:=gdk_gl_context_share_new(visual, sharelist, direct,attrlist);
|
||||||
|
{$ELSE}
|
||||||
visual := gdk_gl_choose_visual(attrlist);
|
visual := gdk_gl_choose_visual(attrlist);
|
||||||
if (visual<>nil) then
|
if (visual<>nil) then
|
||||||
Result:=gdk_gl_context_share_new(visual, sharelist, direct)
|
Result:=gdk_gl_context_share_new(visual, sharelist, direct,attrlist)
|
||||||
else
|
else
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function gdk_gl_context_ref(context: PGdkGLContext): PGdkGLContext;
|
function gdk_gl_context_ref(context: PGdkGLContext): PGdkGLContext;
|
||||||
@ -513,10 +531,13 @@ procedure gtk_gl_area_init(
|
|||||||
); cdecl;
|
); cdecl;
|
||||||
begin
|
begin
|
||||||
if theClass=nil then ;
|
if theClass=nil then ;
|
||||||
|
DebugLn(['gtk_gl_area_init START']);
|
||||||
PGtkGLArea(gl_area)^.glcontext:=nil;
|
PGtkGLArea(gl_area)^.glcontext:=nil;
|
||||||
{$IFDEF Gtk2}
|
{$IFDEF LclGtk2}
|
||||||
gtk_widget_set_double_buffered(PGtkWidget(gl_area),gdkFALSE);
|
gtk_widget_set_double_buffered(PGtkWidget(gl_area),gdkFALSE);
|
||||||
|
GTK_WIDGET_UNSET_FLAGS(PGtkWidget(gl_area),GTK_NO_WINDOW);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
DebugLn(['gtk_gl_area_init END']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GTK_TYPE_GL_AREA: TGtkType;
|
function GTK_TYPE_GL_AREA: TGtkType;
|
||||||
@ -600,36 +621,48 @@ var
|
|||||||
gl_area: PGtkGLArea;
|
gl_area: PGtkGLArea;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
|
DebugLn(['gtk_gl_area_share_new START']);
|
||||||
//writeln('gtk_gl_area_share_new A ');
|
//writeln('gtk_gl_area_share_new A ');
|
||||||
if (share<>nil) and (not GTK_IS_GL_AREA(share)) then
|
if (share<>nil) and (not GTK_IS_GL_AREA(share)) then
|
||||||
exit;
|
exit;
|
||||||
{$IFNDEF MSWindows}
|
{$IFNDEF MSWindows}
|
||||||
//writeln('gtk_gl_area_share_new B ');
|
//writeln('gtk_gl_area_share_new B ');
|
||||||
|
{$IFDEF lclgtk2}
|
||||||
|
visual := nil;
|
||||||
|
{$ELSE}
|
||||||
visual := gdk_gl_choose_visual(attrlist);
|
visual := gdk_gl_choose_visual(attrlist);
|
||||||
if (visual = nil) then exit;
|
if (visual = nil) then exit;
|
||||||
|
{$ENDIF}
|
||||||
{$ENDIF non MSWindows}
|
{$ENDIF non MSWindows}
|
||||||
|
|
||||||
//writeln('gtk_gl_area_share_new C ');
|
//writeln('gtk_gl_area_share_new C ');
|
||||||
|
DebugLn(['gtk_gl_area_share_new BBB1']);
|
||||||
sharelist := nil;
|
sharelist := nil;
|
||||||
if share<>nil then sharelist:=share^.glcontext;
|
if share<>nil then sharelist:=share^.glcontext;
|
||||||
glcontext := gdk_gl_context_share_new(visual, sharelist, 1);
|
glcontext := gdk_gl_context_share_new(visual, sharelist, 1, attrlist);
|
||||||
if (glcontext = nil) then exit;
|
if (glcontext = nil) then exit;
|
||||||
|
DebugLn(['gtk_gl_area_share_new BBB2']);
|
||||||
//writeln('gtk_gl_area_share_new D ');
|
//writeln('gtk_gl_area_share_new D ');
|
||||||
|
|
||||||
{$IFNDEF MSWindows}
|
{$IFNDEF MSWindows}
|
||||||
|
if visual<>nil then begin
|
||||||
// use colormap and visual suitable for OpenGL rendering
|
// use colormap and visual suitable for OpenGL rendering
|
||||||
gtk_widget_push_colormap(gdk_colormap_new(visual,gtk_TRUE));
|
gtk_widget_push_colormap(gdk_colormap_new(visual,gtk_TRUE));
|
||||||
gtk_widget_push_visual(visual);
|
gtk_widget_push_visual(visual);
|
||||||
|
end;
|
||||||
{$ENDIF non MSWindows}
|
{$ENDIF non MSWindows}
|
||||||
|
|
||||||
gl_area := gtk_type_new (gtk_gl_area_get_type);
|
gl_area := gtk_type_new (gtk_gl_area_get_type);
|
||||||
gl_area^.glcontext := glcontext;
|
gl_area^.glcontext := glcontext;
|
||||||
//writeln('gtk_gl_area_share_new E ',gl_area<>nil);
|
//writeln('gtk_gl_area_share_new E ',gl_area<>nil);
|
||||||
|
DebugLn(['gtk_gl_area_share_new BBB3']);
|
||||||
|
|
||||||
{$IFNDEF MSWindows}
|
{$IFNDEF MSWindows}
|
||||||
|
if visual<>nil then begin
|
||||||
// pop back defaults
|
// pop back defaults
|
||||||
gtk_widget_pop_visual;
|
gtk_widget_pop_visual;
|
||||||
gtk_widget_pop_colormap;
|
gtk_widget_pop_colormap;
|
||||||
|
end;
|
||||||
{$ENDIF non MSWindows}
|
{$ENDIF non MSWindows}
|
||||||
Result:=PGtkWidget(gl_area);
|
Result:=PGtkWidget(gl_area);
|
||||||
end;
|
end;
|
||||||
@ -641,7 +674,9 @@ begin
|
|||||||
if not GTK_IS_GL_AREA(glarea) then exit;
|
if not GTK_IS_GL_AREA(glarea) then exit;
|
||||||
if not GTK_WIDGET_REALIZED(PGtkWidget(glarea)) then exit;
|
if not GTK_WIDGET_REALIZED(PGtkWidget(glarea)) then exit;
|
||||||
|
|
||||||
|
DebugLn(['gtk_gl_area_make_current START']);
|
||||||
Result:=gdk_gl_make_current(PGtkWidget(glarea)^.window, glarea^.glcontext);
|
Result:=gdk_gl_make_current(PGtkWidget(glarea)^.window, glarea^.glcontext);
|
||||||
|
DebugLn(['gtk_gl_area_make_current END']);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function gtk_gl_area_begingl(glarea: PGtkGLArea): boolean;
|
function gtk_gl_area_begingl(glarea: PGtkGLArea): boolean;
|
||||||
|
@ -53,7 +53,7 @@ uses
|
|||||||
GLGtkGlxContext;
|
GLGtkGlxContext;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF UseGtk2GLX}
|
{$IFDEF UseGtk2GLX}
|
||||||
GLGtk2GlxContext;
|
GLGtkGlxContext;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF UseCarbonAGL}
|
{$IFDEF UseCarbonAGL}
|
||||||
GLCarbonAGLContext;
|
GLCarbonAGLContext;
|
||||||
|
7
components/prettymessages/README.txt
Normal file
7
components/prettymessages/README.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
prettymessages
|
||||||
|
==============
|
||||||
|
|
||||||
|
This package is an Lazarus IDE add on, which helps to reduce FPC hints, notes
|
||||||
|
and warnings. If you want to hide a specific hint, click right on a message
|
||||||
|
and in the popup menu click on Hide FPC hint.
|
||||||
|
|
203
components/prettymessages/hidefpchints.pas
Normal file
203
components/prettymessages/hidefpchints.pas
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
{ Extends Lazarus to hide FPC messages.
|
||||||
|
For example:
|
||||||
|
testunit1.pas(20,27) Hint: Parameter "X" not used
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (C) 2007 Mattias Gaertner mattias@freepascal.org
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version with the following modification:
|
||||||
|
|
||||||
|
As a special exception, the copyright holders of this library give you
|
||||||
|
permission to link this library with independent modules to produce an
|
||||||
|
executable, regardless of the license terms of these independent modules,and
|
||||||
|
to copy and distribute the resulting executable under terms of your choice,
|
||||||
|
provided that you also meet, for each linked independent module, the terms
|
||||||
|
and conditions of the license of that module. An independent module is a
|
||||||
|
module which is not derived from or based on this library. If you modify
|
||||||
|
this library, you may extend this exception to your version of the library,
|
||||||
|
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
exception statement from your version.
|
||||||
|
|
||||||
|
This program 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 Library General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
}
|
||||||
|
unit HideFPCHints;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, LCLProc, Controls,
|
||||||
|
// IDEIntf
|
||||||
|
IDEMsgIntf, LazIDEIntf, SrcEditorIntf,
|
||||||
|
// CodeTools
|
||||||
|
BasicCodeTools, SourceLog, CodeCache, CodeToolManager,
|
||||||
|
// our stuff
|
||||||
|
PrettyMsgOptions;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ THideFPCHintWorker }
|
||||||
|
|
||||||
|
THideFPCHintWorker = class(TIDEMsgQuickFixItem)
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure Execute(const Msg: TIDEMessageLine; Step: TIMQuickFixStep); override;
|
||||||
|
function IsApplicable(Line: TIDEMessageLine): boolean; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure QuickFixHideFPCHint(Sender: TObject; Step: TIMQuickFixStep;
|
||||||
|
Msg: TIDEMessageLine);
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure QuickFixHideFPCHint(Sender: TObject; Step: TIMQuickFixStep;
|
||||||
|
Msg: TIDEMessageLine);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
var
|
||||||
|
Item: TIDEMsgQuickFixItem;
|
||||||
|
begin
|
||||||
|
Item:=THideFPCHintWorker.Create;
|
||||||
|
RegisterIDEMsgQuickFix(Item);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ THideFPCHintWorker }
|
||||||
|
|
||||||
|
constructor THideFPCHintWorker.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
Name:='Hide FPC hints';
|
||||||
|
Caption:='Hide this FPC hint';
|
||||||
|
Steps:=[imqfoImproveMessage,imqfoMenuItem];
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor THideFPCHintWorker.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure THideFPCHintWorker.Execute(const Msg: TIDEMessageLine;
|
||||||
|
Step: TIMQuickFixStep);
|
||||||
|
var
|
||||||
|
Filename: string;
|
||||||
|
Line: integer;
|
||||||
|
Column: integer;
|
||||||
|
CodeBuf: TCodeBuffer;
|
||||||
|
LineRange: TLineRange;
|
||||||
|
DirectivePos: LongInt;
|
||||||
|
Src: String;
|
||||||
|
EndPos: LongInt;
|
||||||
|
p: LongInt;
|
||||||
|
MsgType: string;
|
||||||
|
Directive: String;
|
||||||
|
SrcEdit: TSourceEditorInterface;
|
||||||
|
InsertPos: Integer;
|
||||||
|
HasDirective: Boolean;
|
||||||
|
begin
|
||||||
|
inherited Execute(Msg, Step);
|
||||||
|
|
||||||
|
// get filename and line number and load file
|
||||||
|
if Msg.Parts=nil then exit;
|
||||||
|
if Msg.Parts.Values['Stage']<>'FPC' then exit;
|
||||||
|
MsgType:=Msg.Parts.Values['Type'];
|
||||||
|
if MsgType='Hint' then
|
||||||
|
Directive:='h-'
|
||||||
|
else if MsgType='Note' then
|
||||||
|
Directive:='n-'
|
||||||
|
else if MsgType='Warning' then
|
||||||
|
Directive:='w-'
|
||||||
|
else
|
||||||
|
exit;
|
||||||
|
|
||||||
|
Msg.GetSourcePosition(Filename,Line,Column);
|
||||||
|
//DebugLn(['THideFPCHintWorker.Execute ',Filename,' Line=',Line]);
|
||||||
|
CodeBuf:=CodeToolBoss.LoadFile(Filename,false,false);
|
||||||
|
if CodeBuf=nil then exit;
|
||||||
|
if (Line<1) or (Line>CodeBuf.LineCount) then exit;
|
||||||
|
Src:=CodeBuf.Source;
|
||||||
|
CodeBuf.GetLineRange(Line-1,LineRange);
|
||||||
|
|
||||||
|
// check if the code contains an IDE directive to hide the hint
|
||||||
|
HasDirective:=false;
|
||||||
|
p:=LineRange.StartPos;
|
||||||
|
EndPos:=LineRange.EndPos;
|
||||||
|
repeat
|
||||||
|
DirectivePos:=FindNextIDEDirective(Src,p,true,EndPos);
|
||||||
|
if (DirectivePos<1) then break;
|
||||||
|
if CompareSubStrings(Directive,Src,1,DirectivePos+2,2,false)=0 then begin
|
||||||
|
//DebugLn(['THideFPCHintWorker.Execute Ignoring message: ',Msg.Msg]);
|
||||||
|
HasDirective:=true;
|
||||||
|
end;
|
||||||
|
p:=DirectivePos;
|
||||||
|
while (p<EndPos) and (Src[p]<>'}') do inc(p);
|
||||||
|
until p>=EndPos;
|
||||||
|
|
||||||
|
if Step=imqfoMenuItem then begin
|
||||||
|
// user clicked on the menu item to add an IDE directive
|
||||||
|
if HasDirective then exit;
|
||||||
|
|
||||||
|
// open the file in the source editor
|
||||||
|
if LazarusIDE.DoOpenFileAndJumpToPos(Filename,Point(1,Line),-1,-1,
|
||||||
|
[ofOnlyIfExists,ofRegularFile,ofUseCache,ofDoNotLoadResource])<>mrOk then
|
||||||
|
begin
|
||||||
|
DebugLn(['THideFPCHintWorker.Execute open failed: ',Filename]);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
// find the source editor page
|
||||||
|
SrcEdit:=SourceEditorWindow.SourceEditorIntfWithFilename(Filename);
|
||||||
|
if SrcEdit=nil then begin
|
||||||
|
DebugLn(['THideFPCHintWorker.Execute unable to find the file in the source editor of ',Filename]);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
// find the source editor line
|
||||||
|
if SrcEdit.LineCount<Line then begin
|
||||||
|
DebugLn(['THideFPCHintWorker.Execute unable to find the line ',Line,' of ',Filename]);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// add at end of line
|
||||||
|
InsertPos:=length(SrcEdit.Lines[Line-1])+1;
|
||||||
|
SrcEdit.ReplaceText(Point(InsertPos,Line),Point(InsertPos,Line),'{%'+Directive+'}');
|
||||||
|
|
||||||
|
end else if Step=imqfoImproveMessage then begin
|
||||||
|
// the parser found the message -> hide the message
|
||||||
|
if HasDirective then
|
||||||
|
Msg.Visible:=false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function THideFPCHintWorker.IsApplicable(Line: TIDEMessageLine): boolean;
|
||||||
|
var
|
||||||
|
MsgType: string;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if Line.Parts=nil then exit;
|
||||||
|
if Line.Parts.Values['Stage']<>'FPC' then exit;
|
||||||
|
MsgType:=Line.Parts.Values['Type'];
|
||||||
|
if MsgType='Hint' then
|
||||||
|
Result:=true
|
||||||
|
else if MsgType='Note' then
|
||||||
|
Result:=true
|
||||||
|
else if MsgType='Warning' then
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
56
components/prettymessages/prettymessages.lpk
Normal file
56
components/prettymessages/prettymessages.lpk
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<CONFIG>
|
||||||
|
<Package Version="2">
|
||||||
|
<Name Value="PrettyMessages"/>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="5"/>
|
||||||
|
<SearchPaths>
|
||||||
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<CodeGeneration>
|
||||||
|
<Generate Value="Faster"/>
|
||||||
|
</CodeGeneration>
|
||||||
|
<Other>
|
||||||
|
<CompilerPath Value="$(CompPath)"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Files Count="3">
|
||||||
|
<Item1>
|
||||||
|
<Filename Value="hidefpchints.pas"/>
|
||||||
|
<HasRegisterProc Value="True"/>
|
||||||
|
<UnitName Value="HideFPCHints"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<Filename Value="prettymsgoptionsdlg.pas"/>
|
||||||
|
<UnitName Value="PrettyMsgOptionsDlg"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<Filename Value="prettymsgoptions.pas"/>
|
||||||
|
<UnitName Value="prettymsgoptions"/>
|
||||||
|
</Item3>
|
||||||
|
</Files>
|
||||||
|
<Type Value="RunAndDesignTime"/>
|
||||||
|
<RequiredPkgs Count="4">
|
||||||
|
<Item1>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item1>
|
||||||
|
<Item2>
|
||||||
|
<PackageName Value="IDEIntf"/>
|
||||||
|
</Item2>
|
||||||
|
<Item3>
|
||||||
|
<PackageName Value="FCL"/>
|
||||||
|
<MinVersion Major="1" Valid="True"/>
|
||||||
|
</Item3>
|
||||||
|
<Item4>
|
||||||
|
<PackageName Value="CodeTools"/>
|
||||||
|
</Item4>
|
||||||
|
</RequiredPkgs>
|
||||||
|
<UsageOptions>
|
||||||
|
<UnitPath Value="$(PkgOutDir)"/>
|
||||||
|
</UsageOptions>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<IgnoreBinaries Value="False"/>
|
||||||
|
</PublishOptions>
|
||||||
|
</Package>
|
||||||
|
</CONFIG>
|
21
components/prettymessages/prettymessages.pas
Normal file
21
components/prettymessages/prettymessages.pas
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{ This file was automatically created by Lazarus. Do not edit!
|
||||||
|
This source is only used to compile and install the package.
|
||||||
|
}
|
||||||
|
|
||||||
|
unit PrettyMessages;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
HideFPCHints, PrettyMsgOptionsDlg, PrettyMsgOptions, LazarusPackageIntf;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure Register;
|
||||||
|
begin
|
||||||
|
RegisterUnit('HideFPCHints', @HideFPCHints.Register);
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
RegisterPackage('PrettyMessages', @Register);
|
||||||
|
end.
|
49
components/prettymessages/prettymsgoptions.pas
Normal file
49
components/prettymessages/prettymsgoptions.pas
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{ Options for the pretty message package.
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (C) 2007 Mattias Gaertner mattias@freepascal.org
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version with the following modification:
|
||||||
|
|
||||||
|
As a special exception, the copyright holders of this library give you
|
||||||
|
permission to link this library with independent modules to produce an
|
||||||
|
executable, regardless of the license terms of these independent modules,and
|
||||||
|
to copy and distribute the resulting executable under terms of your choice,
|
||||||
|
provided that you also meet, for each linked independent module, the terms
|
||||||
|
and conditions of the license of that module. An independent module is a
|
||||||
|
module which is not derived from or based on this library. If you modify
|
||||||
|
this library, you may extend this exception to your version of the library,
|
||||||
|
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
exception statement from your version.
|
||||||
|
|
||||||
|
This program 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 Library General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
}
|
||||||
|
unit PrettyMsgOptions;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
TPrettyMsgOptions = class
|
||||||
|
public
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
30
components/prettymessages/prettymsgoptionsdlg.lfm
Normal file
30
components/prettymessages/prettymsgoptionsdlg.lfm
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
object PrettyMsgOptionsDialog: TPrettyMsgOptionsDialog
|
||||||
|
Left = 294
|
||||||
|
Height = 300
|
||||||
|
Top = 164
|
||||||
|
Width = 400
|
||||||
|
HorzScrollBar.Page = 399
|
||||||
|
VertScrollBar.Page = 299
|
||||||
|
Caption = 'PrettyMsgOptionsDialog'
|
||||||
|
OnCreate = FormCreate
|
||||||
|
Position = poScreenCenter
|
||||||
|
object OkButton: TButton
|
||||||
|
Left = 192
|
||||||
|
Height = 25
|
||||||
|
Top = 264
|
||||||
|
Width = 75
|
||||||
|
BorderSpacing.InnerBorder = 4
|
||||||
|
Caption = 'OkButton'
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object CancelButton: TButton
|
||||||
|
Left = 288
|
||||||
|
Height = 25
|
||||||
|
Top = 264
|
||||||
|
Width = 75
|
||||||
|
BorderSpacing.InnerBorder = 4
|
||||||
|
Caption = 'CancelButton'
|
||||||
|
ModalResult = 2
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
13
components/prettymessages/prettymsgoptionsdlg.lrs
Normal file
13
components/prettymessages/prettymsgoptionsdlg.lrs
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{ This is an automatically generated lazarus resource file }
|
||||||
|
|
||||||
|
LazarusResources.Add('TPrettyMsgOptionsDialog','FORMDATA',[
|
||||||
|
'TPF0'#23'TPrettyMsgOptionsDialog'#22'PrettyMsgOptionsDialog'#4'Left'#3'&'#1#6
|
||||||
|
+'Height'#3','#1#3'Top'#3#164#0#5'Width'#3#144#1#18'HorzScrollBar.Page'#3#143
|
||||||
|
+#1#18'VertScrollBar.Page'#3'+'#1#7'Caption'#6#22'PrettyMsgOptionsDialog'#8'O'
|
||||||
|
+'nCreate'#7#10'FormCreate'#8'Position'#7#14'poScreenCenter'#0#7'TButton'#8'O'
|
||||||
|
+'kButton'#4'Left'#3#192#0#6'Height'#2#25#3'Top'#3#8#1#5'Width'#2'K'#25'Borde'
|
||||||
|
+'rSpacing.InnerBorder'#2#4#7'Caption'#6#8'OkButton'#8'TabOrder'#2#0#0#0#7'TB'
|
||||||
|
+'utton'#12'CancelButton'#4'Left'#3' '#1#6'Height'#2#25#3'Top'#3#8#1#5'Width'
|
||||||
|
+#2'K'#25'BorderSpacing.InnerBorder'#2#4#7'Caption'#6#12'CancelButton'#11'Mod'
|
||||||
|
+'alResult'#2#2#8'TabOrder'#2#1#0#0#0
|
||||||
|
]);
|
74
components/prettymessages/prettymsgoptionsdlg.pas
Normal file
74
components/prettymessages/prettymsgoptionsdlg.pas
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
{ Extends Lazarus with a dialog to edit the options of the pretty message
|
||||||
|
package.
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (C) 2007 Mattias Gaertner mattias@freepascal.org
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Library General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
option) any later version with the following modification:
|
||||||
|
|
||||||
|
As a special exception, the copyright holders of this library give you
|
||||||
|
permission to link this library with independent modules to produce an
|
||||||
|
executable, regardless of the license terms of these independent modules,and
|
||||||
|
to copy and distribute the resulting executable under terms of your choice,
|
||||||
|
provided that you also meet, for each linked independent module, the terms
|
||||||
|
and conditions of the license of that module. An independent module is a
|
||||||
|
module which is not derived from or based on this library. If you modify
|
||||||
|
this library, you may extend this exception to your version of the library,
|
||||||
|
but you are not obligated to do so. If you do not wish to do so, delete this
|
||||||
|
exception statement from your version.
|
||||||
|
|
||||||
|
This program 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 Library General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public License
|
||||||
|
along with this library; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
}
|
||||||
|
unit PrettyMsgOptionsDlg;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TPrettyMsgOptionsDialog }
|
||||||
|
|
||||||
|
TPrettyMsgOptionsDialog = class(TForm)
|
||||||
|
OkButton: TButton;
|
||||||
|
CancelButton: TButton;
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
{ private declarations }
|
||||||
|
public
|
||||||
|
{ public declarations }
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
PrettyMsgOptionsDialog: TPrettyMsgOptionsDialog;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{ TPrettyMsgOptionsDialog }
|
||||||
|
|
||||||
|
procedure TPrettyMsgOptionsDialog.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Caption:='Options of Pretty Messages';
|
||||||
|
|
||||||
|
OkButton.Caption:='Ok';
|
||||||
|
CancelButton.Caption:='Cancel';
|
||||||
|
end;
|
||||||
|
|
||||||
|
initialization
|
||||||
|
{$I prettymsgoptionsdlg.lrs}
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
@ -133,6 +133,7 @@ type
|
|||||||
FirstLine, LineCount: Integer);
|
FirstLine, LineCount: Integer);
|
||||||
procedure UpdateMsgLineInListBox(Line: TLazMessageLine);
|
procedure UpdateMsgLineInListBox(Line: TLazMessageLine);
|
||||||
function ExecuteMsgLinePlugin(Step: TIMQuickFixStep): boolean;
|
function ExecuteMsgLinePlugin(Step: TIMQuickFixStep): boolean;
|
||||||
|
procedure HideLine(Line: TLazMessageLine);
|
||||||
procedure ConsistencyCheck;
|
procedure ConsistencyCheck;
|
||||||
public
|
public
|
||||||
property LastLineIsProgress: boolean read FLastLineIsProgress
|
property LastLineIsProgress: boolean read FLastLineIsProgress
|
||||||
@ -436,6 +437,7 @@ procedure TMessagesView.CollectLineParts(Sender: TObject;
|
|||||||
QuickFixItem: TIDEMsgQuickFixItem;
|
QuickFixItem: TIDEMsgQuickFixItem;
|
||||||
j: Integer;
|
j: Integer;
|
||||||
OldMsg: String;
|
OldMsg: String;
|
||||||
|
OldVisible: Boolean;
|
||||||
begin
|
begin
|
||||||
for i:=StartIndex to FItems.Count-1 do begin
|
for i:=StartIndex to FItems.Count-1 do begin
|
||||||
ALine:=Items[i];
|
ALine:=Items[i];
|
||||||
@ -444,14 +446,21 @@ procedure TMessagesView.CollectLineParts(Sender: TObject;
|
|||||||
if (imqfoImproveMessage in QuickFixItem.Steps)
|
if (imqfoImproveMessage in QuickFixItem.Steps)
|
||||||
and QuickFixItem.IsApplicable(ALine) then begin
|
and QuickFixItem.IsApplicable(ALine) then begin
|
||||||
OldMsg:=ALine.Msg;
|
OldMsg:=ALine.Msg;
|
||||||
|
OldVisible:=ALine.VisiblePosition>=0;
|
||||||
|
ALine.Visible:=OldVisible;
|
||||||
QuickFixItem.Execute(ALine,imqfoImproveMessage);
|
QuickFixItem.Execute(ALine,imqfoImproveMessage);
|
||||||
UpdateMsgSrcPos(ALine);
|
UpdateMsgSrcPos(ALine);
|
||||||
if OldMsg<>ALine.Msg then
|
if (OldVisible<>ALine.Visible) then begin
|
||||||
|
if not ALine.Visible then
|
||||||
|
HideLine(ALine);
|
||||||
|
end;
|
||||||
|
if (OldMsg<>ALine.Msg) then begin
|
||||||
UpdateMsgLineInListBox(ALine);
|
UpdateMsgLineInListBox(ALine);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -562,9 +571,10 @@ begin
|
|||||||
Line.VisiblePosition := FVisibleItems.Count;
|
Line.VisiblePosition := FVisibleItems.Count;
|
||||||
FVisibleItems.Add(Line);
|
FVisibleItems.Add(Line);
|
||||||
end
|
end
|
||||||
else
|
else begin
|
||||||
Line.VisiblePosition := -1;
|
Line.VisiblePosition := -1;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
// rebuild MessageTreeView.Items
|
// rebuild MessageTreeView.Items
|
||||||
MessageTreeView.BeginUpdate;
|
MessageTreeView.BeginUpdate;
|
||||||
for i := 0 to FVisibleItems.Count - 1 do
|
for i := 0 to FVisibleItems.Count - 1 do
|
||||||
@ -671,6 +681,34 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMessagesView.HideLine(Line: TLazMessageLine);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
OldIndex: LongInt;
|
||||||
|
begin
|
||||||
|
OldIndex:=Line.VisiblePosition;
|
||||||
|
if OldIndex<0 then exit;
|
||||||
|
//DebugLn(['TMessagesView.HideLine ',OldIndex]);
|
||||||
|
if (OldIndex>=0) and (OldIndex<FVisibleItems.Count)
|
||||||
|
then begin
|
||||||
|
// adjust all VisiblePosition
|
||||||
|
for i:=OldIndex+1 to FVisibleItems.Count-1 do begin
|
||||||
|
TLazMessageLine(FVisibleItems[i]).VisiblePosition:=
|
||||||
|
TLazMessageLine(FVisibleItems[i]).VisiblePosition-1;
|
||||||
|
end;
|
||||||
|
FVisibleItems.Delete(OldIndex);
|
||||||
|
Line.VisiblePosition:=-1;
|
||||||
|
end;
|
||||||
|
// remove from FVisibleItems and from LCL control
|
||||||
|
if (OldIndex>=0)
|
||||||
|
and (OldIndex<MessageTreeView.Items.TopLvlCount) then begin
|
||||||
|
MessageTreeView.Items.TopLvlItems[OldIndex].Delete;
|
||||||
|
end;
|
||||||
|
//for i:=0 to MessageTreeView.Items.TopLvlCount-1 do begin
|
||||||
|
// DebugLn(['TMessagesView.HideLine ',i,' ',MessageTreeView.Items.TopLvlItems[i].Text]);
|
||||||
|
//end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TMessagesView.Clear
|
TMessagesView.Clear
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
|
@ -68,6 +68,7 @@ type
|
|||||||
FOriginalIndex: integer;
|
FOriginalIndex: integer;
|
||||||
FParts: TStrings;
|
FParts: TStrings;
|
||||||
FPosition: integer;
|
FPosition: integer;
|
||||||
|
FVisible: boolean;
|
||||||
FVisiblePosition: integer;
|
FVisiblePosition: integer;
|
||||||
procedure SetDirectory(const AValue: string);
|
procedure SetDirectory(const AValue: string);
|
||||||
procedure SetMsg(const AValue: string);
|
procedure SetMsg(const AValue: string);
|
||||||
@ -84,6 +85,7 @@ type
|
|||||||
property VisiblePosition: integer read FVisiblePosition write FVisiblePosition;// filtered position
|
property VisiblePosition: integer read FVisiblePosition write FVisiblePosition;// filtered position
|
||||||
property OriginalIndex: integer read FOriginalIndex write FOriginalIndex;// unsorted, unfiltered position
|
property OriginalIndex: integer read FOriginalIndex write FOriginalIndex;// unsorted, unfiltered position
|
||||||
property Parts: TStrings read FParts write FParts;
|
property Parts: TStrings read FParts write FParts;
|
||||||
|
property Visible: boolean read FVisible write FVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TOnFilterLine = procedure(MsgLine: TIDEMessageLine; var Show: boolean) of object;
|
TOnFilterLine = procedure(MsgLine: TIDEMessageLine; var Show: boolean) of object;
|
||||||
@ -113,9 +115,9 @@ type
|
|||||||
{ TIDEMsgQuickFixItem }
|
{ TIDEMsgQuickFixItem }
|
||||||
|
|
||||||
TIMQuickFixStep = (
|
TIMQuickFixStep = (
|
||||||
imqfoMenuItem, // add menu item in popup menu for this item
|
imqfoMenuItem, // Popup menu opens. Add now the menu item.
|
||||||
imqfoImproveMessage, // rewrites message
|
imqfoImproveMessage,// Message can now be rewritten/beautified.
|
||||||
imqfoJump // user clicks on message
|
imqfoJump // Override what happens, when user clicks on message.
|
||||||
);
|
);
|
||||||
TIMQuickFixSteps = set of TIMQuickFixStep;
|
TIMQuickFixSteps = set of TIMQuickFixStep;
|
||||||
|
|
||||||
|
@ -296,6 +296,7 @@ begin
|
|||||||
BeginUpdate;
|
BeginUpdate;
|
||||||
BeginUndoBlock;
|
BeginUndoBlock;
|
||||||
SelectText(StartPos,EndPos);
|
SelectText(StartPos,EndPos);
|
||||||
|
CursorTextXY:=StartPos;
|
||||||
Selection:=NewText;
|
Selection:=NewText;
|
||||||
EndUndoBlock;
|
EndUndoBlock;
|
||||||
EndUpdate;
|
EndUpdate;
|
||||||
|
@ -302,7 +302,7 @@ type
|
|||||||
TKeyPressEvent = procedure(Sender: TObject; var Key: char) of Object;
|
TKeyPressEvent = procedure(Sender: TObject; var Key: char) of Object;
|
||||||
TUTF8KeyPressEvent = procedure(Sender: TObject; var UTF8Key: TUTF8Char) of Object;
|
TUTF8KeyPressEvent = procedure(Sender: TObject; var UTF8Key: TUTF8Char) of Object;
|
||||||
|
|
||||||
TMouseEvent = Procedure(Sender: TOBject; Button: TMouseButton;
|
TMouseEvent = Procedure(Sender: TObject; Button: TMouseButton;
|
||||||
Shift: TShiftState; X, Y: Integer) of object;
|
Shift: TShiftState; X, Y: Integer) of object;
|
||||||
TMouseMoveEvent = Procedure(Sender: TObject; Shift: TShiftState;
|
TMouseMoveEvent = Procedure(Sender: TObject; Shift: TShiftState;
|
||||||
X, Y: Integer) of object;
|
X, Y: Integer) of object;
|
||||||
|
2
packager/globallinks/prettymessages-0.lpl
Normal file
2
packager/globallinks/prettymessages-0.lpl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
$(LazarusDir)/components/prettymessages/prettymessages.lpk
|
||||||
|
|
@ -129,10 +129,10 @@ type
|
|||||||
ImageList: TImageList;
|
ImageList: TImageList;
|
||||||
FilesPopupMenu: TPopupMenu;
|
FilesPopupMenu: TPopupMenu;
|
||||||
procedure AddBitBtnClick(Sender: TObject);
|
procedure AddBitBtnClick(Sender: TObject);
|
||||||
procedure AddToUsesPkgSectionCheckBoxClick(Sender: TObject);
|
procedure AddToUsesPkgSectionCheckBoxChange(Sender: TObject);
|
||||||
procedure AddToProjectClick(Sender: TObject);
|
procedure AddToProjectClick(Sender: TObject);
|
||||||
procedure ApplyDependencyButtonClick(Sender: TObject);
|
procedure ApplyDependencyButtonClick(Sender: TObject);
|
||||||
procedure CallRegisterProcCheckBoxClick(Sender: TObject);
|
procedure CallRegisterProcCheckBoxChange(Sender: TObject);
|
||||||
procedure ChangeFileTypeMenuItemClick(Sender: TObject);
|
procedure ChangeFileTypeMenuItemClick(Sender: TObject);
|
||||||
procedure CompileAllCleanClick(Sender: TObject);
|
procedure CompileAllCleanClick(Sender: TObject);
|
||||||
procedure CompileBitBtnClick(Sender: TObject);
|
procedure CompileBitBtnClick(Sender: TObject);
|
||||||
@ -171,8 +171,8 @@ type
|
|||||||
procedure SaveBitBtnClick(Sender: TObject);
|
procedure SaveBitBtnClick(Sender: TObject);
|
||||||
procedure SortFilesMenuItemClick(Sender: TObject);
|
procedure SortFilesMenuItemClick(Sender: TObject);
|
||||||
procedure UninstallClick(Sender: TObject);
|
procedure UninstallClick(Sender: TObject);
|
||||||
procedure UseMaxVersionCheckBoxClick(Sender: TObject);
|
procedure UseMaxVersionCheckBoxChange(Sender: TObject);
|
||||||
procedure UseMinVersionCheckBoxClick(Sender: TObject);
|
procedure UseMinVersionCheckBoxChange(Sender: TObject);
|
||||||
procedure ViewPkgSourceClick(Sender: TObject);
|
procedure ViewPkgSourceClick(Sender: TObject);
|
||||||
private
|
private
|
||||||
FLazPackage: TLazPackage;
|
FLazPackage: TLazPackage;
|
||||||
@ -899,13 +899,13 @@ begin
|
|||||||
PackageEditors.ViewPkgSourcePackage(LazPackage);
|
PackageEditors.ViewPkgSourcePackage(LazPackage);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UseMaxVersionCheckBoxClick(Sender: TObject);
|
procedure TPackageEditorForm.UseMaxVersionCheckBoxChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MaxVersionEdit.Enabled:=UseMaxVersionCheckBox.Checked;
|
MaxVersionEdit.Enabled:=UseMaxVersionCheckBox.Checked;
|
||||||
UpdateApplyDependencyButton;
|
UpdateApplyDependencyButton;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.UseMinVersionCheckBoxClick(Sender: TObject);
|
procedure TPackageEditorForm.UseMinVersionCheckBoxChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
MinVersionEdit.Enabled:=UseMinVersionCheckBox.Checked;
|
MinVersionEdit.Enabled:=UseMinVersionCheckBox.Checked;
|
||||||
UpdateApplyDependencyButton;
|
UpdateApplyDependencyButton;
|
||||||
@ -1116,7 +1116,7 @@ begin
|
|||||||
PackageGraph.EndUpdate;
|
PackageGraph.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.AddToUsesPkgSectionCheckBoxClick(Sender: TObject);
|
procedure TPackageEditorForm.AddToUsesPkgSectionCheckBoxChange(Sender: TObject);
|
||||||
var
|
var
|
||||||
CurFile: TPkgFile;
|
CurFile: TPkgFile;
|
||||||
Removed: boolean;
|
Removed: boolean;
|
||||||
@ -1183,7 +1183,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TPackageEditorForm.CallRegisterProcCheckBoxClick(Sender: TObject);
|
procedure TPackageEditorForm.CallRegisterProcCheckBoxChange(Sender: TObject);
|
||||||
var
|
var
|
||||||
CurFile: TPkgFile;
|
CurFile: TPkgFile;
|
||||||
Removed: boolean;
|
Removed: boolean;
|
||||||
@ -1462,7 +1462,7 @@ begin
|
|||||||
Parent:=FilePropsGroupBox;
|
Parent:=FilePropsGroupBox;
|
||||||
Caption:=lisPckEditRegisterUnit;
|
Caption:=lisPckEditRegisterUnit;
|
||||||
UseOnChange:=true;
|
UseOnChange:=true;
|
||||||
OnClick:=@CallRegisterProcCheckBoxClick;
|
OnChange:=@CallRegisterProcCheckBoxChange;
|
||||||
Hint:=Format(lisPckEditCallRegisterProcedureOfSelectedUnit, ['"', '"']);
|
Hint:=Format(lisPckEditCallRegisterProcedureOfSelectedUnit, ['"', '"']);
|
||||||
ShowHint:=true;
|
ShowHint:=true;
|
||||||
end;
|
end;
|
||||||
@ -1472,7 +1472,7 @@ begin
|
|||||||
Name:='AddToUsesPkgSectionCheckBox';
|
Name:='AddToUsesPkgSectionCheckBox';
|
||||||
Caption:=lisPkgMangUseUnit;
|
Caption:=lisPkgMangUseUnit;
|
||||||
UseOnChange:=true;
|
UseOnChange:=true;
|
||||||
OnClick:=@AddToUsesPkgSectionCheckBoxClick;
|
OnChange:=@AddToUsesPkgSectionCheckBoxChange;
|
||||||
Hint:=lisPkgMangAddUnitToUsesClauseOfPackageDisableThisOnlyForUnit;
|
Hint:=lisPkgMangAddUnitToUsesClauseOfPackageDisableThisOnlyForUnit;
|
||||||
ShowHint:=true;
|
ShowHint:=true;
|
||||||
Parent:=FilePropsGroupBox;
|
Parent:=FilePropsGroupBox;
|
||||||
@ -1501,7 +1501,7 @@ begin
|
|||||||
Name:='UseMinVersionCheckBox';
|
Name:='UseMinVersionCheckBox';
|
||||||
Caption:=lisPckEditMinimumVersion;
|
Caption:=lisPckEditMinimumVersion;
|
||||||
UseOnChange:=true;
|
UseOnChange:=true;
|
||||||
OnClick:=@UseMinVersionCheckBoxClick;
|
OnChange:=@UseMinVersionCheckBoxChange;
|
||||||
Parent:=FilePropsGroupBox;
|
Parent:=FilePropsGroupBox;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1518,7 +1518,7 @@ begin
|
|||||||
Name:='UseMaxVersionCheckBox';
|
Name:='UseMaxVersionCheckBox';
|
||||||
Caption:=lisPckEditMaximumVersion;
|
Caption:=lisPckEditMaximumVersion;
|
||||||
UseOnChange:=true;
|
UseOnChange:=true;
|
||||||
OnClick:=@UseMaxVersionCheckBoxClick;
|
OnChange:=@UseMaxVersionCheckBoxChange;
|
||||||
Parent:=FilePropsGroupBox;
|
Parent:=FilePropsGroupBox;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user