Login | ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/plumbers/trunk/SceneEditor/Unit1.pas
(Generate patch)

Comparing trunk/SceneEditor/Unit1.pas (file contents):
Revision 13 by daniel-marschall, Wed Oct 4 21:37:56 2017 UTC vs.
Revision 14 by daniel-marschall, Sun Oct 8 09:49:24 2017 UTC

# Line 20 | Line 20 | uses
20    Menus;
21  
22   const
23 <  CUR_VER = '2017-10-04';
23 >  CUR_VER = '2017-10-08';
24  
25   type
26    TForm1 = class(TForm)
# Line 1054 | Line 1054 | var
1054   begin
1055    if ListBox3.ItemIndex = -1 then exit;
1056    fileName := IncludeTrailingPathDelimiter(CurScene^.szSceneFolder) + ListBox3.Items[ListBox3.ItemIndex];
1057 <  Image3.Visible := FileExists(FileName);
1058 <  if not FileExists(FileName) then exit;
1059 <  Image3.Picture.LoadFromFile(Filename);
1060 <  AspectRatio(Image3, Panel3);
1057 >
1058 >  if not FileExists(FileName) then
1059 >  begin
1060 >    Image3.Visible := false;
1061 >    exit;
1062 >  end;
1063 >
1064 >  try
1065 >    Image3.Picture.LoadFromFile(Filename);
1066 >    AspectRatio(Image3, Panel3);
1067 >    Image3.Visible := true;
1068 >  except
1069 >    Image3.Visible := false;
1070 >    // It could also be a sound file, so we do not show errors
1071 >  end;
1072   end;
1073  
1074   procedure TForm1.ListBox3DblClick(Sender: TObject);
# Line 1168 | Line 1179 | var
1179    i, idx: integer;
1180    SR: TSearchRec;
1181    ext: string;
1182 +  sl: TStringList;
1183 +  s: string;
1184   begin
1185 <  ListBox3.Items.BeginUpdate;
1185 >  sl := TStringList.Create;
1186    try
1174    ListBox3.Clear;
1175
1176    Image3.Visible := false;
1177
1187      if FindFirst(IncludeTrailingPathDelimiter(CurScene^.szSceneFolder) + '*.*', faArchive, SR) = 0 then
1188      begin
1189        repeat
1190          ext := UpperCase(ExtractFileExt(SR.Name));
1191          if ((ext <> '.PK' {Adobe Audition}) and (ext <> '.DB' {Windows Thumbnail})) then
1192          begin
1193 <          ListBox3.Items.Add(SR.Name); //Fill the list
1193 >          sl.Add(SR.Name); //Fill the list
1194          end;
1195        until FindNext(SR) <> 0;
1196        FindClose(SR);
# Line 1190 | Line 1199 | begin
1199      // Remove the entries which are present
1200      for i := CurScene^.pictureIndex to CurScene^.pictureIndex+CurScene^.numPics-1 do
1201      begin
1202 <      idx := ListBox3.Items.IndexOf(Game.pictures[i].szBitmapFile);
1203 <      if idx <> -1 then ListBox3.Items.Delete(idx);
1202 >      idx := sl.IndexOf(Game.pictures[i].szBitmapFile);
1203 >      if idx <> -1 then sl.Delete(idx);
1204      end;
1205  
1206 <    idx := ListBox3.Items.IndexOf(Edit1.Text);
1207 <    if idx <> -1 then ListBox3.Items.Delete(idx);
1208 <    idx := ListBox3.Items.IndexOf('E'+Edit1.Text);
1209 <    if idx <> -1 then ListBox3.Items.Delete(idx);
1206 >    idx := sl.IndexOf(Edit1.Text);
1207 >    if idx <> -1 then sl.Delete(idx);
1208 >    idx := sl.IndexOf('E'+Edit1.Text);
1209 >    if idx <> -1 then sl.Delete(idx);
1210 >
1211 >    idx := sl.IndexOf(Edit2.Text);
1212 >    if idx <> -1 then sl.Delete(idx);
1213  
1214 <    idx := ListBox3.Items.IndexOf(Edit2.Text);
1215 <    if idx <> -1 then ListBox3.Items.Delete(idx);
1214 >    idx := sl.IndexOf(Edit3.Text);
1215 >    if idx <> -1 then sl.Delete(idx);
1216  
1217 <    idx := ListBox3.Items.IndexOf(Edit3.Text);
1218 <    if idx <> -1 then ListBox3.Items.Delete(idx);
1217 >    if sl.Text <> ListBox3.Items.Text then
1218 >    begin
1219 >      i := ListBox3.ItemIndex;
1220 >      if i >= 0 then
1221 >        s := ListBox3.Items.Strings[i]
1222 >      else
1223 >        s := '';
1224 >      ListBox3.Items.Assign(sl);
1225 >      i := ListBox3.Items.IndexOf(s);
1226 >      if i >= 0 then
1227 >        ListBox3.ItemIndex := i
1228 >      else
1229 >        Image3.Visible := false;
1230 >    end;
1231    finally
1232 <    ListBox3.Items.EndUpdate;
1232 >    sl.Free;
1233    end;
1234   end;
1235  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines