Changeset 121 for trunk/UCore.pas


Ignore:
Timestamp:
Feb 22, 2022, 11:07:27 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Improved compare dialog to show text compare of vcard data.
  • Modified: Both compare sides now have scrollbar synced.
  • Modified: Compare panels keep horizontal size ratio during window resize.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r120 r121  
    8888    LastContactTabIndex: Integer;
    8989    LastContactFileName: string;
     90    LastCompareFileName: string;
    9091    LastPhotoFileName: string;
    9192    LastPropertyValueFileName: string;
     
    171172var
    172173  TempFile: TDataFile;
    173   LeftContacts: TContactsFile;
    174   RightContacts: TContactsFile;
     174  TempFileName: string;
    175175begin
    176176  TempFile := DefaultDataFileClass.Create;
     
    181181  end;
    182182  OpenDialog1.DefaultExt := '';
    183   if Assigned(DataFile) then begin
    184     OpenDialog1.InitialDir := ExtractFileDir(DataFile.FileName);
    185     OpenDialog1.FileName := ExtractFileName(DataFile.FileName);
    186   end;
     183  OpenDialog1.InitialDir := ExtractFileDir(Core.LastCompareFileName);
     184  OpenDialog1.FileName := ExtractFileName(Core.LastCompareFileName);
    187185  OpenDialog1.Options := OpenDialog1.Options - [ofAllowMultiSelect];
    188186  if OpenDialog1.Execute then begin
    189187    with TFormCompare.Create(nil) do
    190188    try
    191       LeftContacts := TContactsFile(DefaultDataFileClass.Create);
    192       RightContacts := TContactsFile(DefaultDataFileClass.Create);
    193       try
    194         LeftContacts.Assign(TContactsFile(DataFile));
    195         LeftSide := LeftContacts;
    196         RightContacts.LoadFromFile(OpenDialog1.FileName);
    197         RightSide := RightContacts;
    198         ShowModal;
    199       finally
    200         LeftContacts.Free;
    201         RightContacts.Free;
    202       end;
     189      TempFileName := GetTempDir + DirectorySeparator + Application.Title +
     190        DirectorySeparator + 'Compare' + VCardFileExt;
     191      ForceDirectories(ExtractFileDir(TempFileName));
     192      TContactsFile(DataFile).SaveToFile(TempFileName);
     193      LoadFileLeft(TempFileName);
     194      LoadFileRight(OpenDialog1.FileName);
     195      ShowModal;
    203196    finally
    204197      Free;
    205198    end;
     199    Core.LastCompareFileName := OpenDialog1.FileName;
    206200  end;
    207201end;
     
    532526    MapUrl := ReadStringWithDefault('MapUrl', 'https://www.openstreetmap.org/search?query=');
    533527    LastPhotoFileName := ReadStringWithDefault('LastPhotoFileName', '');
     528    LastCompareFileName := ReadStringWithDefault('LastCompareFileName', '');
    534529  finally
    535530    Free;
     
    558553    WriteString('MapUrl', MapUrl);
    559554    WriteString('LastPhotoFileName', LastPhotoFileName);
     555    WriteString('LastCompareFileName', LastCompareFileName);
    560556  finally
    561557    Free;
Note: See TracChangeset for help on using the changeset viewer.