home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************
- *
- * MAIN.C
- *
- **************************************************************/
-
- #define MIN_ZOOM 1 /* minimum zooming factor */
- #define MAX_ZOOM 4 /* maximum zooming factor */
-
- #include <acs.h>
- #include <acsplus.h>
- #include <tos.h> /* because of Dgetpath(), ... */
- #include <string.h> /* because of strrchr(), ... */
- #include <messages.pif> /* for use of self-built library */
- #include <acs_plus.pif> /* for use of self-built library */
- #include <diskfile.pif> /* for use of self-built library */
- #include <notimtab.pif> /* for use of self-built library */
-
- Awindow *MAIN_constructor(void *not_used) ;
- void MAIN_destructor(Awindow *wi) ;
- static int cdecl draw(PARMBLK *parmblk) ;
-
- #include "main.h"
- #include "main.ah"
- #include "printer\printer.pif"
- #include "drawer\drawer.pif"
- #include "params\params.pif"
- #include "filter\filter.pif"
- #include "info\info.pif"
-
-
- /*************** GLOBAL VARIABLES BEGIN **************************/
-
- /*** VDI handle and parameters of virtual screen workstation ***/
- static int screen_handle ;
- static int screen_in[11] ;
- static int screen_out[57] ;
- static int number_screen_fonts ;
- static FONT_INFO screen_font_info[MAX_FONTS] ;
-
- /*** VDI handle and parameters of physical printer workstation ***/
- static int print_handle ;
- static int print_in[11] ;
- static int print_out[57] ;
- static int number_print_fonts ;
-
- /*** path where to search for files, for all instances together ***/
- static char path[pathname_length] ;
-
- /*** counter for number of constructor calls ***/
- int incarnation_counter = 0 ;
-
- /*************** GLOBAL VARIABLES END ****************************/
-
- /************* OBJECT DATA PROTOTYPE BEGIN ***********************/
-
- typedef struct
- {
- Awindow *params_wi, *filter_wi, *info_wi, *drawer_wi, *printer_wi ;
- char filename[filename_length], pathname[pathname_length] ;
- void *RAM_file ;
- long filesize ;
- int zoom ;
- }
- MAIN ;
-
- /************* OBJECT DATA PROTOTYPE END *************************/
-
-
- /*******************************************************************
- */
- static void keys(Awindow *wi, int kstate, int key)
- /*
- * Keyboard procedure of the main window, see also ACS manual.
- * This procedure simply forwards events to the service procedure
- * of the main window and to the ACS default kayboard procedure.
- *
- *******************************************************************/
- {
- /*** treated not here, but in service procedure ***/
- key_message.sender = wi ;
- key_message.kstate = kstate ;
- key_message.key = key ;
- Awi_sendall(KEY_PRESS, &key_message) ;
-
- /*** forward event to ACS for further treatment (e.g. by the desktop) ***/
- Awi_keys(wi, kstate, key) ;
- }
-
- /*******************************************************************
- */
- static void zoom_plus(Awindow *wi)
- /*
- * Zoom in, adapt main window size and redraw.
- *
- *******************************************************************/
- {
- MAIN *m = wi->user ;
-
- if (m->zoom < MAX_ZOOM)
- {
- m->zoom <<= 1 ;
- (wi->work)->ob_height <<= 1 ;
- (wi->work + WORK_OBJ)->ob_height <<= 1 ;
- (wi->work)->ob_width <<= 1 ;
- (wi->work + WORK_OBJ)->ob_width <<= 1 ;
- Awi_sized( wi, &(wi->wi_act) ) ;
- Awi_obchange(wi, WORK_OBJ, -1) ;
- }
- }
-
- /*******************************************************************
- */
- static void zoom_minus(Awindow *wi)
- /*
- * Zoom out, adapt main window size and redraw.
- *
- *******************************************************************/
- {
- MAIN *m = wi->user ;
-
- if (m->zoom > MIN_ZOOM)
- {
- m->zoom >>= 1 ;
- (wi->work)->ob_height >>= 1 ;
- (wi->work + WORK_OBJ)->ob_height >>= 1 ;
- (wi->work)->ob_width >>= 1 ;
- (wi->work + WORK_OBJ)->ob_width >>= 1 ;
- Awi_sized( wi, &(wi->wi_act) ) ;
- Awi_obchange(wi, WORK_OBJ, -1) ;
- }
- }
-
- /*******************************************************************
- */
- static int sender_test(Awindow *wi, Awindow *sender)
- /*
- * Returns TRUE if the sender window belongs to the own
- * incarnation, FALSE else.
- *
- *******************************************************************/
- {
- MAIN *m = wi->user ;
-
- if ( (sender == m->info_wi) || (sender == m->filter_wi) ||
- (sender == m->params_wi) || (sender == m->drawer_wi) ||
- (sender == m->printer_wi) || (sender == wi) ) return TRUE ;
- else return FALSE ;
- }
-
- /*******************************************************************
- */
- static int service(Awindow *wi, int task, void *in_out)
- /*
- * Service procedure of the main window, see also ACS manual.
- *
- *******************************************************************/
- {
- MAIN *m = wi->user ;
-
- switch (task)
- {
- /*** ACS generated messages ***/
- case AS_INFO: A_dialog(&MAIN_INFO) ; break ;
- case AS_TERM:
- if (appexit || (alert_str(QUIT, m->filename) == 1)) MAIN_destructor(wi) ;
- break ;
- /*** own messages ***/
- case TERMINATE:
- if (appexit) return FALSE ; /* treated under AS_TERM */
- if ( !sender_test(wi, (Awindow *)in_out) ) return FALSE ;
- if (alert_str(QUIT, m->filename) == 1) MAIN_destructor(wi) ;
- break ;
- case REDRAW:
- if ( !sender_test(wi, (Awindow *)in_out) ) return FALSE ;
- stop_timer(in_out) ; /* stop delayed redraw timer job */
- redraw( m->drawer_wi ) ; /* redraw immediately */
- break ;
- case KEY_PRESS:
- if ( !sender_test(wi, ( (KEY_MESSAGE *)in_out )->sender) ) return FALSE ;
- switch( ( ( (KEY_MESSAGE *)in_out )->key & 0xFF00) )
- {
- case 0x4E00: /* "+" pressed on num. block */
- case 0x1B00: /* "+" pressed */
- zoom_plus(wi) ; break ;
- case 0x4A00: /* "-" pressed on num. block */
- case 0x3500: /* "-" pressed */
- zoom_minus(wi) ; break ;
- case 0x4800: /* arrow up pressed */
- select_page(m->drawer_wi, first) ; break ;
- case 0x5000: /* arrow down pressed */
- select_page(m->drawer_wi, last) ; break ;
- case 0x4B00: /* arrow left pressed */
- select_page(m->drawer_wi, previous) ; break ;
- case 0x4D00: /* arrow right pressed */
- select_page(m->drawer_wi, next) ; break ;
- }
- break ;
- case ZOOM_PLUS:
- if ( !sender_test(wi, (Awindow *)in_out) ) return FALSE ;
- zoom_plus(wi) ;
- break ;
- case ZOOM_MINUS:
- if ( !sender_test(wi, (Awindow *)in_out) ) return FALSE ;
- zoom_minus(wi) ;
- break ;
- default: return FALSE ;
- }
- return TRUE ;
- }
-
-
- /******************************************************************
- */
- static int cdecl draw(PARMBLK *parmblk)
- /*
- * GEM drawing routine for the user defined
- * GEM object in the main window.
- *
- *******************************************************************/
- {
- MAIN *m = (MAIN *)parmblk->pb_parm ;
- int points[4] ;
-
- /*** set clipping rectangle ***/
- points[0] = parmblk->pb_xc ;
- points[1] = parmblk->pb_yc ;
- points[2] = points[0] + parmblk->pb_wc - 1 ;
- points[3] = points[1] + parmblk->pb_hc - 1 ;
- vs_clip(screen_handle, 1, points) ;
-
- /*** draw background ***/
- vsf_color(screen_handle, WHITE) ;
- vr_recfl(screen_handle, points) ;
-
- /*** draw note systems ***/
- if (m->drawer_wi)
- draw_page( screen_handle, m->drawer_wi, parmblk->pb_x, parmblk->pb_y,
- points, m->zoom, get_current_page(m->drawer_wi) ) ;
- /*** reset clipping ***/
- vs_clip(screen_handle, 0, points) ;
-
- /*** return object state unchanged ***/
- return(parmblk->pb_prevstate) ;
- }
-
-
- /********************************************************************
- */
- static void MAIN_destructor(Awindow *wi)
- /*
- * Destructor of the MAIN object. It
- * frees all memory used by ACS and own data instances.
- *
- ********************************************************************/
- {
- MAIN *m ;
-
- /*** incarnation counter: here a work-around. ACS sends messages
- to windows already deleted ?! ***/
- if (wi && incarnation_counter) {
- m = wi->user ;
- if (m) {
- /*** instances of sub-objects ***/
- PRINTER_destructor(m->printer_wi) ;
- DRAWER_destructor(m->drawer_wi) ;
- PARAMS_destructor(m->params_wi) ;
- FILTER_destructor(m->filter_wi) ;
- INFO_destructor(m->info_wi) ;
-
- /*** own object instance ***/
- if (m->RAM_file) unload_file(m->RAM_file) ;
- memory_symptom = "MaDstr wi->user" ;
- My_free(m) ; m = NULL ;
- }
- /*** own window ***/
- memory_symptom = "MaDstr wi" ;
- Awi_delete(wi) ;
- incarnation_counter-- ;
- }
- }
-
-
- /******************************************************************
- */
- static Awindow *MAIN_constructor(void *MIDIfile)
- /*
- * Constructor of the MAIN window (incl. all sub-windows).
- *
- *******************************************************************/
- {
- Awindow *wi ;
- MAIN *m ;
- PRINTER_INIT printer_init ;
- DRAWER_INIT drawer_init ;
- PARAMS_INIT params_init ;
- FILTER_INIT filter_init ;
- INFO_INIT info_init ;
- char *buffer ;
-
- /*** allocate and init main structure ***/
- m = My_alloc(sizeof *m) ;
- if (!m) return NULL ;
- m->params_wi = m->info_wi = m->drawer_wi = m->printer_wi = m->filter_wi = NULL ;
- m->zoom = 2 ;
-
- /*** if call params. contain a valid filename, take them ***/
- if ( MIDIfile && (ACSblk->argc > 1) )
- {
- strcpy(m->pathname, (char *)MIDIfile) ;
- strcpy(path, (char *)MIDIfile) ;
- buffer = strrchr(path, '\\') ;
- if (!buffer)
- {
- /*** no "\" ==> no valid path ***/
- alert_str(CALL_INVALID, (char *)MIDIfile) ;
- memory_symptom = "MaCstr no slash" ;
- My_free(m) ; return NULL ;
- }
- strcpy(m->filename, buffer + 1) ;
- /*** take away file name and append searching mask "*.MID" */
- buffer[1] = 0 ;
- strcat(path, "*.MID") ;
- }
- /*** else have the program user selected a MIDI file ***/
- else switch ( get_file_name(m->pathname, path, m->filename,
- "Select MIDI file:") )
- {
- case no_file_selected:
- memory_symptom = "MaCstr no f. sel." ;
- My_free(m) ; return NULL ;
- case file_select_error:
- memory_symptom = "MaCstr f.sel.err." ;
- My_free(m) ; alert_str(FILE_SELECT_ERROR, "") ; return NULL ;
- }
- /*** load the selected file into RAM ***/
- if ( load_file(m->pathname, &m->filesize, &m->RAM_file) != file_loaded )
- {
- memory_symptom = "MaCstr load_file" ;
- My_free(m) ; return NULL ;
- }
- /*** choose icon color ***/
- switch (incarnation_counter % 3)
- {
- case 0:
- MAIN_WINDOW.iconblk = &MAIN_ICON0 ;
- info_init.icon = &INFO_ICON0 ;
- filter_init.icon = &FILTER_ICON0 ;
- drawer_init.icon = &DRAWER_ICON0 ;
- params_init.icon = &PARAMS_ICON0 ;
- printer_init.icon = &PRINTER_ICON0 ;
- break ;
- case 1:
- MAIN_WINDOW.iconblk = &MAIN_ICON1 ;
- info_init.icon = &INFO_ICON1 ;
- filter_init.icon = &FILTER_ICON1 ;
- drawer_init.icon = &DRAWER_ICON1 ;
- params_init.icon = &PARAMS_ICON1 ;
- printer_init.icon = &PRINTER_ICON1 ;
- break ;
- default:
- MAIN_WINDOW.iconblk = &MAIN_ICON2 ;
- info_init.icon = &INFO_ICON2 ;
- filter_init.icon = &FILTER_ICON2 ;
- drawer_init.icon = &DRAWER_ICON2 ;
- params_init.icon = &PARAMS_ICON2 ;
- printer_init.icon = &PRINTER_ICON2 ;
- }
- /*** enter filename into icon text and pathname into window info line ***/
- MAIN_WINDOW.iconblk->monoblk.ib_ptext = m->filename ;
- MAIN_WINDOW.name = m->pathname ;
-
- /*** create the MAIN window ***/
- wi = Awi_create(&MAIN_WINDOW) ;
- if (!wi)
- {
- memory_symptom = "MaCstr unload_file" ;
- unload_file(m->RAM_file) ;
- memory_symptom = "MaCstr wi==NULL" ;
- My_free(m) ;
- return NULL ;
- }
- incarnation_counter ++ ;
- wi->user = m ;
- /*** set user def. object width and height ***/
- (wi->work)->ob_height = (wi->work + WORK_OBJ)->ob_height =
- m->zoom * screen_out[1] ;
- if (print_handle)
- (wi->work)->ob_width = (wi->work + WORK_OBJ)->ob_width = m->zoom
- * ( (long)screen_out[1] * print_out[0]/print_out[1] * print_out[3]/print_out[4]) ;
- else (wi->work)->ob_width = (wi->work + WORK_OBJ)->ob_width =
- (float)(m->zoom) * screen_out[1] / 1.41 ;
- /*** INFO object sub-constructor ***/
- info_init.filename = m->filename ;
- info_init.RAM_file = m->RAM_file ;
- info_init.filesize = m->filesize ;
- m->info_wi = INFO_constructor(&info_init) ;
- if (!m->info_wi) { MAIN_destructor(wi) ; return NULL ; }
- if ( get_SMPTE(m->info_wi) ) alert_str(NO_SMPTE, "") ;
- else
- {
- /*** FILTER object sub-constructor ***/
- filter_init.filename = m->filename ;
- filter_init.RAM_file = m->RAM_file ;
- filter_init.filesize = m->filesize ;
- filter_init.ntrks = get_number_of_tracks(m->info_wi) ;
- filter_init.track_filter = on ;
- filter_init.channel_filter = all_channels_on ;
- m->filter_wi = FILTER_constructor(&filter_init) ;
- if (!m->filter_wi) { MAIN_destructor(wi) ; return NULL ; }
- /*** now total transformed size can be displayed in info window ***/
- set_transformed_size( m->info_wi, get_transformed_size(m->filter_wi) ) ;
-
- /*** PARAMS object sub-constructor ***/
- params_init.filename = m->filename ;
- params_init.path = path ;
- params_init.handle = screen_handle ;
- params_init.font_info = screen_font_info ;
- params_init.number_fonts = number_screen_fonts ;
- m->params_wi = PARAMS_constructor(¶ms_init) ;
- if (!m->params_wi) { MAIN_destructor(wi) ; return NULL ; }
- /*** DRAWER object sub-constructor ***/
- drawer_init.filename = m->filename ;
- drawer_init.handle = screen_handle ;
- drawer_init.obj_wi = wi ;
- drawer_init.obj = WORK_OBJ ;
- drawer_init.width = (wi->work)->ob_width / m->zoom ;
- drawer_init.height = (wi->work)->ob_height / m->zoom ;
- drawer_init.params_window = m->params_wi ;
- drawer_init.filter_window = m->filter_wi ;
- drawer_init.info_window = m->info_wi ;
- m->drawer_wi = DRAWER_constructor(&drawer_init) ;
- if (!m->drawer_wi) { MAIN_destructor(wi) ; return NULL ; }
- /*** PRINTER object sub-constructor ***/
- if ( vq_gdos() )
- {
- printer_init.filename = m->filename ;
- printer_init.path = path ;
- printer_init.screen_handle = screen_handle ;
- printer_init.screen_width = drawer_init.width ;
- printer_init.screen_height = drawer_init.height ;
- printer_init.print_handle = print_handle ;
- printer_init.print_width = print_out[0] + 1 ;
- printer_init.print_height = print_out[1] + 1 ;
- printer_init.drawer_window = m->drawer_wi ;
- m->printer_wi = PRINTER_constructor(&printer_init) ;
- if (!m->printer_wi) { MAIN_destructor(wi) ; return NULL ; }
- }
- }
- /*** in any case file is no longer needed in RAM ***/
- unload_file(m->RAM_file) ; m->RAM_file = NULL ;
-
- /*** userdef drawing routines called by AES need access to MAIN ***/
- wi->work[WORK_OBJ].ob_spec.userblk->ub_parm = (long)m ;
-
- /*** return success message ***/
- return wi ;
- }
-
-
-
- /********************************************************************
- *
- * ACS routines
- *
- ********************************************************************/
-
-
- /*******************************************************************
- */
- static void aboutme(void) { A_dialog(&ABOUT_ME) ; }
- /*
- * replaces the ACS default info with my own info message.
- *
- *******************************************************************/
-
- /*******************************************************************
- */
- static void close(void)
- /*
- * is called if the program user has selected the "exit"
- * button in the menu of the desktop. After consolidation
- * via alert box, clean up is performed.
- *
- *******************************************************************/
- {
- if (alert_str(QUIT_ALL, "") == 1)
- {
- /*** only for debugging: ***/
- /*print_operations() ;*/
- /*** ACS termination procedure ***/
- Aev_quit() ;
- }
- }
-
- /*******************************************************************
- */
- static void terminate(void)
- /*
- * subtitutes the ACSterm procedure. It cleans up VDI.
- *
- *******************************************************************/
- {
- /*** close virtual screen workstation ***/
- if (screen_handle)
- {
- if ( vq_gdos() ) vst_unload_fonts(screen_handle, 0) ;
- v_clsvwk(screen_handle) ;
- }
- /*** close physical workstation for printer ***/
- if (print_handle)
- {
- if ( vq_gdos() ) vst_unload_fonts(print_handle, 0) ;
- v_clswk(print_handle) ;
- }
- }
-
-
- /*******************************************************************
- */
- int ACSinit(void)
- /*
- * is called once in the start-up of ACS. See also ACS manual.
- *
- * OUTPUT: screen_handle: virtual VDI workstation for screen
- * screen_out[]: parameters of screen workstation
- * screen_font_info[]: info about GDOS fonts for screen
- * print_handle: physical VDI workstation for printer
- * print_out[]: parameters of printer workstation
- * path[]: initialized to the path where
- * this program was started from
- * ACSblk->ACSaboutme: overwritten with "aboutme"
- * ACSblk->ACSclose: overwritten with "close"
- * ACSblk->ACSterm: overwritten with "term"
- * ACSblk->DEBUG_MEM: overwritten with "debug_mem"
- *
- *******************************************************************/
- {
- Awindow *wi ;
- unsigned int i,j,k, idbuffer ;
- int rgb[3] ; /* red green blue */
- char buffer[80] ;
-
- /*** replace "about me" procedure ***/
- ACSblk->ACSaboutme = aboutme ;
-
- /*** own click routine for "exit" button ***/
- ACSblk->ACSclose = close ;
-
- /*** own termination procedure ***/
- ACSblk->ACSterm = terminate ;
-
- /*** memory watcher ***/
- ACSblk->DEBUG_MEM = debug_mem ;
-
- /*** double click to "new" will result in a jump to "MAIN_constructor()" ***/
- wi = Awi_root() ;
- if (!wi) return FAIL ;
- wi->service(wi, AS_NEWCALL, &MAIN_WINDOW.create) ;
-
- /*** open 1 virtual workstation for the screen ***/
- for ( i = 0 ; i <= 8 ; i++ ) screen_in[i] = 1 ;
- screen_in[9] = 0 ; screen_in[10] = RC ;
- screen_handle = phys_handle ; /* physical screen handle of ACS */
- v_opnvwk(screen_in, &screen_handle, screen_out) ;
- if (!screen_handle) { alert_str(NO_SCREEN_WORKSTATION, "") ; return FAIL ; }
-
- /*** load screen fonts ***/
- if ( vq_gdos() ) number_screen_fonts = screen_out[10] + vst_load_fonts(screen_handle, 0) ;
- else number_screen_fonts = 1 ;
- if ( number_screen_fonts > MAX_FONTS ) number_screen_fonts = MAX_FONTS ;
- for ( i = 0 ; i < number_screen_fonts ; i++ )
- {
- idbuffer = vqt_name(screen_handle, i + 1, buffer) ;
- buffer[32] = 0 ;
- for ( j = 0 ; j < i ; j++ )
- {
- k = i ; /* destination index for new font */
- if ( strcmp(buffer, screen_font_info[j].font_name) < 0 )
- {
- for ( ; k > j ; k-- )
- {
- strcpy(screen_font_info[k].font_name, screen_font_info[k-1].font_name) ;
- screen_font_info[k].font_id = screen_font_info[k-1].font_id ;
- }
- j = i ; /* break */
- }
- }
- strcpy(screen_font_info[k].font_name, buffer) ;
- screen_font_info[k].font_id = idbuffer ;
- }
- /*** open printer workstation and load fonts ***/
- if ( vq_gdos() )
- {
- /*** open physical workstation for the printer ***/
- print_in[0] = 21 ; /* first printer driver of assign.sys */
- for ( i = 1 ; i <= 8 ; i++ ) print_in[i] = 1 ;
- print_in[9] = 0 ; print_in[10] = RC ;
- v_opnwk(print_in, &print_handle, print_out) ;
- if (print_handle)
- {
- /*** at least 16 colors, no true color ***/
- if (print_out[39] >= 16)
- {
- /*** set palette to Atari standard screen palette ***/
- rgb[0] = 1000 ; rgb[1] = 1000 ; rgb[2] = 1000 ; vs_color(print_handle, 0, rgb) ;
- rgb[0] = 0 ; rgb[1] = 0 ; rgb[2] = 0 ; vs_color(print_handle, 1, rgb) ;
- rgb[0] = 1000 ; rgb[1] = 0 ; rgb[2] = 0 ; vs_color(print_handle, 2, rgb) ;
- rgb[0] = 0 ; rgb[1] = 1000 ; rgb[2] = 0 ; vs_color(print_handle, 3, rgb) ;
- rgb[0] = 0 ; rgb[1] = 0 ; rgb[2] = 1000 ; vs_color(print_handle, 4, rgb) ;
- rgb[0] = 0 ; rgb[1] = 1000 ; rgb[2] = 1000 ; vs_color(print_handle, 5, rgb) ;
- rgb[0] = 1000 ; rgb[1] = 1000 ; rgb[2] = 0 ; vs_color(print_handle, 6, rgb) ;
- rgb[0] = 1000 ; rgb[1] = 0 ; rgb[2] = 1000 ; vs_color(print_handle, 7, rgb) ;
- rgb[0] = 800 ; rgb[1] = 800 ; rgb[2] = 800 ; vs_color(print_handle, 8, rgb) ;
- rgb[0] = 500 ; rgb[1] = 500 ; rgb[2] = 500 ; vs_color(print_handle, 9, rgb) ;
- rgb[0] = 500 ; rgb[1] = 0 ; rgb[2] = 0 ; vs_color(print_handle, 10, rgb) ;
- rgb[0] = 0 ; rgb[1] = 500 ; rgb[2] = 0 ; vs_color(print_handle, 11, rgb) ;
- rgb[0] = 0 ; rgb[1] = 0 ; rgb[2] = 500 ; vs_color(print_handle, 12, rgb) ;
- rgb[0] = 0 ; rgb[1] = 500 ; rgb[2] = 500 ; vs_color(print_handle, 13, rgb) ;
- rgb[0] = 500 ; rgb[1] = 500 ; rgb[2] = 0 ; vs_color(print_handle, 14, rgb) ;
- rgb[0] = 500 ; rgb[1] = 0 ; rgb[2] = 500 ; vs_color(print_handle, 15, rgb) ;
- }
- number_print_fonts = print_out[10] + vst_load_fonts(print_handle, 0) ;
- }
- else alert_str(PRINTING_NOT_POSSIBLE, "") ;
- }
- else alert_str( NO_GDOS, "") ;
-
- /*** get actual path for file searching ***/
- strcpy(path, apppath) ;
- strcat(path, "*.MID") ; /* append mask for searching */
-
- /*** init timer management ***/
- init_time() ;
-
- /*** call already now if a file name has been given ***/
- for (i = 1 ; i < ACSblk->argc ; i ++) MAIN_constructor(ACSblk->argv[i]) ;
- return OK ;
- }
-
-
- /*******************************************************************
- */
- int ACSinit0(void)
- /*
- * "ACSinit0" is called once very early in the start-up of ACS.
- * See also ACS manual.
- *
- * INPUT: _01_BACKGND_?: my own background objects for the
- * ACS desktop
- * DESK_MENU: my own menu line
- * NEW/TRASH: my own icons
- * MAIN_window.create create routine of the main window
- * DESKTOP: desktop of ACS
- * multitask indicates if multitasking is active
- * application indicates programm or accessory
- *
- * OUTPUT: ACS default desktop objects replaced by own objects
- *
- *******************************************************************/
- {
- /*** replace desktop background object ***/
- if ( multitask || !application )
- {
- _01_BACKGND_2.ob_width = _01_BACKGND_16.ob_width = desk.w/2 ;
- _01_BACKGND_2.ob_height = _01_BACKGND_16.ob_height = desk.h/2 ;
- }
- else
- {
- _01_BACKGND_2.ob_width = _01_BACKGND_16.ob_width = desk.w ;
- _01_BACKGND_2.ob_height = _01_BACKGND_16.ob_height = desk.h ;
- }
- if (ncolors >= 16) DESKTOP.service(NULL, AS_BACKOBJECT, &_01_BACKGND_16) ;
- else DESKTOP.service(NULL, AS_BACKOBJECT, &_01_BACKGND_2) ;
-
- /*** replace desktop menu ***/
- DESKTOP.menu = &DESK_MENU ;
-
- /*** adapt menu entries to propgram type ***/
- if (application && !multitask) DESKTOP.menu[ABOUTME].ob_flags |= HIDETREE ;
- if (!application) DESKTOP.menu[_EXIT].ob_state |= DISABLED ;
-
- /*** replace "trash" and "new" icon ***/
- DESKTOP.service(NULL, AS_ICONNEW, &NEW ) ;
- DESKTOP.service(NULL, AS_ICONTRASH, &TRASH) ;
-
- /*** replace window title ***/
- DESKTOP.name = " Mad Harry's Midi File Printer " ;
-
- /*** always OK ***/
- return OK ;
- }
-
-