Utility functions for OpenAlias. These functions do not belong to a class.
#include <AlLiveData.h>
Enumeration types:
typedef enum {
kFileBrowseRead,
kFileBrowseWrite
} AlFileBrowseMode;
typedef enum {
kOK_Cancel,
kYes_No_Cancel,
kOK_Only,
kYes_No
} AlConfirmType;
typedef enum {
kOK,
kYes,
kNo,
kCancel
} AlAnswerType;
void AlAllowMenuRebuilds( boolean );
void AlRebuildMenus( void );
void AlResetAllMenus( void );
statusCode AlDebugResetOptionBox( const char * );
const char* AlInvokeSchemeCommand( const char * );
const char* AlInvokeSchemeFile( const char*, const char * = NULL );
statusCode AlFileBrowser( AlFileBrowseMode, char **, const char *,
boolean, const char * );
statusCode AlFileBrowser( AlFileBrowseMode, char **, const char *,
boolean, const char *, const char * );
boolean AlEscapeKeyPressed( void );
statusCode AlPromptBox( AlConfirmType, char*, AlAnswerType*, short, short );
statusCode AlScrollablePromptBox( AlConfirmType , char *, char *,
AlAnswerType * );
statusCode AlStringPromptBox( AlConfirmType type, char *,
AlAnswerType *,char *& );
statusCode AlGetInteger( const char *, int& );
statusCode AlGetDouble( const char *, double& );
statusCode AlGetString( const char *, const char *& );
statusCode AlSetInteger( const char *, int );
statusCode AlSetDouble( const char *, double );
statusCode AlSetString( const char *, const char* );
void AlPrintf( unsigned int, const char*, ... );
void AlVprintf( unsigned int, const char*, va_list ap );
char *makeAltPath(const char *dirName, const char *suffix);
const char* AlInvokeSchemeFile( const char * filename, const char *filenamePrefix )
Executes a Scheme file and returns back the string from the execution. NULL is returned if the file could not be found. Usually an empty string indicates success. This routine will also search in a "scm" subdirectory for the filename. This feature allows existing plug-ins to keep working with the new "scm" subdirectory setup being used.
statusCode AlGetString( const char * name, const char *& value )
statusCode AlPromptBox( AlConfirmType type, char *msg, AlAnswerType* answer,short x, short y )
Invokes a dialog box, prompting the user for confirmation. The width of the dialog box is set to accommodate the longest sentence in the specified message (msg). Sentences in 'msg' should be delineated by new-line characters (that is, '\n'). To invoke the dialog box at the current cursor location, pass in -1 and -1 for x and y.
statusCode /*::*/ AlScrollablePromptBox( AlConfirmType type, char *msg, char *scrollMsg, AlAnswerType *answer )
Bring up a dialog box, prompting the user for confirmation. The width of the confirm box will be set to accommodate the longest sentence in ’staticMsg’. Sentences in ’staticMsg’ should be delineated by new-line characters, that is, ’\n’. A scrollable widget will contain the text of ’scrollMsg’. Sentences in ’scrollMsg’ should also be delineated with new-line characters. The width of the scrollable widget is fixed and does not grow with the size of the confirm box. The dialog box will come up at the current cursor location. Use this method to display short fixed messages above a longer free-form message.
statusCode /*::*/ AlStringPromptBox( AlConfirmType type,char *msg, AlAnswerType *answer, char *& msgResponse )
Bring up a dialog box which allows the user to prompt for a user string response. Instructions to the user can be specified with the ’msg’ parameter.
Notes:
1. The dialog box will come up at the current cursor location.
2. The msgResponse string is owned by Alias and should not be freed by the API application.
3. If several calls to this function will be done one after the other, then the msgResponse should be copied since it will be overwritten in the following call.
< type - the type of prompt box to create
< msg - static text information for the user
> answer - a code for which button was pressed
> msgResponse - the text that the user entered
statusCode AlFileBrowser( AlFileBrowseMode mode, char **returnFilename, const char *acceptString, boolean showSample, const char *fileExtension )
Prompts the user with a file browser to select a filename.
If the mode is kFileBrowseWrite, then the browser will prompt the user with a blank filename.
The browser will allocate a string (using strdup) for the return filename and point ’returnFilename’ to it. It is up to the caller to free it, using ’free()’.
The ’acceptString’ is the text that is printed on the accept button. This will be a string such as "Load", "Okay", "Accept" and so on.
Example code char *filename; statusCode stat = AlFileBrowser( kFileBrowseRead, &filename, "Okay String", FALSE, "myextension" ); if( stat == sSuccess ) { .. do something with filename ... free( filename ); }
< mode - this is either kFileBrowseRead or kFileBrowseWrite
> returnFilename - address of the string pointer that is to be set to the file name
< acceptString - the non-NULL string that is printed on the ’accept’ button
< showSample - if TRUE, icon sized samples of the data files will be shown
< fileExtension - the extension for the file. Setting this has no effect.
statusCode /*::*/ AlFileBrowser( AlFileBrowseMode mode, char **returnFilename, const char *acceptString, boolean showSample, const char *fileExtension, const char *defaultPath )