This is ConvertController.h in view mode; [Download] [Up]
/***********************************************************************\
Common class for subclass Controller in all Convert programs
Copyright (C) 1993 David John Burrowes
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author, David John Burrowes, can be reached at:
davidjohn@kira.net.netcom.com
David John Burrowes
1926 Ivy #10
San Mateo, CA 94403-1367
\***********************************************************************/
#import "ResultObject.h"
#import "common.h"
#import "ProgressIndicator.h"
// NSmajor defined in common.
#if (NSmajor == 2)
# import <appkit/defaults.h>
#else
# import <defaults/defaults.h>
#endif
@interface ConvertController:ResultObject
{
id ProgressWindow; // Window where our progress will be displayed
id SourceFileName; // object where name of paint file being convertes is shown
id DestFileName; // object which deals with displaying the name of the EPS file
id Status; // object which deals with displaying status info (e.g. errors)
id DestPath;
id SourcePath;
id ProgressMeter;
id SourceTitle;
id SourcePathTitle;
id DestTitle;
id DestPathTitle;
id StatusTitle;
id prefPanel; // the panel which displays the preferences values for the user
id listener; // The listener instance that we use for receiving docs from wkspce
id decisionWindow;
id decisionText; // The text of why the file was judged imperfect.
id converterInst;
//
// Menus cells. So we can dim them at the right times
//
id quitCommand;
id hideCommand;
id infoCommands;
id editCommands;
id servicesCommands;
id windowsCommands;
//
// These are all enabled only when file dialogs are up. That's the only time the user
// should be wanting to modify text.
//
id cutCommand;
id pasteCommand;
id spellingCommand;
id checkSpellingCommand;
CString ConversionString;
CString SourcePrompt, DestPrompt, DestExtension, DefaultsOwner;
CString SourceExtension; // Unused at the moment
CString filePaths; // A string of files that are being dragged-and-dropped
CString AppHome;
Real lastPercent; // Stores the last percentage we had for the progress meter
Boolean cancelResult; // Indicates what decision the user made (whether to continue the conversion or cancel it
Boolean destIsDead; // An ugly hack. For when converter has closed the dest file.
}
//
// For delegate responsibilities
//
- appWillInit: sender;
- appDidInit: sender;
- appWillTerminate: sender;
- (BOOL) appAcceptsAnotherFile:sender;
- (int)app:sender openFile:(const char *)filename type:(const char *)aType;
//
// For speaker-listener delgation stuff (drag and drop)
//
- (int)iconEntered:(int)windowNum at:(double)x :(double)y
iconWindow:(int)iconWindowNum iconX:(double)iconX iconY:(double)iconY
iconWidth:(double)iconWidth iconHeight:(double)iconHeight
pathList:(char *)pathList;
- (int)iconReleasedAt:(double)x :(double)y ok:(int *)flag;
- (int)iconExitedAt:(double)x :(double)y;
#if (NSmajor == 3)
//
// For NS 3.0 drag and drop stuff
//
- (NXDragOperation)draggingEntered:(id)sender;
- (NXDragOperation)draggingUpdated:(id)sender;
- (BOOL)prepareForDragOperation:(id)sender;
- (BOOL)performDragOperation:(id)sender;
- concludeDragOperation:(id)sender;
- draggingExited:(id)sender;
#endif
//
// Utilities for the above
//
- allowDragAndDrop;
- refuseDragAndDrop;
- ProcessDroppedFiles; // behaves at much the same layer as PrepareForConversion, below.
//
// Methods to support simple converter-as-slave dialog.
//
- (int)msgQuit:(int *)flag;
- msgConvert: (char *) sourceFile To: (char*) destFile;
//
// the main guts of the class...
//
- init; // Override this in subclasses. (must open convertInst convert instance)
-free;
- displayPreferences: sender; // Override this in subclasses (if one has prefs to disply)
- (CString) GetPref: (ConstCString) thePreference;
- SetPref: (ConstCString) thePreference To: (CString) value;
- SetBoolPref: (ConstCString) thePreference To: (Boolean) value;
- (Boolean) GetBoolPref: (ConstCString) thePreference;
- SetPercentageDone: (Real) percentage;
- openDestFile: (roCString) theFile; // Override these in sub. if need to open non File files
- openSourceFile: (roCString) theFile; // Unlike others, Do NOT call [super...]
- closeSourceFile: fileInstance; // if overrode above, then override these
- closeDestFile: fileInstance andDelete: (Boolean) deleteit; // also don't [super ...]
- preConversion; // might want to subclass these (but no more likely not)
- postConversion;
- (Boolean) CheckFileOK: fileInst;
- UserDecided: sender;
- PrepareForConversion: sender;
- ConvertThisFile: (roCString) theFile;
- DoConversionFrom: sourceFile To: destinationFile;
- ConvertFrom: sourceFile To: destinationFile; // Must override
@end
//
// Errors:
//
#define ERR_USERABORTED 10001
#define ERR_TRIEDTOOVERWRITE 10002
#define ERR_CREATEFAILED 10003
#define ERR_OPENFAILED 10004
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.