home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 12 / MA_Cover_12.iso / internet / freedomc_112 / sourcecode / freedomcall / freemain.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-10  |  3.3 KB  |  140 lines

  1. /* Main-Header File inserted by GenCodeC */
  2. /* Libraries */
  3. #include <libraries/mui.h>
  4. #include <libraries/gadtools.h> /* for BARLABEL in MenuItem */
  5.  
  6. /* Prototypes */
  7. #ifdef __SASC
  8. #include <clib/muimaster_protos.h>
  9. #include <clib/exec_protos.h>
  10. #include <clib/alib_protos.h>
  11. #include <clib/dos_protos.h>
  12. #else
  13. #include <proto/muimaster.h>
  14. #include <proto/exec.h>
  15. #include <proto/alib.h>
  16. #include <proto/dos.h>
  17. #endif
  18.  
  19. /*  Pragmas  */
  20. #include <pragmas/muimaster_pragmas.h>
  21.  
  22. /*  Ansi  */
  23. #include <stdlib.h>
  24. #include <stdio.h>
  25. #include <string.h>
  26.  
  27. /* Increase stack size */
  28. LONG __stack=8192;
  29. /* GenCodeC header end */
  30.  
  31. /* Include generated by GenCodeC */
  32. #include "FreeGUI.h"
  33. #include "FreeExtern.h"
  34. #include "Hook_Utility.h"
  35.  
  36. struct ObjApp * App; /* Object */
  37.  
  38. /* Declarations for libraries (inserted by GenCodeC) */
  39. struct Library * IntuitionBase;
  40. struct Library * MUIMasterBase;
  41. struct Library * LocaleBase;
  42.  
  43. /* Init() function */
  44. void init( void )
  45. {
  46.   if (!(IntuitionBase = OpenLibrary("intuition.library",37)))
  47.   {
  48.     printf("Can't Open Intuition Library\n");
  49.     exit(20);
  50.   }
  51.   if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  52.   {
  53.     printf("Can't Open MUIMaster Library\n");
  54.     CloseLibrary(IntuitionBase);
  55.     exit(20);
  56.   }
  57.   if (!(LocaleBase = OpenLibrary("locale.library",38)))
  58.   {
  59.     printf("Can't Open Locale Library\n");
  60.     printf("Built-in Language will be used !!!\n");
  61.   }
  62.   OpenAppCatalog(NULL,NULL);
  63. }
  64. /* GenCodeC init() end */
  65.  
  66. /* End() function */
  67. void end( void )
  68. {
  69.   CloseAppCatalog();
  70.   if (LocaleBase)
  71.     CloseLibrary(LocaleBase);
  72.   CloseLibrary(MUIMasterBase);
  73.   CloseLibrary(IntuitionBase);
  74.   exit(20);
  75. }
  76. /* GenCodeC end() end */
  77.  
  78. /* Main Function inserted by GenCodeC */
  79. int main(int argc,char **argv)
  80. {
  81.   BOOL  running = TRUE;
  82.   ULONG signal;
  83.   long startup = 0, menu = 0;
  84.  
  85.   static struct Hook GeracaoHook;
  86.   static struct Hook CarregaConfiguracaoHook;
  87.   static struct Hook TestaConfiguracaoHook;
  88.   static struct Hook DataAtualHook;
  89.  
  90.   InstallHook(&GeracaoHook,Geracao,NULL);
  91.   InstallHook(&CarregaConfiguracaoHook,CarregaConfiguracao,NULL);
  92.   InstallHook(&DataAtualHook,DataAtual,NULL);
  93.   InstallHook(&TestaConfiguracaoHook,TestaConfiguracao,NULL);
  94.  
  95.   /* Program initialisation : generated by GenCodeC */
  96.   init();
  97.  
  98.   /* Create Object : generated by GenCodeC */
  99.   if (!(App = CreateApp()))
  100.   {
  101.     printf("Can't Create App\n");
  102.     end();
  103.   }
  104.  
  105.   DoMethod(App->App, MUIM_CallHook, &CarregaConfiguracaoHook);
  106.   DoMethod(App->App, MUIM_CallHook, &DataAtualHook);
  107.   DoMethod(App->App, MUIM_CallHook, &TestaConfiguracaoHook);
  108.  
  109.   /* TESTA O TIPO DE MENU PRINCIPAL A CARREGAR */
  110.   get(App->PrefsComboMenu, MUIA_Cycle_Active, &menu);
  111.   if(menu == 0)
  112.         set(App->JanelaPrincipal2, MUIA_Window_Open, TRUE);
  113.   else
  114.         set(App->JanelaPrincipal, MUIA_Window_Open, TRUE);
  115.  
  116.   /* TESTA SE TEM QUE IMPORTAR OS DADOS NO INICIO DO FREEDOM */
  117.   get(App->LabelGenerationStartup, MUIA_Selected, &startup);
  118.   if(startup == 1)
  119.     DoMethod(App->App, MUIM_CallHook, &GeracaoHook);
  120.  
  121.   while (running)
  122.   {
  123.     switch (DoMethod(App->App,MUIM_Application_Input,&signal))
  124.     {
  125.       case MUIV_Application_ReturnID_Quit:
  126.         running = FALSE;
  127.         break;
  128.  
  129.       /* Insert your code between the "case" statement and comment "end of case ..." */
  130.       /* End computing of IDCMP */
  131.  
  132.       default:
  133.         break;
  134.     }
  135.     if (running && signal) Wait(signal);
  136.   }
  137.   DisposeApp(App);
  138.   end();
  139. }
  140.