Le 28/05/2007, Selbstkopie a écrit:

> Hello Mathias,

Hi

>> I have to say after "set(window, MUIA_Window_ActiveObject, mystring)"
>> I get the active object of the window and it is equal to mystring ...
>> but there is no visual effect.

> Make sure your Object has MUIA_CycleChain, TRUE too.

Thanks Christian and Ilkka. But even with several ideas, it still does not
work. Here is the source ... if someone can try : compile, run, click on
display.

Regards,

-- 
Mathias PARNAUDEAU

Visit http://www.amiga.dk/tumult for MUI-related
information, especially about MUI custom classes. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MUI/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/MUI/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 
/*
 * GS8Gui9.c (09/04/07)
 *
 * OS4 :
 * gcc -O2 -Wall -D__USE_BASETYPE__ -D__USE_INLINE__ -o GS8Gui9 GS8Gui9.c
 * vc -O2 -D__USE_BASETYPE__ -D__USE_INLINE__ -o GS8Gui9 GS8Gui9.c
 *
 * MorphOS / AmigaOS 3.x :
 * gcc -O2 -Wall -o GS8Gui9 GS8Gui9.c -noixemul
 *
 * 68k :
 * vc +aos68k -c99 -O2 -o GS8Gui9 GS8Gui9.c -lamiga
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libraries/mui.h>
#include <proto/muimaster.h>
#include <proto/intuition.h>
#include <proto/exec.h>
#include <clib/alib_protos.h>
#include <libraries/asl.h>

#include <SDI_hook.h>


struct IntuitionBase *IntuitionBase;
struct Library  *MUIMasterBase;

#ifdef __amigaos4__
struct IntuitionIFace *IIntuition;
struct MUIMasterIFace *IMUIMaster;
#endif

#define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | 
(ULONG) (d))

#define FORMAT_UNKNOWN          0
#define FORMAT_POSTSCRIPT       1
#define FORMAT_PDF                      2

// Tableau de chaînes contenant les titres des onglets
static char *Pages[] = { "Display settings", "Print settings", "Convert 
settings", NULL };

static char *general_resolution_labels[] = { "default", "75", "100", "150", 
"300", "600", NULL };

static char *display_method_labels[] = { "internal", "external (bitmap)", NULL 
};

static char *internal_viewer_device_labels[] = { "24 bit", "8 bit grey", "1 bit 
b/w", NULL };

static char *external_viewer_bitmap_labels[] = { "JPEG", "PNG", "TIFF", NULL };
static char *external_viewer_quality_labels[] = { "24 bit color", "8 bit grey", 
"1 bit b/w", NULL };

static char *print_device_labels[] = {
        "tp24 (TurboPrint 24bit color)", "tp8 (TurboPrint 8bit color)", "tp8g 
(TurboPrint 8bit grey)", "tp1 (TurboPrint 1bit b/w)",
        "whoosh24 (whoosh device 24bit color)", "whoosh8 (whoosh device 8bit 
color)",
        "whooshg (whoosh device 8bit grey)", "whoosh1 (whoosh device 1bit b/w)",
        "bj10e", "bj200", "bjc600", "bjc800", "cdeskjet", "cdjcolor", 
"cdjmono", "cdj550", "deskjet", "djet500", "epson",
        "eps9high", "eps9mid", "epsonc", "ibmpro", "laserjet", "ljetplus", 
"ljet2p", "ljet3", "ljet3d", "ljet4", "ljet4d",
        "lj5mono", "lj5gray", "pj", "pjxl", "pjxl300", "samsung_gdi","stcolor"
};

static char *convert_device_labels[] = {
        "pdfwrite (PDF file)", "bmp16m (BMP - 24bit)", "bmp256 (BMP - 8bit)", 
"bmp16 (BMP - 16 colors)",
        "bmpgray (BMP - grey)", "bmpmono (BMP - b/w)", "jpeg (JPEG 24bit)", 
"jpeggray (JPEG grey)", "png16m (PNG - 24bit)",
        "png256 (PNG - 8bit)", "png16 (PNG - 16 colors)", "pnggray (PNG - 
grey)", "pngmono (PNG - b/w)",
        "pswrite (PS file)", "tifflzw (TIFF lzw)", "bbox", "bit", "bitcmyk", 
"bitrgb","bmp32b", "bmpsep1", "bmpsep8",
        "devicen", "epswrite (EPS file)", "faxg3", "faxg32d", "faxg4", 
"miff24", "nullpage", "pbm", "pbmraw",
        "pcx16", "pcx24b", "pcx256", "pcxcmyk", "pcxgray","pcxmono", "pgm", 
"pgmraw", "pgnm", "pgnmraw",
        "pkm", "pkmraw", "pksm", "pksmraw", "pngalpha", "pnm", "pnmraw", "ppm", 
"ppmraw",
        "psdcmyk", "psdrgb", "psgray", "psmono", "psrgb", "spotcmyk",
        "tiff12nc", "tiff24nc", "tiff32nc", "tiffcrle", "tiffg3", "tiffg32d", 
"tiffg4", "tiffpack", "uniprint", "xcf"
};

static char command_line[256];


/* MUI objects */

Object *file_str, *file_pop;
Object *general_resolution_cyc, *general_from_page_sl, *general_to_page_sl, 
*general_add_parameter_str;
Object *display_method_cyc, *display_add_parameter_str, *display_device_cyc, 
*display_own_screen_chk, *display_like_wb_chk;
Object *external_viewer_str, *bitmap_format_cyc, *quality_cyc, 
*external_file_path_str;
Object *print_add_parameter_str, *print_device_str, *print_dest_file_str;
Object *convert_add_parameter_str, *convert_device_str, *convert_dest_file_str;
Object *internal_viewer_grp, *external_viewer_grp;

int Initialize(void)
{
        int res = 1;

        IntuitionBase = (struct IntuitionBase 
*)OpenLibrary("intuition.library", 39L);
        MUIMasterBase = OpenLibrary(MUIMASTER_NAME, 19);

#ifdef __amigaos4__
        IMUIMaster = (struct MUIMasterIFace *)GetInterface(MUIMasterBase, 
"main", 1, NULL);
        IIntuition = (struct IntuitionIFace *)GetInterface((struct Library 
*)IntuitionBase, "main", 1, NULL);

        res = IMUIMaster && IIntuition;
#endif

        return (IntuitionBase && MUIMasterBase && res);
}

void DeInitialize(void)
{

#ifdef __amigaos4__
        if (IMUIMaster) DropInterface((struct Interface *)IMUIMaster);
        if (IIntuition) DropInterface((struct Interface *)IIntuition);
#endif

        if (IntuitionBase)
                CloseLibrary((struct Library *)IntuitionBase);

        if (MUIMasterBase)
                CloseLibrary(MUIMasterBase);

}

Object *_KeyGadget(CONST_STRPTR content, BYTE controlchar)
{
    return TextObject,
        ButtonFrame,
        MUIA_Font,          MUIV_Font_Button,
        MUIA_Text_Contents, content,
        MUIA_Text_PreParse, "\33c",
        MUIA_Text_HiChar,   controlchar,
        MUIA_ControlChar,   controlchar,
        MUIA_InputMode,     MUIV_InputMode_RelVerify,
        MUIA_Background,    MUII_ButtonBack,
        MUIA_CycleChain,    TRUE,
    End;
}

// Open a requester to display an error message
static int DisplayErrorMessage(Object *mui_obj, char *message)
{
        int res;
        struct Window *window = NULL;
        struct EasyStruct requester =
        {
                sizeof (struct EasyStruct),
                0,
                "Error",
                NULL,
                "OK"
        };
        requester.es_TextFormat = message;

        if (mui_obj){
                get(_win(mui_obj), MUIA_Window_Window, (ULONG)&window);
        }

        res = EasyRequestArgs(window, &requester, NULL, NULL);

        return res;
}

// A partir du nom de fichier et de son extention, retourne le format (inconnu, 
PS ou PDF)
static int GetFormatFromName(char *filename)
{
        int res = FORMAT_UNKNOWN;
        char *suffix_ptr;

        if (filename){
                suffix_ptr = strrchr(filename, '.');
                if (suffix_ptr){
                        if ((strcmp(suffix_ptr, ".ps") == 0) || 
(strcmp(suffix_ptr, ".PS") == 0)){
                                res = FORMAT_POSTSCRIPT;
                        }
                        if ((strcmp(suffix_ptr, ".pdf") == 0) || 
(strcmp(suffix_ptr, ".PDF") == 0)){
                                res = FORMAT_PDF;
                        }
                }
        }

        return res;
}


HOOKPROTONH(DisplayClicked, ULONG, APTR obj, struct TagItem *tag_list)
{
        char *str_ptr;
        int val;
        char *file_name;
        ULONG active;
        ULONG inchain;

        printf("\nDISPLAY\n");

        get(file_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Postscript/PDF file : %s\n", str_ptr);

        if (GetFormatFromName(str_ptr) == FORMAT_UNKNOWN){
                DisplayErrorMessage(obj, "Please choose a valid file to 
display\n");
                //set(_win(obj), MUIA_Window_Activate, TRUE);   // tried to 
activate the window before ...
                set(_win(obj), MUIA_Window_ActiveObject, file_str);
                get(_win(obj), MUIA_Window_ActiveObject, &active);
                printf("file_str = 0x%08x, active_object = 0x%08x\n", 
(int)file_str, (int)active);
                get(file_str, MUIA_CycleChain, &inchain);
                printf("file_str in chain : %d\n", (int)inchain);
                printf("file_pop = 0x%08x\n", file_pop);
                return TRUE;
        }

        file_name = str_ptr;

        get(general_resolution_cyc, MUIA_Cycle_Active, (ULONG)&val);
        printf("Resolution : %d, %s\n", val, general_resolution_labels[val]);

        get(general_from_page_sl, MUIA_Numeric_Value, (ULONG)&val);
        printf("From page : %d\n", val);

        get(general_to_page_sl, MUIA_Numeric_Value, (ULONG)&val);
        printf("To page : %d\n", val);

        get(display_method_cyc, MUIA_Cycle_Active, (ULONG)&val);
        printf("Display method : %d, %s\n", val, display_method_labels[val]);

        get(display_add_parameter_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Add. parameter : %s\n", str_ptr);

        get(display_device_cyc, MUIA_Cycle_Active, (ULONG)&val);
        printf("Device : %d, %s\n", val, internal_viewer_device_labels[val]);

        get(display_own_screen_chk, MUIA_Selected, (ULONG)&val);
        printf("Use own screen : %d\n", val);

        get(display_like_wb_chk, MUIA_Selected, (ULONG)&val);
        printf("Like Workbench : %d\n", val);

        sprintf(command_line, "GS854:bin/gs -dBATCH -dNOPAUSE %s\n", file_name);

        printf("%s\n", command_line);
        //system(command_line);

        return TRUE;
}

MakeStaticHook(hook_DisplayClicked, DisplayClicked);


HOOKPROTONH(PrintClicked, ULONG, APTR obj, struct TagItem *tag_list)
{
        char *str_ptr;
        int val;

        printf("\nPRINT\n");

        get(file_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Postscript/PDF file : %s\n", str_ptr);

        if (strlen(str_ptr) == 0){
                printf("Please choose a file to print\n");
                return FALSE;
        }

        get(general_resolution_cyc, MUIA_Cycle_Active, (ULONG)&val);
        printf("Resolution : %d, %s\n", val, general_resolution_labels[val]);

        get(general_from_page_sl, MUIA_Numeric_Value, (ULONG)&val);
        printf("From page : %d\n", val);

        get(general_to_page_sl, MUIA_Numeric_Value, (ULONG)&val);
        printf("To page : %d\n", val);

        get(print_add_parameter_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Add. parameter : %s\n", str_ptr);

        get(print_device_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Device : %s\n", str_ptr);

        get(print_dest_file_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Destination file : %s\n", str_ptr);

        return TRUE;
}

MakeStaticHook(hook_PrintClicked, PrintClicked);


HOOKPROTONH(ConvertClicked, ULONG, APTR obj, struct TagItem *tag_list)
{
        char *str_ptr;
        int val;

        printf("\nCONVERT\n");

        get(file_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Postscript/PDF file : %s\n", str_ptr);

        if (strlen(str_ptr) == 0){
                printf("Please choose a file to convert\n");
                return FALSE;
        }

        get(general_resolution_cyc, MUIA_Cycle_Active, (ULONG)&val);
        printf("Resolution : %d, %s\n", val, general_resolution_labels[val]);

        get(general_from_page_sl, MUIA_Numeric_Value, (ULONG)&val);
        printf("From page : %d\n", val);

        get(general_to_page_sl, MUIA_Numeric_Value, (ULONG)&val);
        printf("To page : %d\n", val);

        get(convert_add_parameter_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Add. parameter : %s\n", str_ptr);

        get(convert_device_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Device : %s\n", str_ptr);

        get(convert_dest_file_str, MUIA_String_Contents, (ULONG)&str_ptr);
        printf("Destination file : %s\n", str_ptr);

        return TRUE;
}

MakeStaticHook(hook_ConvertClicked, ConvertClicked);


int CreateGui(void)
{
        Object *app, *window;
        Object *action_display_bt, *action_print_bt, *action_convert_bt;

        /* Description de l'interface graphique */

        app = ApplicationObject,
                MUIA_Application_Title  , "Titre",
                MUIA_Application_Version , "$VER: 0.0.1 (26/05/07)",
                MUIA_Application_Copyright , "©2007, copyright et célébrité",
                MUIA_Application_Author  , "L'auteur, c'est vous !",
                MUIA_Application_Description, "Description libre",
                MUIA_Application_Base  , "GS8GUI",

                SubWindow, window = WindowObject,
                        MUIA_Window_Title, "GS8Gui9",
                        MUIA_Window_ID , MAKE_ID('W','I','N','1'),
                        WindowContents, VGroup,

                                Child, HGroup,
                                        Child, action_display_bt = 
_KeyGadget("Display", 'd'),
                                        Child, action_print_bt = 
_KeyGadget("Print", 'p'),
                                        Child, action_convert_bt = 
_KeyGadget("Convert", 'c'),
                                End,

                                Child, HGroup,
                                        MUIA_Background, MUII_GroupBack,
                                        MUIA_Group_Columns, 2,

                                        Child, Label2("Postscript/PDF file :"),
                                        Child, file_pop = PopaslObject,
                                                MUIA_Popstring_String, file_str 
= StringObject, StringFrame,
                                                        MUIA_String_Contents, 
"GS854:examples/",
                                                        MUIA_CycleChain, TRUE,
                                                End,
                                                MUIA_Popstring_Button, 
PopButton( MUII_PopFile ),
                                                ASLFR_TitleText, 
"PostScript/PDF file...",
                                                ASLFR_DoPatterns, TRUE,
                                                ASLFR_InitialPattern, 
"#?.(PS|PDF|EPS)",
                                                MUIA_ShortHelp, "PDF or PS file 
to work on",
                                                        MUIA_CycleChain, TRUE,
                                        End,
                                End,

                                Child, VGroup, GroupFrameT("General settings"),
                                        MUIA_Background, MUII_GroupBack,
                                        MUIA_Group_Columns, 2,

                                        Child, Label2("Resolution (dpi) :"),
                                        Child, HGroup,
                                                MUIA_ShortHelp, "Use default 
when using TurboPrint:\nTurboPrint resolution settings are used instead.",
                                                Child, general_resolution_cyc = 
CycleObject,
                                                        MUIA_Cycle_Entries, 
general_resolution_labels,
                                                End,
                                        End,

                                        Child, Label2("From page :"),
                                        Child, general_from_page_sl = 
SliderObject,
                                                MUIA_ShortHelp, "Only works for 
PDF files! When used for PS files this has NO effect",
                                                MUIA_Group_Horiz, TRUE,
                                                MUIA_Numeric_Min, 1,
                                                MUIA_Numeric_Max, 100,
                                                MUIA_Numeric_Value, 1,
                                        End,

                                        Child, Label2("To page :"),
                                        Child, general_to_page_sl = 
SliderObject,
                                                MUIA_ShortHelp, "Only works for 
PDF files! When used for PS files this has NO effect",
                                                MUIA_Group_Horiz, TRUE,
                                                MUIA_Numeric_Min, 1,
                                                MUIA_Numeric_Max, 100,
                                                MUIA_Numeric_Value, 1,
                                        End,

                                        Child, Label2("Add. parameter :"),
                                        Child, general_add_parameter_str = 
StringObject, StringFrame,
                                                MUIA_ShortHelp, "This will be 
added to the GS command line for display/print/convert",
                                        End,
                                End,

                                Child, RegisterGroup(Pages),
                                        MUIA_Register_Frame, TRUE,

                                        Child, VGroup,
                                                Child, VGroup, 
GroupFrameT("General display settings"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("Display 
method :"),
                                                        Child, HGroup,
                                                                MUIA_ShortHelp, 
"Internal will use the phantastic WHOOSH display driver.\nExternal will convert 
the file to a picture and show this instead.",
                                                                Child, 
display_method_cyc = CycleObject,
                                                                        
MUIA_Cycle_Entries, display_method_labels,
                                                                End,
                                                        End,

                                                        Child, Label2("Add. 
parameter :"),
                                                        Child, 
display_add_parameter_str = StringObject, StringFrame,
                                                                MUIA_ShortHelp, 
"This will be added to the GS command line for display",
                                                        End,
                                                End,

                                                Child, internal_viewer_grp = 
VGroup, GroupFrameT("Internal viewer"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("Device 
:"),
                                                        Child, HGroup,
                                                                MUIA_ShortHelp, 
"Internal will use the phantastic WHOOSH display driver.\nExternal will convert 
the file to a picture and show this instead.",
                                                                Child, 
display_device_cyc = CycleObject,
                                                                        
MUIA_Cycle_Entries, internal_viewer_device_labels,
                                                                End,
                                                        End,

                                                        Child, Label1("Use own 
screen"),
                                                        Child, HGroup,
                                                                Child, 
display_own_screen_chk = CheckMark(FALSE),
                                                                Child, 
Label1("Like Workbench"),
                                                                Child, 
display_like_wb_chk = CheckMark(FALSE),
                                                        End,
                                                End,

                                                Child, external_viewer_grp = 
VGroup, GroupFrameT("External viewer (bitmap)"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("External 
viewer :"),
                                                        Child, PopaslObject,
                                                                
MUIA_Popstring_String, external_viewer_str = String("", 64),
                                                                
MUIA_Popstring_Button, PopButton( MUII_PopFile ),
                                                                
ASLFR_TitleText, "External viewer ...",
                                                                
ASLFR_RejectIcons, TRUE,
                                                        End,
                                                        Child, Label2("Bitmap 
format :"),
                                                        Child, 
bitmap_format_cyc = CycleObject,
                                                                
MUIA_Cycle_Entries, external_viewer_bitmap_labels,
                                                        End,
                                                        Child, Label2("Quality 
:"),
                                                        Child, quality_cyc = 
CycleObject,
                                                                
MUIA_Cycle_Entries, external_viewer_quality_labels,
                                                        End,
                                                        Child, Label2("File 
path :"),
                                                        Child, PopaslObject,
                                                                
MUIA_Popstring_String, external_file_path_str = String( "", 256 ),
                                                                
MUIA_Popstring_Button, PopButton( MUII_PopDrawer ),
                                                                
ASLFR_TitleText, "File path for bitmap ...",
                                                        End,
                                                End,

                                        End,

                                        // Onglet "Print Settings"

                                        Child, VGroup,
                                                Child, VGroup, 
GroupFrameT("General print settings"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("Add. 
parameter :"),
                                                        Child, 
print_add_parameter_str = StringObject, StringFrame,
                                                                MUIA_ShortHelp, 
"This will be added to the GS command line for print",
                                                        End,
                                                End,
                                                Child, VGroup, 
GroupFrameT("Output device"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("Device 
:"),
                                                        Child, PoplistObject,
                                                                
MUIA_Popstring_String, print_device_str = StringObject, StringFrame,
                                                                End,
                                                                
MUIA_Popstring_Button, ImageObject,
                                                                        
ImageButtonFrame,
                                                                        
MUIA_InputMode, MUIV_InputMode_RelVerify,
                                                                        
MUIA_Image_Spec, MUII_PopUp,
                                                                        
MUIA_Image_FreeVert, TRUE,
                                                                End,
                                                                
MUIA_Poplist_Array, print_device_labels,
                                                        End,
                                                        Child, 
Label2("Destination file/device :"),
                                                        Child, PopaslObject,
                                                                
MUIA_Popstring_String, print_dest_file_str = String( "", 256 ),
                                                                
MUIA_Popstring_Button, PopButton( MUII_PopDrawer ),
                                                                
ASLFR_TitleText, "Destination file/device...",
                                                                MUIA_ShortHelp, 
"file or device to print to\nexample: PRT, RAM:outputfile, ...",
                                                        End,
                                                End,
                                        End,

                                        // Onglet "Convert Settings"

                                        Child, VGroup,
                                                Child, VGroup, 
GroupFrameT("General convert settings"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("Add. 
parameter :"),
                                                        Child, 
convert_add_parameter_str = StringObject, StringFrame,
                                                                MUIA_ShortHelp, 
"This will be added to the GS command line for convert",
                                                        End,
                                                End,
                                                Child, VGroup, 
GroupFrameT("Output device"),
                                                        MUIA_Background, 
MUII_GroupBack,
                                                        MUIA_Group_Columns, 2,

                                                        Child, Label2("Device 
:"),
                                                        Child, PoplistObject,
                                                                
MUIA_Popstring_String, convert_device_str = StringObject, StringFrame,
                                                                End,
                                                                
MUIA_Popstring_Button, ImageObject,
                                                                        
ImageButtonFrame,
                                                                        
MUIA_InputMode, MUIV_InputMode_RelVerify,
                                                                        
MUIA_Image_Spec, MUII_PopUp,
                                                                        
MUIA_Image_FreeVert, TRUE,
                                                                End,
                                                                
MUIA_Poplist_Array, convert_device_labels,
                                                        End,
                                                        Child, 
Label2("Destination file/device :"),
                                                        Child, PopaslObject,
                                                                
MUIA_Popstring_String, convert_dest_file_str = String( "", 256 ),
                                                                
MUIA_Popstring_Button, PopButton( MUII_PopDrawer ),
                                                                
ASLFR_TitleText, "Destination file/device...",
                                                                MUIA_ShortHelp, 
"file or device to print to\nexample: PRT, RAM:outputfile, ...",
                                                        End,
                                                End,
                                        End,

                                        // Fin des onglets

                                End,

                        End,
                End,
        End;

        if (!app){
                printf("Impossible de créer l'application.\n");
                return 0;
        }

        set(external_viewer_grp, MUIA_Disabled, TRUE);

        DoMethod(action_display_bt, MUIM_Notify, MUIA_Pressed, FALSE,
                                action_display_bt, 2, MUIM_CallHook, 
&hook_DisplayClicked);

        DoMethod(action_print_bt, MUIM_Notify, MUIA_Pressed, FALSE,
                                action_print_bt, 2, MUIM_CallHook, 
&hook_PrintClicked);

        DoMethod(action_convert_bt, MUIM_Notify, MUIA_Pressed, FALSE,
                                action_convert_bt, 2, MUIM_CallHook, 
&hook_ConvertClicked);

        DoMethod(display_method_cyc, MUIM_Notify, MUIA_Cycle_Active, 
MUIV_EveryTime,
                                        internal_viewer_grp, 3, MUIM_Set, 
MUIA_Disabled, MUIV_TriggerValue);

        DoMethod(display_method_cyc, MUIM_Notify, MUIA_Cycle_Active, 
MUIV_EveryTime,
                                        external_viewer_grp, 3, MUIM_Set, 
MUIA_Disabled, MUIV_NotTriggerValue);

        DoMethod(window,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,
                app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);

        /* Commande l'ouverture, donc l'affichage, de la fenêtre */

        set(window,MUIA_Window_Open,TRUE);

        /* Boucle de gestion des événements qui permet de savoir quand la 
fermeture
         * a été demandée
         */
        {
                ULONG sigs = 0;

                while (DoMethod(app,MUIM_Application_NewInput,&sigs) != 
MUIV_Application_ReturnID_Quit)
                {
                        if (sigs)
                        {
                                sigs = Wait(sigs | SIGBREAKF_CTRL_C);
                                if (sigs & SIGBREAKF_CTRL_C) break;
                        }
                }
        }

        set(window,MUIA_Window_Open,FALSE);

        // Fermeture de la fenêtre, désallocation des ressources
        MUI_DisposeObject(app);

        return 1;
}


int main(int argc,char *argv[])
{

        if ( Initialize() ){
                CreateGui();
        }else{
                printf("Impossible d'ouvrir toutes les bibliothèques\n");
        }

        DeInitialize();

        return 0;
}

Reply via email to