mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-05 03:39:44 +01:00
MG: fixed TComboBox and InvalidateControl
git-svn-id: trunk@2751 -
This commit is contained in:
parent
7f4da47cd5
commit
46f94b3354
51
ide/main.pp
51
ide/main.pp
@ -438,9 +438,11 @@ type
|
|||||||
FocusEditor: boolean): boolean;
|
FocusEditor: boolean): boolean;
|
||||||
procedure DoShowMessagesView;
|
procedure DoShowMessagesView;
|
||||||
procedure DoArrangeSourceEditorAndMessageView;
|
procedure DoArrangeSourceEditorAndMessageView;
|
||||||
|
function GetTestBuildDir: string; override;
|
||||||
function GetProjectTargetFilename: string;
|
function GetProjectTargetFilename: string;
|
||||||
function GetTestProjectFilename: string;
|
function GetTestProjectFilename: string;
|
||||||
function GetTestUnitFilename(AnUnitInfo: TUnitInfo): string; override;
|
function GetTestUnitFilename(AnUnitInfo: TUnitInfo): string; override;
|
||||||
|
function IsTestUnitFilename(const AFilename: string): boolean; override;
|
||||||
function GetRunCommandLine: string; override;
|
function GetRunCommandLine: string; override;
|
||||||
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s:string;
|
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s:string;
|
||||||
var Handled, Abort: boolean);
|
var Handled, Abort: boolean);
|
||||||
@ -2839,7 +2841,7 @@ begin
|
|||||||
Handled:=false;
|
Handled:=false;
|
||||||
Ext:=lowercase(ExtractFileExt(AFilename));
|
Ext:=lowercase(ExtractFileExt(AFilename));
|
||||||
|
|
||||||
if (not (ofProjectLoading in Flags)) and (ToolStatus=itNone)
|
if ([ofProjectLoading,ofRegularFile]*Flags<>[]) and (ToolStatus=itNone)
|
||||||
and (Ext='.lpi') then begin
|
and (Ext='.lpi') then begin
|
||||||
// this is a project info file -> load whole project
|
// this is a project info file -> load whole project
|
||||||
Result:=DoOpenProjectFile(AFilename);
|
Result:=DoOpenProjectFile(AFilename);
|
||||||
@ -2854,7 +2856,7 @@ begin
|
|||||||
NewUnitInfo:=nil;
|
NewUnitInfo:=nil;
|
||||||
|
|
||||||
// check if unit is a program
|
// check if unit is a program
|
||||||
if (not (ofProjectLoading in Flags))
|
if ([ofProjectLoading,ofRegularFile]*Flags<>[])
|
||||||
and FilenameIsPascalSource(AFilename)
|
and FilenameIsPascalSource(AFilename)
|
||||||
and (CodeToolBoss.GetSourceType(PreReadBuf,false)='PROGRAM') then begin
|
and (CodeToolBoss.GetSourceType(PreReadBuf,false)='PROGRAM') then begin
|
||||||
NewProgramName:=CodeToolBoss.GetSourceName(PreReadBuf,false);
|
NewProgramName:=CodeToolBoss.GetSourceName(PreReadBuf,false);
|
||||||
@ -3592,7 +3594,7 @@ var
|
|||||||
begin
|
begin
|
||||||
{$IFDEF IDE_VERBOSE}
|
{$IFDEF IDE_VERBOSE}
|
||||||
writeln('');
|
writeln('');
|
||||||
writeln('*** TMainIDE.DoOpenEditorFile START "',AFilename,'"');
|
writeln('*** TMainIDE.DoOpenEditorFile START "',AFilename,'" ',OpenFlagsToString(Flags));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF IDE_MEM_CHECK}CheckHeap(IntToStr(GetMem_Cnt));{$ENDIF}
|
{$IFDEF IDE_MEM_CHECK}CheckHeap(IntToStr(GetMem_Cnt));{$ENDIF}
|
||||||
Result:=mrCancel;
|
Result:=mrCancel;
|
||||||
@ -3601,7 +3603,8 @@ begin
|
|||||||
and (ExtractFilenameOnly(AFilename)='') then
|
and (ExtractFilenameOnly(AFilename)='') then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if (ofAddToRecent in Flags) and (AFilename<>'') then
|
if ([ofAddToRecent,ofRevert,ofVirtualFile]*Flags=[ofAddToRecent])
|
||||||
|
and (AFilename<>'') then
|
||||||
EnvironmentOptions.AddToRecentOpenFiles(AFilename);
|
EnvironmentOptions.AddToRecentOpenFiles(AFilename);
|
||||||
|
|
||||||
// check if this is a hidden unit:
|
// check if this is a hidden unit:
|
||||||
@ -5291,6 +5294,7 @@ var MaxMessages: integer;
|
|||||||
TopLine: integer;
|
TopLine: integer;
|
||||||
MsgType: TErrorType;
|
MsgType: TErrorType;
|
||||||
SrcEdit: TSourceEditor;
|
SrcEdit: TSourceEditor;
|
||||||
|
OpenFlags: TOpenFlags;
|
||||||
begin
|
begin
|
||||||
Result:=false;
|
Result:=false;
|
||||||
MaxMessages:=MessagesView.MessageView.Items.Count;
|
MaxMessages:=MessagesView.MessageView.Items.Count;
|
||||||
@ -5312,12 +5316,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
if TheOutputFilter.GetSourcePosition(MessagesView.MessageView.Items[Index],
|
if TheOutputFilter.GetSourcePosition(MessagesView.MessageView.Items[Index],
|
||||||
Filename,CaretXY,MsgType) then begin
|
Filename,CaretXY,MsgType) then begin
|
||||||
SearchedFilename := FindUnitFile(Filename);
|
|
||||||
|
OpenFlags:=[ofOnlyIfExists,ofRegularFile];
|
||||||
|
if not IsTestUnitFilename(Filename) then
|
||||||
|
SearchedFilename := FindUnitFile(Filename)
|
||||||
|
else begin
|
||||||
|
SearchedFilename := ExtractFileName(Filename);
|
||||||
|
Include(OpenFlags,ofVirtualFile);
|
||||||
|
end;
|
||||||
|
|
||||||
if SearchedFilename<>'' then begin
|
if SearchedFilename<>'' then begin
|
||||||
// open the file in the source editor
|
// open the file in the source editor
|
||||||
Ext:=lowercase(ExtractFileExt(SearchedFilename));
|
Ext:=lowercase(ExtractFileExt(SearchedFilename));
|
||||||
if (not FilenameIsFormText(SearchedFilename)) and (Ext<>'.lpi') then begin
|
if (not FilenameIsFormText(SearchedFilename)) and (Ext<>'.lpi') then begin
|
||||||
Result:=(DoOpenEditorFile(SearchedFilename,-1,[ofOnlyIfExists])=mrOk);
|
Result:=(DoOpenEditorFile(SearchedFilename,-1,OpenFlags)=mrOk);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
// set caret position
|
// set caret position
|
||||||
SourceNotebook.AddJumpPointClicked(Self);
|
SourceNotebook.AddJumpPointClicked(Self);
|
||||||
@ -5382,6 +5394,13 @@ begin
|
|||||||
MessagesView.Top-SourceNotebook.Top));
|
MessagesView.Top-SourceNotebook.Top));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.GetTestBuildDir: string;
|
||||||
|
begin
|
||||||
|
Result:=EnvironmentOptions.TestBuildDirectory;
|
||||||
|
if (Result='') then exit;
|
||||||
|
Result:=AppendPathDelim(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.GetProjectTargetFilename: string;
|
function TMainIDE.GetProjectTargetFilename: string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
@ -5413,15 +5432,24 @@ var TestDir: string;
|
|||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
if AnUnitInfo=nil then exit;
|
if AnUnitInfo=nil then exit;
|
||||||
TestDir:=EnvironmentOptions.TestBuildDirectory;
|
TestDir:=GetTestBuildDir;
|
||||||
if (TestDir='') then exit;
|
if TestDir='' then exit;
|
||||||
if TestDir[length(TestDir)]<>PathDelim then
|
|
||||||
TestDir:=TestDir+PathDelim;
|
|
||||||
Result:=ExtractFilename(AnUnitInfo.Filename);
|
Result:=ExtractFilename(AnUnitInfo.Filename);
|
||||||
if Result='' then exit;
|
if Result='' then exit;
|
||||||
Result:=TestDir+Result;
|
Result:=TestDir+Result;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.IsTestUnitFilename(const AFilename: string): boolean;
|
||||||
|
var
|
||||||
|
TestDir: string;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
if Project1.IsVirtual then begin
|
||||||
|
TestDir:=GetTestBuildDir;
|
||||||
|
Result:=CompareFileNames(TestDir,ExtractFilePath(AFilename))=0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.GetRunCommandLine: string;
|
function TMainIDE.GetRunCommandLine: string;
|
||||||
begin
|
begin
|
||||||
if Project1.RunParameterOptions.UseLaunchingApplication
|
if Project1.RunParameterOptions.UseLaunchingApplication
|
||||||
@ -6703,6 +6731,9 @@ end.
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.356 2002/08/29 00:07:00 lazarus
|
||||||
|
MG: fixed TComboBox and InvalidateControl
|
||||||
|
|
||||||
Revision 1.355 2002/08/28 10:44:43 lazarus
|
Revision 1.355 2002/08/28 10:44:43 lazarus
|
||||||
MG: implemented run param environment variables
|
MG: implemented run param environment variables
|
||||||
|
|
||||||
|
|||||||
@ -62,17 +62,27 @@ type
|
|||||||
TIDEToolStatus = (itNone, itBuilder, itDebugger, itCustom);
|
TIDEToolStatus = (itNone, itBuilder, itDebugger, itCustom);
|
||||||
|
|
||||||
|
|
||||||
TSaveFlag = (sfSaveAs, sfSaveToTestDir, sfProjectSaving);
|
TSaveFlag = (sfSaveAs,
|
||||||
|
sfSaveToTestDir,
|
||||||
|
sfProjectSaving
|
||||||
|
);
|
||||||
TSaveFlags = set of TSaveFlag;
|
TSaveFlags = set of TSaveFlag;
|
||||||
|
|
||||||
TOpenFlag = (ofProjectLoading, ofOnlyIfExists, ofRevert, ofQuiet,
|
TOpenFlag = (ofProjectLoading,// this open is part of opening a whole project
|
||||||
ofAddToRecent);
|
ofOnlyIfExists, // do not auto create non existing files
|
||||||
|
ofRevert, // reload file if already open
|
||||||
|
ofQuiet, // less messages
|
||||||
|
ofAddToRecent, // add file to recent files
|
||||||
|
ofRegularFile, // open as regular file (e.g. not a whole project)
|
||||||
|
ofVirtualFile // open the virtual file
|
||||||
|
);
|
||||||
TOpenFlags = set of TOpenFlag;
|
TOpenFlags = set of TOpenFlag;
|
||||||
|
|
||||||
TRevertFlag = (rfQuiet);
|
TRevertFlag = (rfQuiet);
|
||||||
TRevertFlags = set of TRevertFlag;
|
TRevertFlags = set of TRevertFlag;
|
||||||
|
|
||||||
TCloseFlag = (cfSaveFirst, cfProjectClosing);
|
TCloseFlag = (cfSaveFirst, // check if modified and save
|
||||||
|
cfProjectClosing);
|
||||||
TCloseFlags = set of TCloseFlag;
|
TCloseFlags = set of TCloseFlag;
|
||||||
|
|
||||||
TLoadBufferFlag = (lbfUpdateFromDisk, lbfRevert, lbfCheckIfText);
|
TLoadBufferFlag = (lbfUpdateFromDisk, lbfRevert, lbfCheckIfText);
|
||||||
@ -231,7 +241,9 @@ type
|
|||||||
procedure GetCurrentUnit(var ActiveSourceEditor:TSourceEditor;
|
procedure GetCurrentUnit(var ActiveSourceEditor:TSourceEditor;
|
||||||
var ActiveUnitInfo:TUnitInfo); virtual; abstract;
|
var ActiveUnitInfo:TUnitInfo); virtual; abstract;
|
||||||
|
|
||||||
|
function GetTestBuildDir: string; virtual; abstract;
|
||||||
function GetTestUnitFilename(AnUnitInfo: TUnitInfo): string; virtual; abstract;
|
function GetTestUnitFilename(AnUnitInfo: TUnitInfo): string; virtual; abstract;
|
||||||
|
function IsTestUnitFilename(const AFilename: string): boolean; virtual; abstract;
|
||||||
function GetRunCommandLine: string; virtual; abstract;
|
function GetRunCommandLine: string; virtual; abstract;
|
||||||
|
|
||||||
function DoOpenEditorFile(AFileName:string; PageIndex: integer;
|
function DoOpenEditorFile(AFileName:string; PageIndex: integer;
|
||||||
@ -249,10 +261,38 @@ var
|
|||||||
SourceNotebook : TSourceNotebook;
|
SourceNotebook : TSourceNotebook;
|
||||||
Project1: TProject;
|
Project1: TProject;
|
||||||
|
|
||||||
|
const
|
||||||
|
OpenFlagNames: array[TOpenFlag] of string = (
|
||||||
|
'ofProjectLoading',
|
||||||
|
'ofOnlyIfExists',
|
||||||
|
'ofRevert',
|
||||||
|
'ofQuiet',
|
||||||
|
'ofAddToRecent',
|
||||||
|
'ofRegularFile',
|
||||||
|
'ofVirtualFile'
|
||||||
|
);
|
||||||
|
|
||||||
|
function OpenFlagsToString(Flags: TOpenFlags): string;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
function OpenFlagsToString(Flags: TOpenFlags): string;
|
||||||
|
var
|
||||||
|
Flag: TOpenFlag;
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
for Flag:=Low(TOpenFlag) to High(TOpenFlag) do begin
|
||||||
|
if Flag in Flags then begin
|
||||||
|
if Result<>'' then
|
||||||
|
Result:=Result+',';
|
||||||
|
Result:=Result+OpenFlagNames[Flag];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result:='['+Result+']';
|
||||||
|
end;
|
||||||
|
|
||||||
function LoadPixmap(const ResourceName:string): TPixmap;
|
function LoadPixmap(const ResourceName:string): TPixmap;
|
||||||
begin
|
begin
|
||||||
Result:=TPixmap.Create;
|
Result:=TPixmap.Create;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user