int main(void) { Object *application, *window; Locale_Initialize(); if (ReadArguments()) { /* FIXME: handle arguments... */ // FROM - import prefs from this file at start // USE - 'use' the loaded prefs immediately, don't open window. // SAVE - 'save' the lodaed prefs immediately, don't open window. FreeArguments(); } application = (Object *)ApplicationObject, MUIA_Application_Title, __(MSG_NAME), MUIA_Application_Version, (IPTR) VERSION, MUIA_Application_Description, __(MSG_DESCRIPTION), MUIA_Application_Base, (IPTR) "FONTPREF", SubWindow, (IPTR) (window = (Object *)SystemPrefsWindowObject, MUIA_Window_ID, MAKE_ID('F','W','I','N'), WindowContents, (IPTR) FPEditorObject, End, End), End; if (application != NULL) { SET(window, MUIA_Window_Open, TRUE); DoMethod(application, MUIM_Application_Execute); SET(window, MUIA_Window_Open, FALSE); MUI_DisposeObject(application); } Locale_Deinitialize(); return 0; }
int main ( int argc, char *argv[] ) { struct RDArgs *rda = NULL; ULONG sigs; globalEvents = -1; globalCurrentTool = LUNA_TOOL_BRUSH; // Init brush brushTool.antialias = TRUE; // TODO: load from config set toolbox cycle! brushTool.width = 1; brushTool.height = 1; brushTool.feather = TRUE; // TODO: load from config and set toolbox cycle! // Set the colors prevColor = 0; currColor = 0; globalColor = 0; BOOL keyIsDown = FALSE; keyboardEnabled = TRUE; // Starts up the application #ifdef __amigaos4__ MUIMasterBase = OpenLibrary("muimaster.library", 0); if (!MUIMasterBase) { printf("Error opening muimaster library\n"); exit(0); }; IMUIMaster = (struct MUIMasterIFace *) GetInterface(MUIMasterBase, "main", 1, NULL); if (!MUIMasterBase && !IMUIMaster) { printf("Error opening muimaster library\n"); exit(0); }; CyberGfxBase = OpenLibrary("cybergraphics.library", 0); if (!CyberGfxBase) { printf("Error opening cybergraphics library\n"); exit(0); }; ICyberGfx = (struct CyberGfxIFace *) GetInterface(CyberGfxBase, "main", 1, NULL); if (!CyberGfxBase && !ICyberGfx) { printf("Error opening muimaster library\n"); exit(0); }; #endif struct MsgPort *port; Forbid(); port = FindPort("LUNAPAINT"); Permit(); if ( port == NULL) { Locale_Initialize(); Init_Application ( ); } else { // Double Start // TODO: open projects when clicking on icons from there goto quit; } if (argc) { IPTR args[ ARG_CNT ] = {0}; rda = ReadArgs ( ARG_TEMPLATE, args, NULL ); if ( ! rda ) { PrintFault( IoErr ( ), argv[0] ); goto exit; } if ( args[ARG_FILE] ) { STRPTR *file = (STRPTR *)args[ARG_FILE]; while ( *file ) { LoadProject ( *file, FALSE ); file++; } } } // Main loop while ( getSignals ( &sigs ) ) { // Check for signals from GUI if ( checkSignalBreak ( &sigs ) ) break; if ( keyboardEnabled ) { // Execute keyboard events on key press if ( evalRawKey >= IECODE_ASCII_FIRST && evalRawKey < IECODE_ASCII_LAST ) { if ( !keyIsDown ) { keyIsDown = TRUE; checkKeyboardShortcuts ( evalRawKey ); } } } // We always register keyup strokes if ( evalRawKey & IECODE_UP_PREFIX ) keyIsDown = FALSE; // Execute pending events if ( globalActiveWindow && globalActiveCanvas ) doEvents ( ); // Reset events globalEvents = -1; // Mouse clicks if ( mouseClickCount > 0 ) mouseClickCount--; // Delayed canvas redraw if ( redrawTimes == 1 ) { if ( globalActiveWindow ) DoMethod ( globalActiveWindow->area, MUIM_Draw ); redrawTimes--; } if ( redrawTimes > 0 ) redrawTimes--; } // Exists the application and cleans up reserved resources exit: Exit_Application ( ); Locale_Deinitialize(); #ifdef __amigaos4__ if(MUIMasterBase && IMUIMaster) DropInterface((struct Interface *)IMUIMaster); if (MUIMasterBase) CloseLibrary(MUIMasterBase); if(CyberGfxBase && ICyberGfx) DropInterface((struct Interface *)ICyberGfx); if(CyberGfxBase) CloseLibrary(CyberGfxBase); #endif if (rda) FreeArgs(rda); quit: return 0; }