Changeset 101 for oup/rewrite/Tools
- Timestamp:
- Feb 20, 2007, 9:43:29 PM (18 years ago)
- Location:
- oup/rewrite/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/rewrite/Tools/Preview.dfm
r93 r101 1 1 inherited Form_Preview: TForm_Preview 2 2 Caption = 'Preview' 3 OnCreate = FormCreate 4 ExplicitWidth = 500 5 ExplicitHeight = 450 3 6 PixelsPerInch = 96 4 7 TextHeight = 13 -
oup/rewrite/Tools/Preview.pas
r97 r101 84 84 procedure TForm_Preview.LoadImage(fileid, index: Integer); 85 85 var 86 Data: TByteData;87 86 memstream: TMemoryStream; 88 87 OniImage: TOniImage; 89 90 88 begin 91 89 OniImage := TOniImage.Create; 92 90 OniImage.Load(ConnectionID, fileid); 93 OniImage.GetAsBMP(Data); 91 memstream := TMemoryStream.Create; 92 OniImage.GetAsBMP(TStream(memstream)); 94 93 OniImage.Free; 95 96 memstream := TMemoryStream.Create;97 memstream.Write(Data[0], Length(Data));98 memstream.Seek(0, soFromBeginning);99 94 bitmaps[index].LoadFromStream(memstream); 100 95 memstream.Free; -
oup/rewrite/Tools/Template.dfm
r97 r101 19 19 OnActivate = FormActivate 20 20 OnClose = FormClose 21 OnResize = FormResize22 21 PixelsPerInch = 96 23 22 TextHeight = 13 … … 247 246 Font.Color = clWindowText 248 247 Font.Height = -11 249 Font.Name = ' Tahoma'248 Font.Name = 'Courier' 250 249 Font.Style = [] 251 250 ItemHeight = 13 -
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.