Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/DiscRecording/DataBurn with File Events
Required plugins for this example: MBS MacBase Plugin, MBS MacControls Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/DiscRecording/DataBurn with File Events
This example is the version from Sun, 17th Mar 2012.
Project "DataBurn with File Events.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open()
dim track as DRTrackMBS
dim bsp as DRBurnSetupPanelMBS
dim bpp as DRBurnProgressPanelMBS
// we need a track
track=CreateTrack
if track<>nil then
bsp=new DRBurnSetupPanelMBS
// set a few options
bsp.setCanSelectAppendableMedia true
bsp.setCanSelectTestBurn true
if bsp.runSetupPanel=bsp.NSOKButton then
bpp=new DRBurnProgressPanelMBS
// And start off the burn itself. This will put up the progress dialog
// and do all the nice pretty things that a happy app does.
bpp.beginProgressPanelForBurn bsp.burnObject, track
else
MsgBox "You pressed cancel."
end if
end if
End EventHandler
Function CreateTrack() As DRTrackMBS
dim t as DRTrackMBS
dim childfolder,folder as DRFolderMBS
dim file1,file2 as DRFileMBS
dim file as MyDRFileMBS
// make root folder
folder=DRFolderMBS.virtualFolderWithName("Root") // this will name the disc
childfolder=DRFolderMBS.virtualFolderWithName("Childfolder")
folder.addChild childfolder
file1=DRFileMBS.virtualFileWithName("Hello World", "Hello World Content")
file2=DRFileMBS.virtualFileWithName("Hello World", "Hello World Content")
folder.addChild file1
childfolder.addChild file2
file=new MyDRFileMBS("test.txt")
folder.addChild file
t=DRTrackMBS.trackForRootFolder(folder)
Return t
End Function
End Class
Class Window1 Inherits Window
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MyDRFileMBS Inherits DRFileMBS
EventHandler Function calculateSizeOfFile(fork as integer, estimating as boolean) As uint64
if fork=1 then // ResourceFork
Return 0
else
Return 12345678
end if
End EventHandler
EventHandler Function prepareFileForBurn() As boolean
position=0
Return true
End EventHandler
EventHandler Function prepareFileForVerification() As boolean
position=0
Return true
End EventHandler
EventHandler Function produceFile(fork as integer, buffer as memoryblock, Bufferlen as uint32, address as uint64, blocksize as uint32) As uint32
dim offset as integer
if fork=0 then // data fork
while offset<Bufferlen
buffer.Byte(offset)=(65+offset mod 26)
offset=offset+1
wend
end if
Return offset
End EventHandler
Property position As Integer
End Class
End Project
See also:
- /MacCocoa/DiscRecording/DataBurn
- /MacCocoa/DiscRecording/DataBurn Image
- /MacCocoa/DiscRecording/DataBurn UDF
- /MacCocoa/DiscRecording/DataBurn with Events
- /MacCocoa/DiscRecording/DataBurn with Events and Notification
- /MacCocoa/DiscRecording/DataBurn with links
- /MacCocoa/DiscRecording/DataBurn with Track Events
- /MacCocoa/DiscRecording/DataBurn with Track Events with ISRC and MCN
The items on this page are in the following plugins: MBS MacCocoa Plugin.