fixed renaming of DFM to LFM

git-svn-id: trunk@5109 -
This commit is contained in:
mattias 2004-01-27 10:09:44 +00:00
parent b19aece6b6
commit 011075cc95
3 changed files with 49 additions and 14 deletions

View File

@ -58,7 +58,8 @@ var
function CheckDelphiFileExt(const Filename: string): TModalResult;
function CheckFilenameForLCLPaths(const Filename: string): TModalResult;
function ConvertDelphiToLazarusFilename(const DelphiFilename: string): string;
function ConvertDFMToLFMFilename(const DFMFilename: string): string;
function ConvertDFMToLFMFilename(const DFMFilename: string;
KeepCase: boolean): string;
function FindDFMFileForDelphiUnit(const DelphiFilename: string): string;
function RenameDelphiUnitToLazarusUnit(const DelphiFilename: string;
RenameDFMFile: boolean): TModalResult;
@ -126,13 +127,16 @@ begin
+lowercase(ExtractFileName(DelphiFilename));
end;
function ConvertDFMToLFMFilename(const DFMFilename: string): string;
function ConvertDFMToLFMFilename(const DFMFilename: string;
KeepCase: boolean): string;
begin
if DFMFilename<>'' then
Result:=ExtractFilePath(DFMFilename)
+lowercase(ExtractFilenameOnly(DFMFilename))
+'.lfm'
else
if DFMFilename<>'' then begin
// platform and fpc independent unitnames are lowercase, so are the lfm files
Result:=lowercase(ExtractFilenameOnly(DFMFilename));
if KeepCase then
Result:=ExtractFilenameOnly(DFMFilename);
Result:=ExtractFilePath(DFMFilename)+Result+'.lfm';
end else
Result:='';
end;
@ -159,7 +163,7 @@ begin
if RenameDFMFile then begin
DFMFilename:=FindDFMFileForDelphiUnit(DelphiFilename);
if DFMFilename<>'' then begin
LFMFilename:=ConvertDFMToLFMFilename(DFMFilename);
LFMFilename:=ConvertDFMToLFMFilename(DFMFilename,false);
Result:=RenameFileWithErrorDialogs(DFMFilename,LFMFilename,[mbAbort]);
if Result<>mrOK then exit;
end;
@ -197,7 +201,8 @@ begin
exit;
end;
end;
LFMFilename:=ConvertDFMToLFMFilename(DFMFilename);
// converting dfm file, without renaming unit -> keep case
LFMFilename:=ConvertDFMToLFMFilename(DFMFilename,true);
try
LFMStream.SaveToFile(LFMFilename);
except

View File

@ -562,7 +562,7 @@ begin
if FirstModal=AllWindows.Count then begin
// there is no modal window
// -> break all transient window relation ships
for i:=0 to AllWindows.Count-1 do begin
for i:=AllWindows.Count-1 downto 0 do begin
ATransientWindow:=PTransientWindow(AllWindows[i]);
{$IFDEF VerboseTransient}
write('TgtkObject.UpdateTransientWindows Untransient ',i);
@ -604,10 +604,12 @@ begin
for i:=0 to AllWindows.Count-1 do begin
ATransientWindow:=PTransientWindow(AllWindows[i]);
if (ATransientWindow^.Component<>nil)
and GTK_WIDGET_VISIBLE(PgtkWidget(ATransientWindow^.GtkWindow)) then begin
and GTK_WIDGET_VISIBLE(PgtkWidget(ATransientWindow^.GtkWindow)) then
begin
if ParentTransientWindow<>nil then begin
{$IFDEF VerboseTransient}
writeln('Set TRANSIENT Parent=',
writeln('Define TRANSIENT ',
' Parent=',
ParentTransientWindow^.Component.Name,':',
ParentTransientWindow^.Component.ClassName,
' Index=',ParentTransientWindow^.SortIndex,
@ -629,17 +631,36 @@ begin
// do the setup in two separate steps:
// break unneeded transient relationships
for i:=0 to AllWindows.Count-1 do begin
for i:=AllWindows.Count-1 downto 0 do begin
ATransientWindow:=PTransientWindow(AllWindows[i]);
OldTransientParent:=ATransientWindow^.GtkWindow^.transient_parent;
if (OldTransientParent<>ATransientWindow^.TransientParent) then
if (OldTransientParent<>ATransientWindow^.TransientParent) then begin
{$IFDEF VerboseTransient}
writeln('Break old TRANSIENT i=',i,'/',AllWindows.Count,
' OldTransientParent=',HexStr(Cardinal(OldTransientParent),8),
' Child=',ATransientWindow^.Component.Name,':',
ATransientWindow^.Component.ClassName,
' Index=',ATransientWindow^.SortIndex,
' Wnd=',HexStr(Cardinal(ATransientWindow^.GtkWindow),8),
'');
{$ENDIF}
gtk_window_set_transient_for(ATransientWindow^.GtkWindow,nil);
end;
end;
// setup transient relationships
for i:=0 to AllWindows.Count-1 do begin
ATransientWindow:=PTransientWindow(AllWindows[i]);
if ATransientWindow^.TransientParent=nil then continue;
{$IFDEF VerboseTransient}
writeln('Set TRANSIENT i=',i,'/',AllWindows.Count,
' Child=',ATransientWindow^.Component.Name,':',
ATransientWindow^.Component.ClassName,
' Index=',ATransientWindow^.SortIndex,
' Wnd=',HexStr(Cardinal(ATransientWindow^.GtkWindow),8),
' Parent=',HexStr(Cardinal(ATransientWindow^.TransientParent),8),
'');
{$ENDIF}
gtk_window_set_transient_for(ATransientWindow^.GtkWindow,
ATransientWindow^.TransientParent);
end;
@ -9203,6 +9224,9 @@ end;
{ =============================================================================
$Log$
Revision 1.456 2004/01/27 10:09:44 mattias
fixed renaming of DFM to LFM
Revision 1.455 2004/01/23 13:55:30 mattias
style widgets are now realized, so all values are initialized

View File

@ -2502,6 +2502,9 @@ var
begin
if (ADialog=nil) or (not ADialog.HandleAllocated) then exit;
DlgWindow:=PGtkWidget(ADialog.Handle);
{$IFDEF VerboseTransient}
writeln('DestroyCommonDialogAddOns ',ADialog.Name,':',ADialog.ClassName);
{$ENDIF}
gtk_window_set_transient_for(PGtkWindow(DlgWindow),nil);
if ADialog is TOpenDialog then begin
@ -6210,6 +6213,9 @@ end;
{ =============================================================================
$Log$
Revision 1.250 2004/01/27 10:09:44 mattias
fixed renaming of DFM to LFM
Revision 1.249 2004/01/26 11:55:35 mattias
fixed resizing synedit