diff --git a/components/buildintf/projectintf.pas b/components/buildintf/projectintf.pas index 01bf1cb3da..a54fc3c9f2 100644 --- a/components/buildintf/projectintf.pas +++ b/components/buildintf/projectintf.pas @@ -348,6 +348,8 @@ type property Descriptor: TProjectDescriptor read FDescriptor write FDescriptor; end; + { TAbstractRunParamsOptionsMode } + TAbstractRunParamsOptionsMode = class(TPersistent) private fName: string; @@ -360,6 +362,12 @@ type fLaunchingApplicationPathPlusParams: string; fWorkingDirectory: string; fDisplay: string; + FUseConsoleWinPos: boolean; + FUseConsoleWinSize: boolean; + FUseConsoleWinBuffer: boolean; + FConsoleWinPos: TPoint; + FConsoleWinSize: TPoint; + FConsoleWinBuffer: TPoint; // environment options fUserOverrides: TStringList; @@ -391,6 +399,13 @@ type property UserOverrides: TStringList Read fUserOverrides; property IncludeSystemVariables: boolean Read fIncludeSystemVariables Write fIncludeSystemVariables; + // WindowBounds + property UseConsoleWinPos: boolean read FUseConsoleWinPos write FUseConsoleWinPos; + property UseConsoleWinSize: boolean read FUseConsoleWinSize write FUseConsoleWinSize; + property UseConsoleWinBuffer: boolean read FUseConsoleWinBuffer write FUseConsoleWinBuffer; + property ConsoleWinPos: TPoint read FConsoleWinPos write FConsoleWinPos; + property ConsoleWinSize: TPoint read FConsoleWinSize write FConsoleWinSize; + property ConsoleWinBuffer: TPoint read FConsoleWinBuffer write FConsoleWinBuffer; end; { TAbstractRunParamsOptions } @@ -821,6 +836,12 @@ begin ADest.LaunchingApplicationPathPlusParams := LaunchingApplicationPathPlusParams; ADest.WorkingDirectory := WorkingDirectory; ADest.Display := Display; + ADest.UseConsoleWinPos := UseConsoleWinPos; + ADest.UseConsoleWinSize := UseConsoleWinSize; + ADest.UseConsoleWinBuffer := UseConsoleWinBuffer; + ADest.ConsoleWinPos := ConsoleWinPos; + ADest.ConsoleWinSize := ConsoleWinSize; + ADest.ConsoleWinBuffer := ConsoleWinBuffer; ADest.UserOverrides.Assign(UserOverrides); ADest.IncludeSystemVariables := IncludeSystemVariables; @@ -839,6 +860,12 @@ begin fWorkingDirectory := ''; fUseDisplay := False; fDisplay := ':0'; + FUseConsoleWinPos := False; + FUseConsoleWinSize := False; + FUseConsoleWinBuffer := False; + FConsoleWinPos := Default(TPoint); + FConsoleWinSize := Default(TPoint); + FConsoleWinBuffer := Default(TPoint); // environment options fUserOverrides.Clear; diff --git a/components/debuggerintf/dbgintfdebuggerbase.pp b/components/debuggerintf/dbgintfdebuggerbase.pp index fdfef157bf..508fe512a0 100644 --- a/components/debuggerintf/dbgintfdebuggerbase.pp +++ b/components/debuggerintf/dbgintfdebuggerbase.pp @@ -63,6 +63,7 @@ type TDBGFeature = ( dfEvalFunctionCalls, // The debugger supports calling functions in watches/expressions. defAllowFunctionCall in TWatcheEvaluateFlags dfThreadSuspension, + dfConsoleWinPos, // Able to set position of console Window (* dfNotSuitableForOsArch: If this is set, then this debugger can not be used on the current @@ -1747,6 +1748,12 @@ type procedure RemoveNotifyEvent(AReason: TDebuggerNotifyReason; AnEvent: TNotifyEvent); procedure SetSkipStopMessage; public + procedure SetConsoleWinPos(ALeft, ATop: Integer); virtual; + procedure UnSetConsoleWinPos; virtual; + procedure SetConsoleWinSize(AWidth, AHeight: Integer); virtual; + procedure UnSetConsoleWinSize; virtual; + procedure SetConsoleWinBuffer(AColumns, ARows: Integer); virtual; + procedure UnSetConsoleWinBuffer; virtual; property Arguments: String read FArguments write FArguments; // Arguments feed to the program property BreakPoints: TDBGBreakPoints read FBreakPoints; // list of all breakpoints property CallStack: TCallStackSupplier read FCallStack; @@ -5430,6 +5437,36 @@ begin FSkipStopMessage := True; end; +procedure TDebuggerIntf.SetConsoleWinPos(ALeft, ATop: Integer); +begin +// +end; + +procedure TDebuggerIntf.UnSetConsoleWinPos; +begin +// +end; + +procedure TDebuggerIntf.SetConsoleWinSize(AWidth, AHeight: Integer); +begin +// +end; + +procedure TDebuggerIntf.UnSetConsoleWinSize; +begin +// +end; + +procedure TDebuggerIntf.SetConsoleWinBuffer(AColumns, ARows: Integer); +begin +// +end; + +procedure TDebuggerIntf.UnSetConsoleWinBuffer; +begin +// +end; + class function TDebuggerIntf.SupportedCommandsFor(AState: TDBGState): TDBGCommands; begin Result := COMMANDMAP[AState] * GetSupportedCommands; diff --git a/components/fpdebug/fpdbgclasses.pp b/components/fpdebug/fpdbgclasses.pp index 2ecee5db2f..e614ab83f1 100644 --- a/components/fpdebug/fpdbgclasses.pp +++ b/components/fpdebug/fpdbgclasses.pp @@ -608,6 +608,26 @@ type TDbgProcessConfig = class(TPersistent) end; + { TDbgConfig } + + TDbgConfig = class + private + FUseConsoleWinPos: boolean; + FUseConsoleWinSize: boolean; + FUseConsoleWinBuffer: boolean; + FConsoleWinPos: TPoint; + FConsoleWinSize: TPoint; + FConsoleWinBuffer: TPoint; + public + // WindowBounds + property UseConsoleWinPos: boolean read FUseConsoleWinPos write FUseConsoleWinPos; + property UseConsoleWinSize: boolean read FUseConsoleWinSize write FUseConsoleWinSize; + property UseConsoleWinBuffer: boolean read FUseConsoleWinBuffer write FUseConsoleWinBuffer; + property ConsoleWinPos: TPoint read FConsoleWinPos write FConsoleWinPos; + property ConsoleWinSize: TPoint read FConsoleWinSize write FConsoleWinSize; + property ConsoleWinBuffer: TPoint read FConsoleWinBuffer write FConsoleWinBuffer; + end; + { TDbgInstance } TDbgInstance = class(TObject) @@ -741,6 +761,7 @@ type FThreadID: Integer; FWatchPointData: TFpWatchPointData; FProcessConfig: TDbgProcessConfig; + FConfig: TDbgConfig; function GetDisassembler: TDbgAsmDecoder; function GetLastLibrariesLoaded: TDbgLibraryArr; function GetLastLibrariesUnloaded: TDbgLibraryArr; @@ -787,6 +808,7 @@ type function CreateWatchPointData: TFpWatchPointData; virtual; procedure Init(const AProcessID, AThreadID: Integer); + function CreateConfig: TDbgConfig; procedure InitializeLoaders; override; public class function isSupported(ATargetInfo: TTargetDescriptor): boolean; virtual; @@ -906,6 +928,7 @@ type property GotExitProcess: Boolean read FGotExitProcess write FGotExitProcess; property Disassembler: TDbgAsmDecoder read GetDisassembler; property ThreadMap: TThreadMap read FThreadMap; + property Config: TDbgConfig read FConfig; end; TDbgProcessClass = class of TDbgProcess; @@ -2210,6 +2233,7 @@ const // MAP_ID_SIZE = itu4; {.$ENDIF} begin + FConfig := CreateConfig; FMemManager := AMemManager; FMemModel := AMemModel; FProcessID := 0; @@ -2284,6 +2308,7 @@ begin FreeAndNil(FLibMap); FreeAndNil(FSymInstances); FreeAndNil(FDisassembler); + FreeAndNil(FConfig); inherited; end; @@ -3006,6 +3031,11 @@ begin FThreadID := AThreadID; end; +function TDbgProcess.CreateConfig: TDbgConfig; +begin + Result := TDbgConfig.Create; +end; + function TDbgProcess.WriteData(const AAdress: TDbgPtr; const ASize: Cardinal; const AData): Boolean; begin result := false; diff --git a/components/fpdebug/fpdbgwinclasses.pas b/components/fpdebug/fpdbgwinclasses.pas index 7e1d798ce8..c5345fd0b4 100644 --- a/components/fpdebug/fpdbgwinclasses.pas +++ b/components/fpdebug/fpdbgwinclasses.pas @@ -744,6 +744,21 @@ begin FProcProcess.Parameters:=AParams; FProcProcess.Environment:=AnEnvironment; FProcProcess.CurrentDirectory:=AWorkingDirectory; + if Config.UseConsoleWinPos then begin + FProcProcess.StartupOptions := FProcProcess.StartupOptions + [suoUsePosition]; + FProcProcess.WindowLeft := Cardinal(Config.ConsoleWinPos.X); + FProcProcess.WindowTop := Cardinal(Config.ConsoleWinPos.Y); + end; + if Config.UseConsoleWinSize then begin + FProcProcess.StartupOptions := FProcProcess.StartupOptions + [suoUseSize]; + FProcProcess.WindowWidth := Cardinal(Config.ConsoleWinSize.X); + FProcProcess.WindowHeight := Cardinal(Config.ConsoleWinSize.Y); + end; + if Config.UseConsoleWinBuffer then begin + FProcProcess.StartupOptions := FProcProcess.StartupOptions + [suoUseCountChars]; + FProcProcess.WindowColumns := Cardinal(Config.ConsoleWinBuffer.X); + FProcProcess.WindowRows := Cardinal(Config.ConsoleWinBuffer.Y); + end; FProcProcess.Execute; Init(FProcProcess.ProcessID, 0); diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index 19718aab23..740fc0950a 100644 --- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -353,6 +353,12 @@ type FBreakUpdateList: TBreakPointUpdateList; FFpDebugOutputQueue: TFpDebugStringQueue; FFpDebugOutputAsync: integer; + FUseConsoleWinBuffer: boolean; + FUseConsoleWinPos: boolean; + FUseConsoleWinSize: boolean; + FConsoleWinBuffer: TPoint; + FConsoleWinPos: TPoint; + FConsoleWinSize: TPoint; // procedure DoDebugOutput(Data: PtrInt); procedure DoThreadDebugOutput(Sender: TObject; ProcessId, @@ -453,6 +459,12 @@ type procedure ThreadHandleBreakPointInCallRoutine(AnAddress: TDBGPtr; out ACanContinue: Boolean); procedure BeforeWatchEval(ACallContext: TFpDbgInfoCallContext); override; procedure RunProcessLoop(OnlyCurrentThread: Boolean); override; + procedure SetConsoleWinPos(ALeft, ATop: Integer); override; + procedure UnSetConsoleWinPos; override; + procedure SetConsoleWinSize(AWidth, AHeight: Integer); override; + procedure UnSetConsoleWinSize; override; + procedure SetConsoleWinBuffer(AColumns, ARows: Integer); override; + procedure UnSetConsoleWinBuffer; override; class function Caption: String; override; class function NeedsExePath: boolean; override; @@ -4041,6 +4053,13 @@ begin {$ifdef windows} FDbgController.ForceNewConsoleWin:=TFpDebugDebuggerProperties(GetProperties).ForceNewConsole; {$endif windows} + FDbgController.CurrentProcess.Config.UseConsoleWinPos := FUseConsoleWinPos; + FDbgController.CurrentProcess.Config.UseConsoleWinSize := FUseConsoleWinSize; + FDbgController.CurrentProcess.Config.UseConsoleWinBuffer := FUseConsoleWinBuffer; + FDbgController.CurrentProcess.Config.ConsoleWinPos := FConsoleWinPos; + FDbgController.CurrentProcess.Config.ConsoleWinSize := FConsoleWinSize; + FDbgController.CurrentProcess.Config.ConsoleWinBuffer := FConsoleWinBuffer; + FDbgController.AttachToPid := 0; if ACommand = dcAttach then begin FDbgController.AttachToPid := StrToIntDef(String(AParams[0].VAnsiString), 0); @@ -4781,6 +4800,42 @@ begin Application.QueueAsyncCall(@DebugLoopFinished, 0); end; +procedure TFpDebugDebugger.SetConsoleWinPos(ALeft, ATop: Integer); +begin + FUseConsoleWinPos := True; + FConsoleWinPos.X := ALeft; + FConsoleWinPos.Y := ATop; +end; + +procedure TFpDebugDebugger.UnSetConsoleWinPos; +begin + FUseConsoleWinPos := False; +end; + +procedure TFpDebugDebugger.SetConsoleWinSize(AWidth, AHeight: Integer); +begin + FUseConsoleWinSize := True; + FConsoleWinSize.X := AWidth; + FConsoleWinSize.Y := AHeight; +end; + +procedure TFpDebugDebugger.UnSetConsoleWinSize; +begin + FUseConsoleWinSize := False; +end; + +procedure TFpDebugDebugger.SetConsoleWinBuffer(AColumns, ARows: Integer); +begin + FUseConsoleWinBuffer := True; + FConsoleWinBuffer.X := AColumns; + FConsoleWinBuffer.Y := ARows; +end; + +procedure TFpDebugDebugger.UnSetConsoleWinBuffer; +begin + FUseConsoleWinBuffer := False; +end; + class function TFpDebugDebugger.Caption: String; begin Result:='FpDebug internal Dwarf-debugger'; @@ -4858,6 +4913,9 @@ begin (defined(CPU386) or defined(CPUI386) or defined(CPUX86_64) or defined(CPUX64)) } Result := [dfEvalFunctionCalls, dfThreadSuspension]; + {$IFDEF windows} + Result := Result + [dfConsoleWinPos]; + {$ENDIF} {$ELSE} Result := [dfNotSuitableForOsArch]; {$ENDIF} diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 7ca637049c..81866afa16 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -68,7 +68,7 @@ uses // IDE CompilerOptions, SourceEditor, ProjectDefs, Project, ProjectDebugLink, LazarusIDEStrConsts, MainBar, MainIntf, MainBase, BaseBuildManager, SourceMarks, - DebugEventsForm, EnvGuiOptions; + DebugEventsForm, EnvGuiOptions, RunParamsOpts; type @@ -2667,6 +2667,7 @@ var NewWorkingDir: String; NewDebuggerClass: TDebuggerClass; DbgCfg: TDebuggerPropertiesConfig; + AMode: TRunParamsOptionsMode; begin {$ifdef VerboseDebugger} DebugLn('[TDebugManager.DoInitDebugger] A'); @@ -2787,6 +2788,28 @@ begin then FDebugger.Arguments := LaunchingParams; if FDebugger <> nil then FDebugger.ShowConsole := not Project1.CompilerOptions.Win32GraphicApp; + if FDebugger <> nil then begin + AMode := Project1.RunParameterOptions.GetActiveMode; + if (AMode <> nil) then begin + if AMode.UseConsoleWinPos then + FDebugger.SetConsoleWinPos(AMode.ConsoleWinPos.X, AMode.ConsoleWinPos.Y) + else + FDebugger.UnSetConsoleWinPos; + if AMode.UseConsoleWinSize then + FDebugger.SetConsoleWinSize(AMode.ConsoleWinSize.X, AMode.ConsoleWinSize.Y) + else + FDebugger.UnSetConsoleWinSize; + if AMode.UseConsoleWinBuffer then + FDebugger.SetConsoleWinBuffer(AMode.ConsoleWinBuffer.X, AMode.ConsoleWinBuffer.Y) + else + FDebugger.UnSetConsoleWinBuffer; + end + else begin + FDebugger.UnSetConsoleWinPos; + FDebugger.UnSetConsoleWinSize; + FDebugger.UnSetConsoleWinBuffer; + end; + end; end else begin // attach diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 8fb82ece81..53c3216db1 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -2772,6 +2772,13 @@ resourcestring dlgROWorkingDirectory = 'Working directory'; dlgRunODisplay = 'Display (not for win32, e.g. 198.112.45.11:0, x.org:1, hydra:0.1)'; dlgRunOUsedisplay = 'Use display'; + dlgDefaultWinPos = 'Default Window/Console position and size'; + dlgUseConsolePos = 'Set Left/Top'; + dlgUseConsoleSize = 'Set Width/Height'; + dlgUseConsoleBuffer = 'Set Columns/Rows '; + dlgConsoleSizeXY = 'Top/Left:'; + dlgConsoleSizeWH = 'Rows/Colums:'; + dlgConsoleSizeNotSupported = 'Current debugger does not support this.'; dlgRunOSystemVariables = 'System variables'; dlgRunOUserOverrides = 'User overrides'; dlgIncludeSystemVariables = 'Include system variables'; diff --git a/ide/main.pp b/ide/main.pp index 8cb3cd90ce..3b9dd46f92 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -7539,6 +7539,26 @@ begin Process.Executable := ExeFile; Process.Parameters.Assign(Params); Process.CurrentDirectory := RunWorkingDirectory; + {$IFDEF Windows} + ARunMode := Project1.RunParameterOptions.GetActiveMode; + if ARunMode <> nil then begin + if ARunMode.UseConsoleWinPos then begin + Process.StartupOptions := Process.StartupOptions + [suoUsePosition]; + Process.WindowLeft := ARunMode.ConsoleWinPos.X; + Process.WindowTop := ARunMode.ConsoleWinPos.Y; + end; + if ARunMode.UseConsoleWinSize then begin + Process.StartupOptions := Process.StartupOptions + [suoUseSize]; + Process.WindowWidth := ARunMode.ConsoleWinSize.X; + Process.WindowHeight := ARunMode.ConsoleWinSize.Y; + end; + if ARunMode.UseConsoleWinBuffer then begin + Process.StartupOptions := Process.StartupOptions + [suoUseCountChars]; + Process.WindowColumns := ARunMode.ConsoleWinBuffer.X; + Process.WindowRows := ARunMode.ConsoleWinBuffer.Y; + end; + end; + {$ENDIF} if MainBuildBoss.GetProjectUsesAppBundle and (FileExistsUTF8(ExeFile) or DirectoryExistsUTF8(ExeFile)) diff --git a/ide/packages/idedebugger/processdebugger.pp b/ide/packages/idedebugger/processdebugger.pp index 836e7665e6..fdc55180b7 100644 --- a/ide/packages/idedebugger/processdebugger.pp +++ b/ide/packages/idedebugger/processdebugger.pp @@ -55,6 +55,12 @@ type TProcessDebugger = class(TDebugger) private FProcess: TProcessUTF8; + FUseConsoleWinPos: boolean; + FUseConsoleWinSize: boolean; + FUseConsoleWinBuffer: boolean; + FConsoleWinPos: TPoint; + FConsoleWinSize: TPoint; + FConsoleWinBuffer: TPoint; procedure ProcessDestroyed(Sender: TObject); function ProcessEnvironment(const {%H-}AVariable: String; const {%H-}ASet: Boolean): Boolean; function ProcessRun: Boolean; @@ -66,6 +72,13 @@ type public class function Caption: String; override; class function NeedsExePath: boolean; override; + class function SupportedFeatures: TDBGFeatures; override; + procedure SetConsoleWinPos(ALeft, ATop: Integer); override; + procedure UnSetConsoleWinPos; override; + procedure SetConsoleWinSize(AWidth, AHeight: Integer); override; + procedure UnSetConsoleWinSize; override; + procedure SetConsoleWinBuffer(AColumns, ARows: Integer); override; + procedure UnSetConsoleWinBuffer; override; published end; @@ -139,6 +152,23 @@ begin then FProcess.Options:= [poNewConsole] else FProcess.Options:= [poNoConsole]; FProcess.ShowWindow := swoShowNormal; + {$IFDEF windows} + if FUseConsoleWinPos then begin + FProcess.StartupOptions := FProcess.StartupOptions + [suoUsePosition]; + FProcess.WindowLeft := FConsoleWinPos.X; + FProcess.WindowTop := FConsoleWinPos.Y; + end; + if FUseConsoleWinSize then begin + FProcess.StartupOptions := FProcess.StartupOptions + [suoUseSize]; + FProcess.WindowWidth := FConsoleWinSize.X; + FProcess.WindowHeight := FConsoleWinSize.Y; + end; + if FUseConsoleWinBuffer then begin + FProcess.StartupOptions := FProcess.StartupOptions + [suoUseCountChars]; + FProcess.WindowColumns := FConsoleWinBuffer.X; + FProcess.WindowRows := FConsoleWinBuffer.Y; + end; + {$ENDIF} FProcess.Execute; except on E: exception do begin @@ -189,6 +219,50 @@ begin Result := false; // no need to have a valid exe path for the process debugger end; +class function TProcessDebugger.SupportedFeatures: TDBGFeatures; +begin + Result := inherited SupportedFeatures; + {$IFDEF windows} + Result := Result + [dfConsoleWinPos]; + {$ENDIF} +end; + +procedure TProcessDebugger.SetConsoleWinPos(ALeft, ATop: Integer); +begin + FUseConsoleWinPos := True; + FConsoleWinPos.X := ALeft; + FConsoleWinPos.Y := ATop; +end; + +procedure TProcessDebugger.UnSetConsoleWinPos; +begin + FUseConsoleWinPos := False; +end; + +procedure TProcessDebugger.SetConsoleWinSize(AWidth, AHeight: Integer); +begin + FUseConsoleWinSize := True; + FConsoleWinSize.X := AWidth; + FConsoleWinSize.Y := AHeight; +end; + +procedure TProcessDebugger.UnSetConsoleWinSize; +begin + FUseConsoleWinSize := False; +end; + +procedure TProcessDebugger.SetConsoleWinBuffer(AColumns, ARows: Integer); +begin + FUseConsoleWinBuffer := True; + FConsoleWinBuffer.X := AColumns; + FConsoleWinBuffer.Y := ARows; +end; + +procedure TProcessDebugger.UnSetConsoleWinBuffer; +begin + FUseConsoleWinBuffer := False; +end; + initialization RegisterDebugger(TProcessDebugger); diff --git a/ide/runparamsopts.lfm b/ide/runparamsopts.lfm index 9785426246..e1ed9772ec 100644 --- a/ide/runparamsopts.lfm +++ b/ide/runparamsopts.lfm @@ -7,11 +7,11 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Caption = 'RunParamsOptsDlg' ClientHeight = 465 ClientWidth = 531 + Position = poScreenCenter + LCLVersion = '3.99.0.0' OnActivate = FormActivate OnClose = FormClose OnCreate = FormCreate - Position = poScreenCenter - LCLVersion = '2.3.0.0' object Notebook: TPageControl Left = 0 Height = 355 @@ -110,8 +110,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg BorderSpacing.Right = 6 BorderSpacing.Bottom = 6 Caption = 'UseLaunchingApplicationCheckBox' - OnChange = UseLaunchingApplicationCheckBoxChange TabOrder = 0 + OnChange = UseLaunchingApplicationCheckBoxChange end object UseLaunchingApplicationComboBox: TComboBox Left = 6 @@ -153,8 +153,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg BorderSpacing.Top = 6 BorderSpacing.Right = 6 Caption = 'HostApplicationBrowseBtn' - OnClick = HostApplicationBrowseBtnClick TabOrder = 1 + OnClick = HostApplicationBrowseBtnClick end object HostApplicationEdit: TEdit AnchorSideLeft.Control = HostApplicationGroupBox @@ -197,8 +197,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg BorderSpacing.Top = 6 BorderSpacing.Right = 6 Caption = 'WorkingDirectoryBtn' - OnClick = WorkingDirectoryBtnClick TabOrder = 1 + OnClick = WorkingDirectoryBtnClick end object WorkingDirectoryComboBox: TComboBox AnchorSideLeft.Control = WorkingDirectoryGroupBox @@ -215,6 +215,125 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Text = 'WorkingDirectoryComboBox' end end + object ConsoleWinSizeGroupBox: TGroupBox + Left = 0 + Height = 128 + Top = 328 + Width = 523 + Align = alTop + Anchors = [akTop] + AutoSize = True + Caption = 'ConsoleWinSizeGroupBox' + ClientHeight = 108 + ClientWidth = 519 + TabOrder = 5 + object ConsoleSizePanel: TPanel + Left = 0 + Height = 93 + Top = 0 + Width = 519 + Align = alClient + BevelOuter = bvNone + Caption = '0' + ChildSizing.LeftRightSpacing = 6 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.HorizontalSpacing = 6 + ChildSizing.VerticalSpacing = 6 + ChildSizing.EnlargeHorizontal = crsHomogenousChildResize + ChildSizing.ShrinkHorizontal = crsHomogenousChildResize + ChildSizing.Layout = cclLeftToRightThenTopToBottom + ChildSizing.ControlsPerLine = 3 + ClientHeight = 93 + ClientWidth = 519 + TabOrder = 0 + object UseConsolePosCheckBox: TCheckBox + Left = 6 + Height = 23 + Top = 6 + Width = 242 + Caption = 'UseConsolePosCheckBox' + TabOrder = 0 + OnChange = UseConsolePosCheckBoxChange + end + object edConsolePosLeft: TSpinEdit + Left = 254 + Height = 23 + Top = 6 + Width = 127 + MaxValue = 20000 + TabOrder = 2 + end + object edConsolePosTop: TSpinEdit + Left = 387 + Height = 23 + Top = 6 + Width = 126 + MaxValue = 20000 + TabOrder = 1 + end + object UseConsoleSizeCheckBox: TCheckBox + Left = 6 + Height = 23 + Top = 35 + Width = 242 + Caption = 'UseConsoleSizeCheckBox' + TabOrder = 3 + OnChange = UseConsolePosCheckBoxChange + end + object edConsoleSizeWidth: TSpinEdit + Left = 254 + Height = 23 + Top = 35 + Width = 127 + MaxValue = 20000 + TabOrder = 5 + end + object edConsoleSizeHeight: TSpinEdit + Left = 387 + Height = 23 + Top = 35 + Width = 126 + MaxValue = 20000 + TabOrder = 4 + end + object UseConsoleBufferCheckBox: TCheckBox + Left = 6 + Height = 23 + Top = 64 + Width = 242 + Caption = 'UseConsoleBufferCheckBox' + TabOrder = 6 + OnChange = UseConsolePosCheckBoxChange + end + object edConsoleBufferColumns: TSpinEdit + Left = 254 + Height = 23 + Top = 64 + Width = 127 + MaxValue = 20000 + TabOrder = 8 + end + object edConsoleBufferRows: TSpinEdit + Left = 387 + Height = 23 + Top = 64 + Width = 126 + MaxValue = 20000 + TabOrder = 7 + end + end + object ConsoleSizeWarnLabel: TLabel + Left = 0 + Height = 15 + Top = 93 + Width = 519 + Align = alBottom + Caption = 'ConsoleSizeWarnLabel' + Font.Color = clRed + ParentFont = False + Visible = False + end + end end object EnvVarsPage: TTabSheet Caption = 'EnvVarsPage' @@ -286,8 +405,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AutoSize = True BorderSpacing.Around = 6 Caption = 'UserOverridesAddButton' - OnClick = UserOverridesAddButtonClick TabOrder = 1 + OnClick = UserOverridesAddButtonClick end object UserOverridesEditButton: TBitBtn AnchorSideLeft.Control = UserOverridesDeleteButton @@ -302,8 +421,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AutoSize = True BorderSpacing.Around = 6 Caption = 'UserOverridesEditButton' - OnClick = UserOverridesEditButtonClick TabOrder = 3 + OnClick = UserOverridesEditButtonClick end object UserOverridesDeleteButton: TBitBtn AnchorSideLeft.Control = UserOverridesAddButton @@ -318,8 +437,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg AutoSize = True BorderSpacing.Around = 6 Caption = 'UserOverridesDeleteButton' - OnClick = UserOverridesDeleteButtonClick TabOrder = 2 + OnClick = UserOverridesDeleteButtonClick end end object SystemVariablesGroupBox: TGroupBox @@ -383,8 +502,8 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Width = 523 Align = alBottom Caption = 'PreviewMultilineCheckBox' - OnChange = PreviewMultilineCheckBoxChange TabOrder = 1 + OnChange = PreviewMultilineCheckBoxChange end end end @@ -426,7 +545,6 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Top = 2 Width = 64 Caption = 'ModesLabel' - Color = clDefault ParentColor = False end object ModesComboBox: TComboBox @@ -438,9 +556,9 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Width = 217 BorderSpacing.Left = 9 ItemHeight = 15 - OnChange = ModesComboBoxChange Style = csDropDownList TabOrder = 0 + OnChange = ModesComboBoxChange end object ToolBar1: TToolBar AnchorSideLeft.Control = ModesComboBox @@ -461,19 +579,19 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Left = 1 Top = 0 Caption = 'NewModeButton' - OnClick = NewModeButtonClick ParentShowHint = False ShowCaption = False ShowHint = True + OnClick = NewModeButtonClick end object DeleteModeButton: TToolButton Left = 24 Top = 0 Caption = 'DeleteModeButton' - OnClick = DeleteModeButtonClick ParentShowHint = False ShowCaption = False ShowHint = True + OnClick = DeleteModeButtonClick end end object SaveInComboBox: TComboBox @@ -505,7 +623,6 @@ object RunParamsOptsDlg: TRunParamsOptsDlg Width = 62 BorderSpacing.Top = 3 Caption = 'SaveInLabel' - Color = clDefault ParentColor = False end end diff --git a/ide/runparamsopts.pas b/ide/runparamsopts.pas index 647ce6c5f3..10b5e44730 100644 --- a/ide/runparamsopts.pas +++ b/ide/runparamsopts.pas @@ -50,15 +50,16 @@ uses Classes, SysUtils, // LCL Controls, Forms, Buttons, StdCtrls, ComCtrls, Dialogs, ButtonPanel, ExtCtrls, + Spin, // IdeIntf IdeIntfStrConsts, BaseIDEIntf, IDEHelpIntf, ProjectIntf, IDEDialogs, InputHistory, IDEImagesIntf, IDEWindowIntf, MacroIntf, // LazUtils - LazFileUtils, LazFileCache, LazUTF8, Laz2_XMLCfg, + LazFileUtils, LazFileCache, LazUTF8, Laz2_XMLCfg, DbgIntfDebuggerBase, // IdeConfig EnvironmentOpts, RecentListProcs, // IDE - MiscOptions, SysVarUserOverrideDlg, LazarusIDEStrConsts; + MiscOptions, SysVarUserOverrideDlg, LazarusIDEStrConsts, BaseDebugManager; { The xml format version: When the format changes (new values, changed formats) we can distinguish old @@ -124,6 +125,17 @@ type TRunParamsOptsDlg = class(TForm) ButtonPanel: TButtonPanel; + UseConsoleSizeCheckBox: TCheckBox; + UseConsoleBufferCheckBox: TCheckBox; + edConsolePosTop: TSpinEdit; + edConsolePosLeft: TSpinEdit; + edConsoleSizeHeight: TSpinEdit; + edConsoleSizeWidth: TSpinEdit; + ConsoleSizeWarnLabel: TLabel; + ConsoleSizePanel: TPanel; + edConsoleBufferRows: TSpinEdit; + edConsoleBufferColumns: TSpinEdit; + UseConsolePosCheckBox: TCheckBox; CmdLineParametersComboBox: TComboBox; CmdLineParametersGroupBox: TGroupBox; DeleteModeButton: TToolButton; @@ -131,6 +143,7 @@ type DisplayGroupBox: TGroupBox; EnvVarsPage: TTabSheet; GeneralPage: TTabSheet; + ConsoleWinSizeGroupBox: TGroupBox; HostApplicationBrowseBtn: TButton; HostApplicationEdit: TEdit; HostApplicationGroupBox: TGroupBox; @@ -172,6 +185,7 @@ type procedure HostApplicationBrowseBtnClick(Sender: TObject); procedure NewModeButtonClick(Sender: TObject); procedure PreviewMultilineCheckBoxChange(Sender: TObject); + procedure UseConsolePosCheckBoxChange(Sender: TObject); procedure UseLaunchingApplicationCheckBoxChange(Sender: TObject); procedure UserOverridesListViewSelectItem(Sender: TObject; {%H-}Item: TListItem; {%H-}Selected: Boolean); @@ -484,6 +498,22 @@ begin UseDisplay); Display := XMLConfig.GetValue(Path + 'local/Display/Value', Display); + UseConsoleWinPos := XMLConfig.GetValue(Path + 'local/UseConsoleWinPos/Value', False); + UseConsoleWinSize := XMLConfig.GetValue(Path + 'local/UseConsoleWinSize/Value', False); + UseConsoleWinBuffer := XMLConfig.GetValue(Path + 'local/UseConsoleWinBuffer/Value', False); + ConsoleWinPos := Point( + XMLConfig.GetValue(Path + 'local/ConsoleWinPos/Left/Value', 0), + XMLConfig.GetValue(Path + 'local/ConsoleWinPos/Top/Value', 0) + ); + ConsoleWinSize := Point( + XMLConfig.GetValue(Path + 'local/ConsoleWinSize/Width/Value', 0), + XMLConfig.GetValue(Path + 'local/ConsoleWinSize/Height/Value', 0) + ); + ConsoleWinBuffer := Point( + XMLConfig.GetValue(Path + 'local/ConsoleWinBuffer/Columns/Value', 0), + XMLConfig.GetValue(Path + 'local/ConsoleWinBuffer/Rows/Value', 0) + ); + // environment options LoadUserOverrides(Path + 'environment/UserOverrides/'); IncludeSystemVariables := XMLConfig.GetValue( @@ -532,6 +562,16 @@ begin XMLConfig.SetDeleteValue(Path + 'local/Display/Value', Display, ':0'); + XMLConfig.SetDeleteValue(Path + 'local/UseConsoleWinPos/Value', UseConsoleWinPos, False); + XMLConfig.SetDeleteValue(Path + 'local/UseConsoleWinSize/Value', UseConsoleWinSize, False); + XMLConfig.SetDeleteValue(Path + 'local/UseConsoleWinBuffer/Value', UseConsoleWinBuffer, False); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinPos/Left/Value', ConsoleWinPos.X, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinPos/Top/Value', ConsoleWinPos.Y, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinSize/Width/Value', ConsoleWinSize.X, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinSize/Height/Value', ConsoleWinSize.Y, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinBuffer/Columns/Value', ConsoleWinBuffer.X, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinBuffer/Rows/Value', ConsoleWinBuffer.Y, 0); + // environment options SaveUserOverrides(Path + 'environment/UserOverrides/'); XMLConfig.SetDeleteValue(Path + 'environment/IncludeSystemVariables/Value', @@ -579,6 +619,22 @@ begin UseDisplay); Display := XMLConfig.GetValue(Path + 'local/Display/Value', Display); + UseConsoleWinPos := XMLConfig.GetValue(Path + 'local/UseConsoleWinPos/Value', False); + UseConsoleWinSize := XMLConfig.GetValue(Path + 'local/UseConsoleWinSize/Value', False); + UseConsoleWinBuffer := XMLConfig.GetValue(Path + 'local/UseConsoleWinBuffer/Value', False); + ConsoleWinPos := Point( + XMLConfig.GetValue(Path + 'local/ConsoleWinPos/Left/Value', 0), + XMLConfig.GetValue(Path + 'local/ConsoleWinPos/Top/Value', 0) + ); + ConsoleWinSize := Point( + XMLConfig.GetValue(Path + 'local/ConsoleWinSize/Width/Value', 0), + XMLConfig.GetValue(Path + 'local/ConsoleWinSize/Height/Value', 0) + ); + ConsoleWinBuffer := Point( + XMLConfig.GetValue(Path + 'local/ConsoleWinBuffer/Columns/Value', 0), + XMLConfig.GetValue(Path + 'local/ConsoleWinBuffer/Rows/Value', 0) + ); + // environment options LoadUserOverrides(Path + 'environment/UserOverrides/'); IncludeSystemVariables := XMLConfig.GetValue( @@ -629,6 +685,16 @@ begin XMLConfig.SetDeleteValue(Path + 'local/Display/Value', Display, ':0'); + XMLConfig.SetDeleteValue(Path + 'local/UseConsoleWinPos/Value', UseConsoleWinPos, False); + XMLConfig.SetDeleteValue(Path + 'local/UseConsoleWinSize/Value', UseConsoleWinSize, False); + XMLConfig.SetDeleteValue(Path + 'local/UseConsoleWinBuffer/Value', UseConsoleWinBuffer, False); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinPos/Left/Value', ConsoleWinPos.X, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinPos/Top/Value', ConsoleWinPos.Y, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinSize/Width/Value', ConsoleWinSize.X, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinSize/Height/Value', ConsoleWinSize.Y, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinBuffer/Columns/Value', ConsoleWinBuffer.X, 0); + XMLConfig.SetDeleteValue(Path + 'local/ConsoleWinBuffer/Rows/Value', ConsoleWinBuffer.Y, 0); + // environment options SaveUserOverrides(Path + 'environment/UserOverrides/'); XMLConfig.SetDeleteValue(Path + 'environment/IncludeSystemVariables/Value', @@ -769,6 +835,16 @@ begin UpdatePreview; end; +procedure TRunParamsOptsDlg.UseConsolePosCheckBoxChange(Sender: TObject); +begin + ConsoleSizeWarnLabel.Visible := + ( UseConsolePosCheckBox.Checked or + UseConsoleSizeCheckBox.Checked or + UseConsoleBufferCheckBox.Checked + ) and + not (dfConsoleWinPos in DebugBoss.DebuggerClass.SupportedFeatures); +end; + procedure TRunParamsOptsDlg.SetupLocalPage; begin HostApplicationGroupBox.Caption := dlgHostApplication; @@ -782,6 +858,12 @@ begin DisplayGroupBox.Caption := dlgRunODisplay; UseDisplayCheckBox.Caption := dlgRunOUsedisplay; DisplayEdit.Parent := DisplayGroupBox; + + ConsoleWinSizeGroupBox.Caption := dlgDefaultWinPos; + UseConsolePosCheckBox.Caption := dlgUseConsolePos; + UseConsoleSizeCheckBox.Caption := dlgUseConsoleSize; + UseConsoleBufferCheckBox.Caption := dlgUseConsoleBuffer; + ConsoleSizeWarnLabel.Caption := dlgConsoleSizeNotSupported; end; procedure TRunParamsOptsDlg.SetupEnvironmentPage; @@ -1052,6 +1134,16 @@ begin UseDisplayCheckBox.Checked := AMode.UseDisplay; DisplayEdit.Text := AMode.Display; + UseConsolePosCheckBox.Checked := AMode.UseConsoleWinPos; + UseConsoleSizeCheckBox.Checked := AMode.UseConsoleWinSize; + UseConsoleBufferCheckBox.Checked := AMode.UseConsoleWinBuffer; + edConsolePosLeft.Value := AMode.ConsoleWinPos.X; + edConsolePosTop.Value := AMode.ConsoleWinPos.Y; + edConsoleSizeWidth.Value := AMode.ConsoleWinSize.X; + edConsoleSizeHeight.Value := AMode.ConsoleWinSize.Y; + edConsoleBufferColumns.Value := AMode.ConsoleWinBuffer.X; + edConsoleBufferRows.Value := AMode.ConsoleWinBuffer.Y; + // environment FillSystemVariablesListView; FillUserOverridesListView(AMode); @@ -1174,7 +1266,14 @@ begin AMode.WorkingDirectory := Trim(WorkingDirectoryComboBox.Text); AMode.UseDisplay := UseDisplayCheckBox.Checked; AMode.Display := Trim(DisplayEdit.Text); - + + AMode.UseConsoleWinPos := UseConsolePosCheckBox.Checked; + AMode.ConsoleWinPos := Point(edConsolePosLeft.Value, edConsolePosTop.Value); + AMode.UseConsoleWinSize := UseConsoleSizeCheckBox.Checked; + AMode.ConsoleWinSize := Point(edConsoleSizeWidth.Value, edConsoleSizeHeight.Value); + AMode.UseConsoleWinBuffer := UseConsoleBufferCheckBox.Checked; + AMode.ConsoleWinBuffer := Point(edConsoleBufferColumns.Value, edConsoleBufferRows.Value); + // history list: WorkingDirectoryComboBox SaveComboHistory(WorkingDirectoryComboBox,hlWorkingDirectory,rltFile);