Changeset 101 for oup/rewrite/Tools/Template.pas
- Timestamp:
- Feb 20, 2007, 9:43:29 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/rewrite/Tools/Template.pas
r97 r101 54 54 Shift: TShiftState; X, Y: Integer); 55 55 56 procedure FormResize(Sender: TObject);57 56 procedure FormClose(Sender: TObject; var Action: TCloseAction); 58 57 procedure popup_importClick(Sender: TObject); … … 220 219 fs: TFileStream; 221 220 begin 222 id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); 223 finfo := ConManager.Connection[FConnectionID].GetFileInfo(id); 224 225 importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' + 226 finfo.Extension + '|All files|*.*'; 227 if importd.Execute then 228 begin 229 fs := TFileStream.Create(importd.FileName, fmOpenRead); 230 if fs.Size <> finfo.Size then 231 ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + 232 ', file has to have same size as file in .dat.' + CrLf + 233 'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf + 234 'Size of chosen file: ' + FormatFileSize(fs.Size)) 235 else begin 221 if CR_EditDat in ConManager.Connection[FConnectionID].ChangeRights then 222 begin 223 id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); 224 finfo := ConManager.Connection[FConnectionID].GetFileInfo(id); 225 226 importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' + 227 finfo.Extension + '|All files|*.*'; 228 if importd.Execute then 229 begin 230 fs := TFileStream.Create(importd.FileName, fmOpenRead); 231 if fs.Size <> finfo.Size then 232 begin 233 if not (CR_ResizeDat in ConManager.Connection[FConnectionID].ChangeRights) then 234 begin 235 ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + 236 ', file has to have same size as file in .dat with this backend.' + CrLf + 237 'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf + 238 'Size of chosen file: ' + FormatFileSize(fs.Size)); 239 Exit; 240 end else begin 241 if MessageBox(Self.Handle, 242 PChar('File has different size from the file in the .dat.' + CrLf + 243 'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf + 244 'Size of chosen file: ' + FormatFileSize(fs.Size) + CrLf + 245 'Replace anyway?'), PChar('Different size'), MB_YESNO + MB_ICONWARNING) = ID_NO then 246 begin 247 Exit; 248 end; 249 end; 250 end; 236 251 ConManager.Connection[FConnectionID].UpdateDatFile(id, fs); 237 252 Self.listClick(Self); 253 fs.Free; 238 254 end; 239 fs.Free; 255 end else begin 256 ShowMessage('Editing .dat-contents not allowed with this backend.'); 240 257 end; 241 258 end; … … 449 466 450 467 451 procedure TForm_ToolTemplate.FormResize(Sender: TObject);452 begin453 if Self.Width < 300 then454 Self.Width := 300;455 if Self.Height < 200 then456 Self.Height := 200;457 end;458 459 460 461 468 function TForm_ToolTemplate.GetToolCloseable: Boolean; 462 469 begin
Note:
See TracChangeset
for help on using the changeset viewer.