IDE: Enable the new Heaptrc output window by default. Part of issue #19837

git-svn-id: trunk@41169 -
This commit is contained in:
juha 2013-05-13 14:10:33 +00:00
parent 6caeb8a5d6
commit d784e09e7d
4 changed files with 80 additions and 30 deletions

View File

@ -38,9 +38,7 @@ program Lazarus;
{off $DEFINE IDE_MEM_CHECK} {off $DEFINE IDE_MEM_CHECK}
uses uses
{$IFDEF HEAPTRC_WINDOW}
redirect_stderr, redirect_stderr,
{$ENDIF HEAPTRC_WINDOW}
{$IF defined(UNIX) and not defined(DisableMultiThreading)} {$IF defined(UNIX) and not defined(DisableMultiThreading)}
cthreads, cthreads,
{$ENDIF} {$ENDIF}

View File

@ -1,16 +1,42 @@
{
***************************************************************************
* *
* 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 <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Abstract:
ToDo...
}
unit raw_window; unit raw_window;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
{$IFDEF Windows}
uses uses
SysUtils, Windows, Messages; SysUtils, Windows, Messages;
procedure ShowWindow(AStr : String); procedure ShowWindow(AStr : String);
{$ENDIF Windows}
implementation implementation
{$IFDEF Windows}
Var Var
WndHandle, WndHandle,
ButtonHandle, ButtonHandle,
@ -30,13 +56,13 @@ begin
Case uMsg Of Case uMsg Of
WM_DESTROY : PostQuitMessage(0); WM_DESTROY : PostQuitMessage(0);
WM_COMMAND : Begin WM_COMMAND : Begin
ControlCode := HiWord(wParam); ControlCode := HiWord(wParam);
ControlID := LoWord(wParam); ControlID := LoWord(wParam);
Case ControlCode Of Case ControlCode Of
BN_CLICKED : If lParam = ButtonHandle Then BN_CLICKED : If lParam = ButtonHandle Then
PostMessage(WndHandle, WM_CLOSE, 0, 0); PostMessage(WndHandle, WM_CLOSE, 0, 0);
end; end;
end; end;
WM_SETFOCUS: SetFocus(EditHandle); WM_SETFOCUS: SetFocus(EditHandle);
Else Else
Result := Windows.DefWindowProc(ahwnd, uMsg, wParam, lParam); Result := Windows.DefWindowProc(ahwnd, uMsg, wParam, lParam);
@ -50,21 +76,20 @@ Var
Begin Begin
Case uMsg of Case uMsg of
WM_KEYDOWN : Begin WM_KEYDOWN : Begin
GetKeyboardState(AKeyboardState); GetKeyboardState(AKeyboardState);
If isset(AKeyboardState[VK_CONTROL], 8) And isset(AKeyboardState[VK_A], 8) Then Begin If isset(AKeyboardState[VK_CONTROL], 8) And isset(AKeyboardState[VK_A], 8) Then Begin
SendMessage(EditHandle, EM_SETSEL, 0, -1); SendMessage(EditHandle, EM_SETSEL, 0, -1);
Exit(0); Exit(0);
end; end;
If isset(AKeyboardState[VK_CONTROL], 8) And isset(AKeyboardState[VK_C], 8) Then Begin If isset(AKeyboardState[VK_CONTROL], 8) And isset(AKeyboardState[VK_C], 8) Then Begin
PostMessage(EditHandle, WM_COPY, 0, 0); PostMessage(EditHandle, WM_COPY, 0, 0);
Exit(0); Exit(0);
End; End;
If isset(AKeyboardState[VK_RETURN], 8) Or isset(AKeyboardState[VK_ESCAPE], 8) Then Begin If isset(AKeyboardState[VK_RETURN], 8) Or isset(AKeyboardState[VK_ESCAPE], 8) Then Begin
PostMessage(ButtonHandle, BM_CLICK, 0, 0); PostMessage(ButtonHandle, BM_CLICK, 0, 0);
Exit(0); Exit(0);
end; end;
end;
end;
End; End;
Result := CallWindowProc(OldSubProc, Ahwnd, uMsg, wParam, lParam); Result := CallWindowProc(OldSubProc, Ahwnd, uMsg, wParam, lParam);
end; end;
@ -158,6 +183,9 @@ Begin
UnregisterClass(WndClass.lpszClassName, WndClass.hInstance); UnregisterClass(WndClass.lpszClassName, WndClass.hInstance);
end; end;
{$ELSE Windows}
// If some action is needed in non-Windows systems, add it here.
{$ENDIF Windows}
end. end.

View File

@ -1,17 +1,43 @@
{
***************************************************************************
* *
* 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 <http://www.gnu.org/copyleft/gpl.html>. You can also *
* obtain it by writing to the Free Software Foundation, *
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
***************************************************************************
Abstract:
ToDo...
}
unit redirect_stderr; unit redirect_stderr;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
interface interface
{$IFDEF Windows}
uses uses
heaptrc, SysUtils, raw_window; heaptrc, SysUtils, raw_window;
{$ENDIF Windows}
Var Var
DoShowWindow : Boolean = True; DoShowWindow : Boolean = True;
implementation implementation
{$IFDEF Windows}
const const
ErrorBufferLength = 2 * 1024; ErrorBufferLength = 2 * 1024;
@ -102,7 +128,9 @@ initialization
AssignError(MyStdErr); AssignError(MyStdErr);
SetHeapTraceOutput(MyStdErr); SetHeapTraceOutput(MyStdErr);
finalization {$ELSE Windows}
// If some action is needed in non-Windows systems, add it here.
{$ENDIF Windows}
end. end.

View File

@ -31,9 +31,7 @@ program StartLazarus;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses uses
{$IFDEF HEAPTRC_WINDOW}
redirect_stderr, redirect_stderr,
{$ENDIF HEAPTRC_WINDOW}
Interfaces, SysUtils, Interfaces, SysUtils,
Forms, Forms,
LazarusManager; LazarusManager;
@ -44,9 +42,7 @@ var
ALazarusManager: TLazarusManager; ALazarusManager: TLazarusManager;
begin begin
{$IFDEF HEAPTRC_WINDOW}
redirect_stderr.DoShowWindow := False; redirect_stderr.DoShowWindow := False;
{$ENDIF HEAPTRC_WINDOW}
Application.Initialize; Application.Initialize;
ALazarusManager := TLazarusManager.Create(nil); ALazarusManager := TLazarusManager.Create(nil);
ALazarusManager.Initialize; ALazarusManager.Initialize;