[theApp registerAccessory:NXUniqueString("Export ALL Documents")
key:'\0'
name:NXUniqueString("ExportAll")
target:[ExportAll new]
action:@selector(exportAll:)];
[theApp registerAccessory:NXUniqueString("Export Open Documents")
key:'\0'
name:NXUniqueString("ExportOpen")
target:[ExportAll new]
action:@selector(exportOpen:)];
[theApp registerAccessory:NXUniqueString("Print Open Documents")
key:'\0'
name:NXUniqueString("PrintAll")
target:[ExportAll new]
action:@selector(printAll:)];
return self;
}
- init {return [super init];}
- free {return self;}
- exportOpen:sender
{
char path[MAXPATHLEN];
char newPath[MAXPATHLEN];
const char *docdir;
long key;
id doc;
NXHashState state;
id docTable;
int choice, fmt;
choice = NXRunAlertPanel("Export All","What format would you like to export all open, untouched (current .etfd on disk) documents to?", "HTML","LaTeX","ASCII");
switch (choice) {
case NX_ALERTDEFAULT: fmt = HTMD_FMT; break;
case NX_ALERTALTERNATE: fmt = TeXD_FMT; break;
case NX_ALERTOTHER: fmt = ASCII_FMT; break;
}
docTable= [[NXApp etApp] docTable];
state = [docTable initState];
while ([docTable nextState: &state key:(void **)&key value:(void **)&doc] &&
!NXUserAborted()) {
if (![doc needsSaving]) {
strcpy(path, [[doc docInfo] docPath]);
// CRITICALLY IMPORTANT: come up with a virgin path for each format