Ejemplo n.º 1
1
ULONG RGOM_RegisterUI(SW_IDATA *idata, SWP_RegUI *UI)
{
   Object *g;
   LONG   x;

   if (!idata->RegWin) {

      idata->RegWin = WindowObject,
         MUIA_Window_Title, "Registration",
         MUIA_Window_ID,    MAKE_ID('r','g','s','r'),
         WindowContents, VGroup,
            Child, ScrollgroupObject,
               MUIA_Scrollgroup_FreeHoriz, FALSE,
               MUIA_Scrollgroup_Contents,  VirtgroupObject,
                  VirtualFrame,
                  Child, g = ColGroup(3),
                     GroupFrameT("Registration Information"),
                  End,
               End,
            End,
            Child, HGroup, GroupFrame,
               Child, idata->B_Generate = SimpleButton("_Generate"),
               Child, idata->B_Cancel   = SimpleButton("_Cancel"),
            End,
         End,
      End;

      if (!idata->RegWin) return FAILURE;

      for (x=0; RG_ParseTable[x].Keyword; x++) {
         DoMethod(g, OM_ADDMEMBER, Label2(RG_ParseTable[x].Keyword));
         DoMethod(g, OM_ADDMEMBER,
                  idata->Gads[x] =String("", SWF_CryptLineSize));
         set(idata->Gads[x], MUIA_CycleChain,         1);
         set(idata->Gads[x], MUIA_String_AdvanceOnCR, 1);
         DoMethod(g, OM_ADDMEMBER,
                  Label2(RG_ParseTable[x].Required ? "Req" : "Opt"));
      }

      set(idata->B_Generate, MUIA_CycleChain, 1);
      set(idata->B_Cancel,   MUIA_CycleChain, 1);

      DoMethod(idata->B_Generate, MUIM_Notify, MUIA_Pressed, FALSE,
               UI->App, 6, MUIM_CallHook, &RGOM_Hook_Generate,
               idata, UI->Prog, UI->Cost1, UI->Cost2);

      SW_NOTIFYSINGLE(idata->B_Cancel, MUIA_Pressed, FALSE,
                      idata->RegWin, MUIA_Window_Open, FALSE);

      SW_NOTIFYCLOSEWIN(idata->RegWin);

      DoMethod(UI->App, OM_ADDMEMBER, idata->RegWin);
   }

   if (!idata->RegWin) return FAILURE;

   set(idata->RegWin, MUIA_Window_Open, TRUE);

   return SUCCESS;
}
Ejemplo n.º 2
0
/* /// "nGUITask()" */
AROS_UFH0(void, nGUITask)
{
    AROS_USERFUNC_INIT

    struct Task *thistask;
    struct AROSXClassBase *arosxb;
    struct AROSXClassController *arosxc;

    struct Library *MUIBase;
    struct Library *PsdBase;
    struct Library *AROSXBase;

    struct AROSXClassConfigGUI *gui;

    thistask = FindTask(NULL);
    arosxc = thistask->tc_UserData;
    arosxb = arosxc->arosxb;

    struct AROSX_GAMEPAD *arosx_gamepad;
    arosx_gamepad = &arosxc->arosx_gamepad;

    /*
        TODO: Make use of OpenLibrary/CloseLibrary to keep track of lib open count...
    */
    ++arosxb->Library.lib_OpenCnt;

    struct AROSX_EventHook *arosx_eventhook;
    struct MsgPort         *arosx_eventport;

    if(gui = AllocVec(sizeof(struct AROSXClassConfigGUI), MEMF_CLEAR|MEMF_ANY)) {

        if(AROSXBase = OpenLibrary("arosx.library", 0)) {
            mybug(-1,("[AROSXClass GUI] arosx.library openened\n"));

            arosx_eventport = CreateMsgPort();
            arosx_eventhook = AROSX_AddEventHandler(arosx_eventport, (((1<<arosxc->id))<<28));
            /*
                Set to listen every controller
            */
            //arosx_eventhook = AROSX_AddEventHandler(arosx_eventport, (0xf<<28));

        if((MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN)))
        {
            if((ps = OpenLibrary("poseidon.library", 4)))
            {

                gui->App = ApplicationObject,
                MUIA_Application_Title      , (IPTR)libname,
                MUIA_Application_Version    , (IPTR)VERSION_STRING,
                MUIA_Application_Copyright  , (IPTR)"©2018-2019 The AROS Development Team",
                MUIA_Application_Author     , (IPTR)"The AROS Development Team",
                MUIA_Application_Description, (IPTR)"Settings for the arosx.class",
                MUIA_Application_Base       , (IPTR)"AROSX",
                MUIA_Application_HelpFile   , (IPTR)"HELP:Poseidon.guide",
                MUIA_Application_Menustrip  , (IPTR)MenustripObject,
                    Child, (IPTR)MenuObjectT((IPTR)"Project"),
                        Child, (IPTR)(gui->AboutMI = MenuitemObject,
                            MUIA_Menuitem_Title, (IPTR)"About...",
                            MUIA_Menuitem_Shortcut, (IPTR)"?",
                            End),
                        End,
                    Child, (IPTR)MenuObjectT((IPTR)"Settings"),
                        Child, (IPTR)(gui->UseMI = MenuitemObject,
                            MUIA_Menuitem_Title, (IPTR)"Save",
                            MUIA_Menuitem_Shortcut, (IPTR)"S",
                            End),
                        Child, (IPTR)MenuitemObject,
                            MUIA_Menuitem_Title, (IPTR)NM_BARLABEL,
                            End,
                        Child, (IPTR)(gui->MUIPrefsMI = MenuitemObject,
                            MUIA_Menuitem_Title, (IPTR)"MUI Settings",
                            MUIA_Menuitem_Shortcut, (IPTR)"M",
                            End),
                        End,
                    End,

                SubWindow, (IPTR)(gui->MainWindow = WindowObject,
                    MUIA_Window_ID   , MAKE_ID('M','A','I','N'),
                    MUIA_Window_Title, (IPTR)arosxc->name,
                    MUIA_HelpNode, (IPTR)libname,

                    WindowContents, (IPTR)VGroup,
                        Child, (IPTR)(gui->GamepadGroupObject = ColGroup(2),
                            GroupFrameT("Gamepad"),
                            MUIA_Disabled, TRUE,

                            Child, (IPTR)HGroup,
                            Child, (IPTR)(gui->GamepadObject_button_a = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_b = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_x = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_y = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_ls = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_rs = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_left_thumb = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_right_thumb = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_dpad_left = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_dpad_right = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_dpad_up = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_dpad_down = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_back = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),

                            Child, (IPTR)(gui->GamepadObject_button_start = ImageObject,
                                MUIA_Image_FontMatch, TRUE,
                                MUIA_Selected, FALSE,
                                MUIA_ShowSelState, FALSE,
                                MUIA_Image_Spec, MUII_RadioButton,
                                MUIA_Frame, MUIV_Frame_None,
                                End),
                            End,

                            Child, (IPTR)(gui->GamepadObject_left_trigger = GaugeObject,
                                GaugeFrame,
                                MUIA_Gauge_Max, 0xff,
                                MUIA_Gauge_InfoText, (IPTR)"%lx",
                                MUIA_Gauge_Horiz, TRUE,
                                MUIA_Gauge_Current, 0,
                                End),

                            Child, (IPTR)(gui->GamepadObject_right_trigger = GaugeObject,
                                GaugeFrame,
                                MUIA_Gauge_Max, 0xff,
                                MUIA_Gauge_InfoText, (IPTR)"%lx",
                                MUIA_Gauge_Horiz, TRUE,
                                MUIA_Gauge_Current, 0,
                                End),

                            Child, (IPTR)(gui->GamepadObject_left_stick_x = GaugeObject,
                                GaugeFrame,
                                MUIA_Gauge_Max, 0xffff,
                                MUIA_Gauge_InfoText, (IPTR)"%lx",
                                MUIA_Gauge_Horiz, TRUE,
                                MUIA_Gauge_Current, 0,
                                End),

                            Child, (IPTR)(gui->GamepadObject_left_stick_y = GaugeObject,
                                GaugeFrame,
                                MUIA_Gauge_Max, 0xffff,
                                MUIA_Gauge_InfoText, (IPTR)"%lx",
                                MUIA_Gauge_Horiz, TRUE,
                                MUIA_Gauge_Current, 0,
                                End),

                            Child, (IPTR)(gui->GamepadObject_right_stick_x = GaugeObject,
                                GaugeFrame,
                                MUIA_Gauge_Max, 0xffff,
                                MUIA_Gauge_InfoText, (IPTR)"%lx",
                                MUIA_Gauge_Horiz, TRUE,
                                MUIA_Gauge_Current, 0,
                                End),

                            Child, (IPTR)(gui->GamepadObject_right_stick_y = GaugeObject,
                                GaugeFrame,
                                MUIA_Gauge_Max, 0xffff,
                                MUIA_Gauge_InfoText, (IPTR)"%lx",
                                MUIA_Gauge_Horiz, TRUE,
                                MUIA_Gauge_Current, 0,
                                End),

                            End),

                        Child, (IPTR)VSpace(0),
                        Child, (IPTR)HGroup,
                            MUIA_Group_SameWidth, TRUE,
                            Child, (IPTR)(gui->UseObj = TextObject, ButtonFrame,
                                MUIA_Background, MUII_ButtonBack,
                                MUIA_CycleChain, 1,
                                MUIA_InputMode, MUIV_InputMode_RelVerify,
                                MUIA_Text_Contents, (IPTR)"\33c Save ",
                                End),
                            Child, (IPTR)(gui->CloseObj = TextObject, ButtonFrame,
                                MUIA_Background, MUII_ButtonBack,
                                MUIA_CycleChain, 1,
                                MUIA_InputMode, MUIV_InputMode_RelVerify,
                                MUIA_Text_Contents, (IPTR)"\33c Use ",
                                End),
                            End,
                        End,
                    End),
                End;

                if(gui->App) 
                {
                    DoMethod(gui->MainWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
                             gui->App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
                    DoMethod(gui->UseObj, MUIM_Notify, MUIA_Pressed, FALSE,
                             gui->App, 2, MUIM_Application_ReturnID, ID_STORE_CONFIG);
                    DoMethod(gui->CloseObj, MUIM_Notify, MUIA_Pressed, FALSE,
                             gui->App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);

                    DoMethod(gui->AboutMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
                             gui->App, 2, MUIM_Application_ReturnID, ID_ABOUT);
                    DoMethod(gui->UseMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
                             gui->App, 2, MUIM_Application_ReturnID, ID_STORE_CONFIG);
                    DoMethod(gui->MUIPrefsMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
                             gui->App, 2, MUIM_Application_OpenConfigWindow, 0);

                    IPTR  isopen = 0;
                    IPTR  iconify = 0;
                    ULONG sigs;
                    ULONG sigmask;
                    LONG retid;

                    get(gui->App, MUIA_Application_Iconified, &iconify);
                    set(gui->MainWindow, MUIA_Window_Open, TRUE);
                    get(gui->MainWindow, MUIA_Window_Open, &isopen);

                    if((isopen || (!iconify)))
                    {
                        sigmask = (1UL<<arosx_eventport->mp_SigBit);
                        do
                        {
                            retid = DoMethod(gui->App, MUIM_Application_NewInput, &sigs);
                            switch(retid)
                            {
                                case ID_ABOUT:
                                    MUI_RequestA(gui->App, gui->MainWindow, 0, NULL, "Fabulous!", VERSION_STRING, NULL);
                                    break;
                            }
                            if(retid == MUIV_Application_ReturnID_Quit)
                            {
                                break;
                            }
                            if(sigs)
                            {
                                sigs = Wait(sigs | sigmask | SIGBREAKF_CTRL_C);
                                if(sigs & SIGBREAKF_CTRL_C)
                                {
                                    break;
                                }

                                if(sigs & (1UL<<arosx_eventport->mp_SigBit)) {
                                    mybug(-1,("(%d) I may have received an event...\n", arosxc->id));
                                    struct AROSX_EventNote *en;
                                    while((en = (struct AROSX_EventNote *)GetMsg(arosx_eventport))) {
 
                                        mybug(-1,("    event %08lx\n", en->en_Event));

                                        /* TODO: GUI is disabled until we get the first message even on wired controllers... */
                                        if((arosxc->status.wireless)&&(arosxc->status.signallost)) {
                                            set(gui->GamepadGroupObject, MUIA_Disabled, TRUE);
                                        } else {
                                            set(gui->GamepadGroupObject, MUIA_Disabled, FALSE);

                                            set(gui->GamepadObject_button_a, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_A));
                                            set(gui->GamepadObject_button_b, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_B));
                                            set(gui->GamepadObject_button_x, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_X));
                                            set(gui->GamepadObject_button_y, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_Y));
                                            set(gui->GamepadObject_button_ls, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_LEFT_SHOULDER));
                                            set(gui->GamepadObject_button_rs, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_RIGHT_SHOULDER));
                                            set(gui->GamepadObject_left_thumb, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_LEFT_THUMB));
                                            set(gui->GamepadObject_right_thumb, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_RIGHT_THUMB));
                                            set(gui->GamepadObject_dpad_left, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_DPAD_LEFT));
                                            set(gui->GamepadObject_dpad_right, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_DPAD_RIGHT));
                                            set(gui->GamepadObject_dpad_up, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_DPAD_UP));
                                            set(gui->GamepadObject_dpad_down, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_DPAD_DOWN));
                                            set(gui->GamepadObject_button_back, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_BACK));
                                            set(gui->GamepadObject_button_start, MUIA_Selected, (arosx_gamepad->Buttons & AROSX_GAMEPAD_START));

                                            set(gui->GamepadObject_left_trigger, MUIA_Gauge_Current, (arosx_gamepad->LeftTrigger));
                                            set(gui->GamepadObject_right_trigger, MUIA_Gauge_Current, (arosx_gamepad->RightTrigger));

                                            if(arosx_gamepad->ThumbLX>=0x8000) {
                                                set(gui->GamepadObject_left_stick_x, MUIA_Gauge_Current, (arosx_gamepad->ThumbLX-0x8000));
                                            } else {
                                                set(gui->GamepadObject_left_stick_x, MUIA_Gauge_Current, (0x8000+arosx_gamepad->ThumbLX));
                                            }

                                            if(arosx_gamepad->ThumbLY>=0x8000) {
                                                set(gui->GamepadObject_left_stick_y, MUIA_Gauge_Current, (arosx_gamepad->ThumbLY-0x8000));
                                            } else {
                                                set(gui->GamepadObject_left_stick_y, MUIA_Gauge_Current, (0x8000+arosx_gamepad->ThumbLY));
                                            }

                                            if(arosx_gamepad->ThumbRX>=0x8000) {
                                                set(gui->GamepadObject_right_stick_x, MUIA_Gauge_Current, (arosx_gamepad->ThumbRX-0x8000));
                                            } else {
                                                set(gui->GamepadObject_right_stick_x, MUIA_Gauge_Current, (0x8000+arosx_gamepad->ThumbRX));
                                            }

                                            if(arosx_gamepad->ThumbRY>=0x8000) {
                                                set(gui->GamepadObject_right_stick_y, MUIA_Gauge_Current, (arosx_gamepad->ThumbRY-0x8000));
                                            } else {
                                                set(gui->GamepadObject_right_stick_y, MUIA_Gauge_Current, (0x8000+arosx_gamepad->ThumbRY));
                                            }
                                        }

                                        ReplyMsg((struct Message *)en);
                                    }
                                }
                            }
                        } while(TRUE);
                        set(gui->MainWindow, MUIA_Window_Open, FALSE);
                    }

                    if(gui->App)
                    {
                        MUI_DisposeObject(gui->App);
                        gui->App = NULL;
                    }

                    if(MUIMasterBase)
                    {
                        CloseLibrary(MUIMasterBase);
                        MUIMasterBase = NULL;
                    }

                    if(ps)
                    {
                        CloseLibrary(ps);
                        ps = NULL;
                    }
                }
            }
        }
        }

        AROSX_RemEventHandler(arosx_eventhook);
        CloseLibrary(AROSXBase);

        FreeVec(gui);

        Forbid();

        arosxc->GUITask = NULL;
        --arosxb->Library.lib_OpenCnt;

    }

    AROS_USERFUNC_EXIT
}
Ejemplo n.º 3
0
Object *ScreenModeProperties__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
{
    struct ScreenModeProperties_DATA *data;	 
    Object *width, *height, *depth,
           *def_width, *def_height;
	   
    Object *autoscroll;
    
    ULONG id;
    
    self = (Object *)DoSuperNewTags
    (
        CLASS, self, NULL,
	MUIA_Group_Horiz, TRUE,
        Child, (IPTR)ColGroup(4),
	    Child, (IPTR)Label1(__(MSG_WIDTH)),
	    Child, HLeft(width = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)(def_width = (Object *)CheckMarkObject, End),
	    Child, (IPTR)Label1(__(MSG_DEFAULT)),
	        
	    Child, (IPTR)Label1(__(MSG_HEIGHT)),
	    Child, HLeft(height = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)(def_height = (Object *)CheckMarkObject, End),
	    Child, (IPTR)Label1(__(MSG_DEFAULT)),
	        
	    Child, (IPTR)Label1(__(MSG_DEPTH)),
	    Child, HLeft(depth = (Object *)NumericbuttonObject, End),
	    Child, (IPTR)RectangleObject, End,
	    Child, (IPTR)RectangleObject, End,		
	End,  
	    
	Child, (IPTR)MUI_MakeObject(MUIO_VBar, 20),
	    
	Child, (IPTR)HCenter(HGroup,
	    Child, (IPTR)Label1(__(MSG_AUTOSCROLL)),
	    Child, (IPTR)(autoscroll = (Object *)CheckMarkObject, End),
	End),
	
        TAG_MORE, (IPTR)message->ops_AttrList
    );
    
    if (!self)
        goto err;
    
    data = INST_DATA(CLASS, self);    
    
    data->width      = width;
    data->height     = height;
    data->depth      = depth;
    data->def_width  = def_width;
    data->def_height = def_height;
    data->autoscroll = autoscroll;
    
    DoMethod
    (
        width, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Width, MUIV_TriggerValue
    );
    
    DoMethod
    (
        height, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Height, MUIV_TriggerValue
    );
    
    DoMethod
    (
        depth, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)self, 3,
	MUIM_Set, MUIA_ScreenModeProperties_Depth, MUIV_TriggerValue
    );
    
    DoMethod
    (
        def_width, MUIM_Notify, MUIA_Selected, TRUE,
	(IPTR)width, 1,
	MUIM_Numeric_SetDefault
    );

    DoMethod
    (
        width, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)def_width, 3,
	MUIM_Set, MUIA_Selected, FALSE
    );
    
    DoMethod
    (
        def_height, MUIM_Notify, MUIA_Selected, TRUE,
	(IPTR)height, 1,
	MUIM_Numeric_SetDefault
    );

    DoMethod
    (
        height, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
	(IPTR)def_height, 3,
	MUIM_Set, MUIA_Selected, FALSE
    );
        
    id = GetTagData(MUIA_ScreenModeProperties_DisplayID, INVALID_ID, message->ops_AttrList); 
    set(self, MUIA_ScreenModeProperties_DisplayID, id);
    
    return self;

err:
    CoerceMethod(CLASS, self, OM_DISPOSE);
    return NULL;
}
Ejemplo n.º 4
0
BOOL BuildGUI(char *screenname)
{
  Object *MUISave, *MUIUse, *MUICancel;
  Object *page1,*page2;
  Object *MUITFreq,*MUITChannels,*MUITOutvol,*MUITMonvol,*MUITGain,*MUITInput,*MUITOutput,*MUITDebug,*MUITEcho,*MUITSurround,*MUITClipvol,*MUITCpu,*MUITACTime,*MUITScalemode;

  UpdateStrings();

  MUIMasterBase = (void *)OpenLibrary("muimaster.library", MUIMASTER_VLATEST);
  if(MUIMasterBase == NULL)
  {
    Printf((char *) msgTextNoOpen, (ULONG) "muimaster.library", MUIMASTER_VLATEST);
    Printf("\n");
    return FALSE;
  }

  page1 = HGroup,
    Child, VGroup,
      Child, MUIUnit = CycleObject,
        MUIA_CycleChain, 1,
        MUIA_Cycle_Entries, Units,
        MUIA_Cycle_Active, state.UnitSelected,
      End,
      Child, ListviewObject,
        MUIA_CycleChain, 1,
        MUIA_Listview_List, MUIList = ListObject,
          InputListFrame,
          MUIA_List_AutoVisible, TRUE,
        End,
      End,
      Child, HGroup,
        ReadListFrame,
        MUIA_Background, MUII_TextBack,
        Child, TextObject,
          MUIA_Text_Contents, msgProperties,
          MUIA_Text_SetMax, TRUE,
        End,
        Child, MUIInfos = TextObject,
          MUIA_Text_Contents, "\n\n\n\n\n\n",
          MUIA_Text_SetMin, FALSE,
        End,
      End,
    End,
    Child, BalanceObject,
    End,
    Child, VGroup,
      Child, HVSpace,
      Child, ColGroup(3),
        GroupFrameT(msgOptions),
        Child, MUITFreq = SpecialButton((STRPTR)msgOptFrequency),
        Child, MUIFreq = SpecialSlider(0,max(state.Frequencies-1,0),state.FreqSelected),
        Child, MUILFreq = SpecialLabel(getFreq()),
        Child, MUITChannels = SpecialButton((STRPTR)msgOptChannels),
        Child, MUIChannels = SpecialSlider(1,state.Channels,state.ChannelsSelected),
        Child, MUILChannels = SpecialLabel(getChannels()),
        Child, MUITOutvol = SpecialButton((STRPTR)msgOptVolume),
        Child, MUIOutvol = SpecialSlider(0,max(state.OutVols-1,0),state.OutVolSelected),
        Child, MUILOutvol = SpecialLabel(getOutVol()),
        Child, MUITMonvol = SpecialButton((STRPTR)msgOptMonitor),
        Child, MUIMonvol = SpecialSlider(0,max(state.MonVols-1,1),state.MonVolSelected),
        Child, MUILMonvol = SpecialLabel(getMonVol()),
        Child, MUITGain = SpecialButton((STRPTR)msgOptGain),
        Child, MUIGain = SpecialSlider(0,max(state.Gains-1,0),state.GainSelected),
        Child, MUILGain = SpecialLabel(getGain()),
        Child, MUITInput = SpecialButton((STRPTR)msgOptInput),
        Child, MUIInput = SpecialSlider(0,max(state.Inputs-1,0),state.InputSelected),
        Child, MUILInput = SpecialLabel(getInput()),
        Child, MUITOutput = SpecialButton((STRPTR)msgOptOutput),
        Child, MUIOutput = SpecialSlider(0,max(state.Outputs-1,0),state.OutputSelected),
        Child, MUILOutput = SpecialLabel(getOutput()),
      End,
      Child, MUIPlay = SimpleButton(msgButtonPlay),
      Child, HVSpace,
    End,
  End;

  page2 = VGroup,
    Child, HVSpace,
    Child, HGroup,
      Child, HVSpace,
      Child, ColGroup(2),
        GroupFrameT(msgGlobalOptions),
        Child, MUITDebug = SpecialButton((STRPTR)msgGlobOptDebugLevel),
        Child, MUIDebug = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, DebugLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_DebugLevel,
        End,
        Child, MUITEcho = SpecialButton((STRPTR)msgGlobOptEcho),
        Child, MUIEcho  = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, EchoLabels,
          MUIA_Cycle_Active, (globalprefs.ahigp_DisableEcho ? 2 : 0) | (globalprefs.ahigp_FastEcho ? 1 : 0),
          MUIA_Disabled, AHIBase->lib_Version >= 5,
        End,
        Child, MUITSurround = SpecialButton((STRPTR)msgGlobOptSurround),
        Child, MUISurround = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, SurroundLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_DisableSurround,
          MUIA_Disabled, AHIBase->lib_Version >= 5,
        End,
        Child, MUITClipvol = SpecialButton((STRPTR)msgGlobOptMasterVol),
        Child, MUIClipvol = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, ClipMVLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_ClipMasterVolume,
          MUIA_Disabled, AHIBase->lib_Version >= 5,
        End,
        Child, MUITCpu = SpecialButton((STRPTR)msgGlobOptCPULimit),
        Child, MUICpu = SliderObject,
          MUIA_CycleChain, 1,
          MUIA_Slider_Horiz, TRUE,
          MUIA_Numeric_Min, 0,
          MUIA_Numeric_Max, 100,
          MUIA_Numeric_Value,(globalprefs.ahigp_MaxCPU * 100 + 32768) / 65536,
          MUIA_Numeric_Format,"%ld%%",
        End,
        Child, MUITACTime = SpecialButton((STRPTR)msgGlobOptACTime),
        Child, MUIACTime = SliderObject,
          MUIA_CycleChain, 1,
          MUIA_Slider_Horiz, TRUE,
          MUIA_Numeric_Min, 0,
          MUIA_Numeric_Max, 100,
          MUIA_Numeric_Value,(globalprefs.ahigp_AntiClickTime * 1000 + 32768) >> 16,
          MUIA_Numeric_Format,"%ld ms",
          MUIA_Disabled, AHIBase->lib_Version <= 4,
        End,
        Child, MUITScalemode = SpecialButton((STRPTR)msgOptScalemode),
        Child, MUIScalemode = CycleObject,
          MUIA_CycleChain, 1,
          MUIA_Cycle_Entries, ScaleLabels,
          MUIA_Cycle_Active, globalprefs.ahigp_ScaleMode,
          MUIA_Disabled, AHIBase->lib_Version <= 4,
        End,
      End,
      Child, HVSpace,
    End,
    Child, HVSpace,
  End;

  MUIApp = ApplicationObject,
    MUIA_Application_Title, (char *) msgTextProgramName,
    MUIA_Application_Version, Version,
    MUIA_Application_Copyright, "©1996-2004 Martin Blom",
    MUIA_Application_Author, "Stéphane Barbaray/Martin Blom",
    MUIA_Application_Base, "AHI",
    MUIA_Application_HelpFile, HELPFILE,
    MUIA_Application_Menustrip, MUIMenu = MUI_MakeObject(MUIO_MenustripNM,Menus,0),
    MUIA_Application_SingleTask, TRUE,
    SubWindow, MUIWindow = WindowObject,
      MUIA_Window_Title, (char *) msgTextProgramName,
      MUIA_Window_ID   , MAKE_ID('M','A','I','N'),
      MUIA_HelpNode, "AHI",
      WindowContents, VGroup,
       Child, RegisterGroup(PageNames),
         MUIA_CycleChain, 1,
         Child, page1,
         Child, page2,
       End,
       Child, HGroup,
          Child, MUISave = SimpleButton(msgButtonSave),
          Child, MUIUse = SimpleButton(msgButtonUse),
          Child, MUICancel = SimpleButton(msgButtonCancel),
        End,
      End,
    End,
  End;
  
  if( MUIApp != NULL )
  {
    APTR item = (APTR)DoMethod(MUIMenu,MUIM_FindUData,ACTID_ICONS);
    if(item)
    {
      set(item, MUIA_Menuitem_Checked, SaveIcons);
    }
    DoMethod(MUIWindow, MUIM_MultiSet, MUIA_Text_PreParse,"\033l",MUILFreq,MUILChannels,MUILOutvol,MUILMonvol,MUILGain,MUILInput,MUILOutput,NULL);
    DoMethod(MUIWindow, MUIM_MultiSet, MUIA_CycleChain, 1, MUISave,MUIUse,MUICancel,NULL);

    DoMethod(MUITFreq, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIFreq);
    DoMethod(MUITChannels, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIChannels);
    DoMethod(MUITOutvol, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIOutvol);
    DoMethod(MUITMonvol, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIMonvol);
    DoMethod(MUITGain, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIGain);
    DoMethod(MUITInput, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIInput);
    DoMethod(MUITOutput, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIOutput);
    DoMethod(MUIPlay, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, ACTID_PLAY);
    DoMethod(MUITDebug, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIDebug);
    DoMethod(MUITEcho, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIEcho);
    DoMethod(MUITSurround, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUISurround);
    DoMethod(MUITClipvol, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIClipvol);
    DoMethod(MUITCpu, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUICpu);
    DoMethod(MUITACTime, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIACTime);
    DoMethod(MUITScalemode, MUIM_Notify, MUIA_Pressed, TRUE, MUIWindow, 3, MUIM_Set, MUIA_Window_ActiveObject, MUIScalemode);

    DoMethod(MUIWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, MUIApp, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
    DoMethod(MUISave, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, ACTID_SAVE);
    DoMethod(MUIUse, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, ACTID_USE);
    DoMethod(MUICancel, MUIM_Notify, MUIA_Pressed, FALSE, MUIApp, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
    DoMethod(MUIUnit, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID, ACTID_UNIT);
    DoMethod(MUIList, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID, ACTID_MODE);
    DoMethod(MUIDebug, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_DEBUG);
    DoMethod(MUISurround, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_SURROUND);
    DoMethod(MUIEcho, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_ECHO);
    DoMethod(MUICpu, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_CPULIMIT);
    DoMethod(MUIClipvol, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_CLIPMV);
    DoMethod(MUIACTime, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_ACTIME);
    DoMethod(MUIScalemode, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime, MUIApp, 2, MUIM_Application_ReturnID,  ACTID_SCALEMODE);
    DoMethod(MUIFreq, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIChannels, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIOutvol, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIMonvol, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIGain, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIInput, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    DoMethod(MUIOutput, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, MUIV_Notify_Self, 3, MUIM_CallHook, &hookSlider, MUIV_TriggerValue);
    set(MUIWindow, MUIA_Window_Open, TRUE);
    GUINewUnit();
    return TRUE;
  }
  return FALSE;
}
Ejemplo n.º 5
0
static ULONG CreateObj(Object *o, SW_IDATA *idata, struct TagItem *ti)
{
   Object *g, *to, *b_Add, *b_Del, *b_Sort, *b_Reset,
          *b_MkDef = NULL, *b_RdEnv;

   ULONG    Tiny = GetTagUL(SWA_NServerList_Tiny,        NULL, ti);
   Object  *SObj = GetTagObj(SWA_NServerList_HostStrObj, NULL, ti);

   if (Tiny && !SObj) SWDB_RET(FAILURE);
   
   set(o, MUIA_Group_Horiz, FALSE);

   if (!Tiny) {
      DoMethod(o, OM_ADDMEMBER,
               to = SWUI_FrameText(GetS(SWS_L_TopTitle), 0,
                                   (HGroup,
                                    Child, (Object *)
                                       DoMethod(idata->SWA_NServerList_ListCol,
                                                SWM_ListCol_Popup,
                                                '-', GetS(SWS_H_ListCol)),
                                    Child, (Object *)
                                       DoMethod(idata->SWA_NServerList_ListCol,
                                                SWM_ListCol_ClipBt,
                                                'c', GetS(SWS_H_Clip)),
                                    End), NULL));

      if (!to) return FAILURE;
   }

   DoMethod(o, OM_ADDMEMBER,
            idata->SWA_NList_LV = ListviewObject,
            MUIA_CycleChain,           1,
            MUIA_Listview_Input,       TRUE,
            MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_Default,
            MUIA_Listview_DragType,    MUIV_Listview_DragType_Immediate,
            MUIA_Listview_List, idata->SWA_NList_L = ObjListObject,
            InputListFrame,
            SWA_ObjList_Object,       o,
            MUIA_List_Format,         DoMethod(idata->SWA_NServerList_ListCol,
                                               SWM_ListCol_BuildFmt),
            MUIA_List_DragSortable,  TRUE,
            MUIA_List_Title,         TRUE,
            MUIA_List_DisplayHook,   &idata->DspHook,
            MUIA_List_DestructHook,  &idata->DstHook,
            MUIA_List_CompareHook,   &idata->CmpHook,
            End,
          End);

   if (!idata->SWA_NList_LV) return FAILURE;

   SWM_SetListColNotify(idata->SWA_NServerList_ListCol, idata->SWA_NList_L);

   if (!Tiny) {
      static STRPTR TypeLab[4];

      TypeLab[0] = GetS(SWS_L_TypeNNTP);
      TypeLab[1] = GetS(SWS_L_TypeFTP);
      TypeLab[2] = NULL;
      
      DoMethod(idata->SWA_NList_L, MUIM_Notify,
               MUIA_List_Entries, MUIV_EveryTime,
               to, 4, MUIM_SetAsString, MUIA_Text_Contents,
               GetS(SWS_L_TopTitle), MUIV_TriggerValue);

      DoMethod(o, OM_ADDMEMBER,
               g = VGroup,
                  MUIA_Background, MUII_GroupBack,
                  Child, ColGroup(2),
                     Child, b_Add  = MkBt(SWS_B_Add,    SWS_H_Add),
                     Child, HGroup,
                        Child, s_Host = StringObject,
                                           StringFrame,
                                           MUIA_CycleChain,     1,
                                           MUIA_HorizWeight, 5000,
                                        End,
                        Child, Label2(GetS(SWS_L_Type)),
                        Child, s_Type = CycleObject,
                           MUIA_Cycle_Entries, TypeLab,
                           MUIA_CycleChain,    1,
                           MUIA_ShortHelp,     GetS(SWS_H_Type),
                           MUIA_Disabled,      TRUE,
                        End,
                     End,
                     Child, Label2(GetS(SWS_L_Port)),
                     Child, s_Port = NewObject(SWObjStringClass(), NULL,
                        StringFrame,
                        MUIA_CycleChain,    1,
                        MUIA_String_Accept, "0123456879",
                        MUIA_String_MaxLen,      8,
                        MUIA_ShortHelp,     GetS(SWS_H_Port),
                        MUIA_Disabled,      TRUE,
                        TAG_DONE),
                     Child, Label2(GetS(SWS_L_CxTO)),
                     Child, s_CxTO = NewObject(SWTimesliderClass(), NULL,
                                               MUIA_Numeric_Min,   5*1000,
                                               MUIA_Numeric_Max,   10*60*1000,
                                               MUIA_Numeric_Value, 30*1000,
                                               MUIA_CycleChain,    1,
                                               MUIA_ShortHelp, GetS(SWS_H_CxTO),
                                               MUIA_Disabled,      TRUE,
                                               TAG_DONE),
                     Child, Label2(GetS(SWS_L_CxRT)),
                     Child, s_CxRT = NewObject(SWTimesliderClass(), NULL,
                                               MUIA_Numeric_Min,   5*1000,
                                               MUIA_Numeric_Max,   10*60*1000,
                                               MUIA_Numeric_Value, 30*1000,
                                               MUIA_CycleChain,    1,
                                               MUIA_ShortHelp, GetS(SWS_H_CxRT),
                                               MUIA_Disabled,      TRUE,
                                               TAG_DONE),
                     Child, Label2(GetS(SWS_L_CxMR)),
                     Child, s_CxMR = SliderObject,
                        MUIA_Numeric_Min,   0,
                        MUIA_Numeric_Max,   50,
                        MUIA_Numeric_Value, 5,
                        MUIA_CycleChain,    1,
                        MUIA_ShortHelp,     GetS(SWS_H_CxMR),
                        MUIA_Disabled,      TRUE,
                     End,
                     Child, Label2(GetS(SWS_L_AUser)),
                     Child, HGroup,
                        Child, s_User = StringObject,
                                           StringFrame,
                                           MUIA_CycleChain,  1,
                                           MUIA_ShortHelp, GetS(SWS_H_AuthUser),
                                           MUIA_String_MaxLen, 48,
                                           MUIA_Disabled,      TRUE,
                                        End,
                        Child, Label2(GetS(SWS_L_APass)),
                        Child, s_Pass = StringObject,
                                           StringFrame,
                                           MUIA_CycleChain,    1,
                                           MUIA_String_Secret, TRUE,
                                           MUIA_ShortHelp, GetS(SWS_H_AuthPass),
                                           MUIA_String_MaxLen, 48,
                                           MUIA_Disabled,      TRUE,
                                        End,
                     End,
                  End,
                  Child, HGroup,
                     MUIA_Group_SameSize, TRUE,
                     Child, b_Del   = MkBt(SWS_B_Del,   SWS_H_Del),
                     Child, b_Sort  = MkBt(SWS_B_Sort,  SWS_H_Sort),
                     Child, b_Reset = MkBt(SWS_B_Reset, SWS_H_Reset),
                     Child, b_MkDef = MkBt(SWS_B_MkDef, SWS_H_MkDef),
                     Child, b_RdEnv = MkBt(SWS_B_RdEnv, SWS_H_RdEnv),
                  End,
               End);
      s_CxTOAttr  = SWA_NServer_CxTimeout;
      s_CxTODef   = 30*1000;
      s_CxTOGAttr = MUIA_Numeric_Value;
      s_CxRTAttr  = SWA_NServer_RetryDelay;
      s_CxRTDef   = 30*1000;
      s_CxRTGAttr = MUIA_Numeric_Value;
      s_CxMRAttr  = SWA_NServer_MaxRetries;
      s_CxMRDef   = 0,
      s_CxMRGAttr = MUIA_Numeric_Value;
      s_UserAttr  = SWA_NServer_AuthUser;
      s_PassAttr  = SWA_NServer_AuthPass;
      s_TypeAttr  = SWA_NServer_Type;
      s_TypeDef   = SWV_NServer_Type_NNTP;
      s_TypeGAttr = MUIA_Cycle_Active;
      s_PortAttr  = SWA_NServer_Port;
      s_PortGAttr = SWA_ObjString_NumVal;
   } else {
      if (!(idata->FmtSlider = NewObject(SWTimesliderClass(), NULL, TAG_DONE)))
         return FAILURE;
      
      DoMethod(o, OM_ADDMEMBER,
               g = HGroup,
                  MUIA_Background,     MUII_GroupBack,
                  MUIA_Group_SameSize, TRUE,
                  Child, b_Add   = MkBt(SWS_B_Add,   SWS_H_Add),
                  Child, b_Del   = MkBt(SWS_B_Del,   SWS_H_Del),
                  Child, b_Sort  = MkBt(SWS_B_Sort,  SWS_H_Sort),
                  Child, b_Reset = MkBt(SWS_B_Reset, SWS_H_Reset),
                  Child, b_RdEnv = MkBt(SWS_B_RdEnv, SWS_H_RdEnv),
               End);
      s_Host = SObj;
   }

   if (!g) return FAILURE;

   SetAttrs(s_Host,
            MUIA_Disabled,              TRUE,
            MUIA_String_AttachedList,   idata->SWA_NList_LV,
            TAG_DONE);

   s_HostAttr  = SWA_NServer_Host;

   DoMethod(b_Sort,  NOTP, o, 1, MUIM_List_Sort);
   DoMethod(b_Del,   NOTP, o, 1, SWM_NList_RemoveSel);
   DoMethod(b_Add,   NOTP, o, 2, SWM_NList_Add, NULL);
   DoMethod(b_RdEnv, NOTP, o, 2, SWM_NServerList_NNTPSERVER, TRUE);

   if (b_MkDef) {
      DoMethod(b_MkDef, NOTP, o, 1, SWM_NServerList_ResetDefault);
      DoMethod(b_MkDef, NOTP, o, 8, SWM_Root_ListDoMethod,
               idata->SWA_NList_LV, SWV_ListDoMethod_Active,
               SWV_ListDoMethod_Entry, 3,
               MUIM_Set, SWA_NServer_Default, TRUE);
   }

   DoMethod(b_Add, NOTP, MUIV_Notify_Window, 3,
            MUIM_Set, MUIA_Window_ActiveObject, s_Host);

   DoMethod(b_Reset, NOTP, o, 6, SWM_Root_ListDoMethod,
            idata->SWA_NList_LV,
            SWV_ListDoMethod_Selected, SWV_ListDoMethod_Entry, 1,
            SWM_NServer_ResetStats);

   setlent(o, SWA_ObjNoChildCopy, TRUE);

   return SUCCESS;
}
Ejemplo n.º 6
0
/******************************************************************
 Opens a group window
*******************************************************************/
static void group_window_open(struct addressbook_entry *entry)
{
	Object *wnd;
	Object *alias_string, *ok_button, *cancel_button;
	Object *description_string;
	int num;

	for (num=0; num < MAX_GROUP_OPEN; num++)
		if (!group_open[num]) break;

	wnd = WindowObject,
		(num < MAX_GROUP_OPEN)?MUIA_Window_ID:TAG_IGNORE, MAKE_ID('G','R','P',num),
    MUIA_Window_Title, "SimpleMail - Edit Group",
        
		WindowContents, VGroup,
			Child, VGroup,
				Child, ColGroup(2),
					Child, MakeLabel("Alias"),
					Child, alias_string = BetterStringObject,
						StringFrame,
						MUIA_CycleChain, 1,
						End,

					Child, MakeLabel("Description"),
					Child, description_string = BetterStringObject,
						StringFrame,
						MUIA_CycleChain, 1,
						End,
					End,
				End,

			Child, HorizLineObject,
			Child, HGroup,
				Child, ok_button = MakeButton("Ok"),
				Child, cancel_button = MakeButton("Cancel"),
				End,
			End,
		End;
	
	if (wnd)
	{
		struct Group_Data *data = (struct Group_Data*)malloc(sizeof(struct Group_Data));
		if (data)
		{
			data->wnd = wnd;
			data->alias_string = alias_string;
			data->description_string = description_string;
			data->group = entry;
			data->num = num;

			/* mark the window as opened */
			group_open[num] = 1;

			DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, App, 7, MUIM_Application_PushMethod, App, 4, MUIM_CallHook, &hook_standard, group_window_close, data);
			DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 7, MUIM_Application_PushMethod, App, 4, MUIM_CallHook, &hook_standard, group_window_close, data);
			DoMethod(ok_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 7, MUIM_Application_PushMethod, App, 4, MUIM_CallHook, &hook_standard, group_window_ok, data);
			DoMethod(App,OM_ADDMEMBER,wnd);

			/* A group must be changed */
			if (entry && entry->type == ADDRESSBOOK_ENTRY_GROUP)
			{
				set(alias_string, MUIA_String_Contents, entry->u.group.alias);
				set(description_string, MUIA_String_Contents, entry->u.group.description);
			}

			set(wnd,MUIA_Window_ActiveObject,alias_string);
			set(wnd,MUIA_Window_Open,TRUE);
			return;
		}
		MUI_DisposeObject(wnd);
	}
}
Ejemplo n.º 7
0
struct WCSScreenMode *ModeList_Choose(struct WCSScreenMode *This,
 struct WCSScreenData *ScrnData)
{
static const char *Cycle_OSCAN[] = {"None", "Text", "Standard", "Max", "Video", NULL};
struct WCSScreenMode *Scan, *Selected;
APTR ModeSelWin, SM_Save, SM_Use, SM_Exit, SM_Width, SM_Height, SM_List, SM_Text, SM_OSCAN;
ULONG Signalz, Finished, ReturnID;
int CheckVal, Update;
char *ModeText, ModeInfo[255];

ModeSelWin = WindowObject,
 MUIA_Window_Title, "World Construction Set Screenmode",
 MUIA_Window_ID, "SCRN",
 MUIA_Window_SizeGadget, TRUE,
 WindowContents, VGroup,
  Child, ColGroup(2), MUIA_Group_SameWidth, TRUE,
    MUIA_Group_HorizSpacing, 4, MUIA_Group_VertSpacing, 3,
   Child, VGroup, /* MUIA_HorizWeight, 150, */
    Child, TextObject, MUIA_Text_Contents, "\33cDisplay Mode", End,
    Child, SM_List = ListviewObject,
     MUIA_Listview_Input, TRUE,
     MUIA_Listview_List, ListObject, ReadListFrame, End,
     End,
    End,
   Child, VGroup,
    Child, TextObject, MUIA_Text_Contents, "\33cMode Information", End,
    Child, SM_Text = FloattextObject, ReadListFrame,
     MUIA_Floattext_Text, "Mode:           \nRes :                      \nAuto:            \nScan:                   \n\nAttributes\n\n\n", End,
    End,
   Child, HGroup,
    Child, Label2("Overscan: "),
    Child, SM_OSCAN = CycleObject, MUIA_Cycle_Entries, Cycle_OSCAN, End,
    End,
   Child, HGroup,
    Child, RectangleObject, End,
    Child, HGroup, MUIA_Group_HorizSpacing, 0,
     Child, Label2("Width "), /* No End (in sight) */
     Child, SM_Width = StringObject, StringFrame,
      MUIA_String_Integer, 0,
      MUIA_String_Accept, "0123456789",
      MUIA_FixWidthTxt, "01234",
      End,
     End,
    Child, RectangleObject, End,
    Child, HGroup, MUIA_Group_HorizSpacing, 0,
     Child, Label2("Height "), /* No End (in sight) */
     Child, SM_Height = StringObject, StringFrame,
      MUIA_String_Integer, 0,
      MUIA_String_Accept, "0123456789",
      MUIA_FixWidthTxt, "01234",
      End,
     End,
    Child, RectangleObject, End,
    End,
   End,
  Child, RectangleObject, MUIA_FixHeight, 4, End,
  Child, HGroup, MUIA_HorizWeight, 1,
   /* Button button button. Who's got the button? */
   MUIA_Group_SameSize, TRUE,
   Child, SM_Save = KeyButtonObject('s'), MUIA_Text_Contents, "\33cSave", MUIA_HorizWeight, 200, End,
   Child, RectangleObject, MUIA_HorizWeight, 1, End,
   Child, SM_Use  = KeyButtonObject('u'), MUIA_Text_Contents, "\33cUse", MUIA_HorizWeight, 200, End,
   Child, RectangleObject, MUIA_HorizWeight, 1, End,
   Child, SM_Exit = KeyButtonObject('e'), MUIA_Text_Contents, "\33cExit", MUIA_HorizWeight, 200, End,
   End,
  End,
 End;

if(ModeSelWin)
 {
 DoMethod(ModeSelWin, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
  app, 2, MUIM_Application_ReturnID, ID_SM_EXIT);

 MUI_DoNotiPresFal(app, SM_Exit, ID_SM_EXIT,
  SM_Use, ID_SM_USE, SM_Save, ID_SM_SAVE, NULL);
 
 DoMethod(SM_List, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
  app, 2, MUIM_Application_ReturnID, ID_SM_LIST);
 DoMethod(SM_OSCAN, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
  app, 2, MUIM_Application_ReturnID, ID_SM_OSCAN);
 DoMethod(SM_Width, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
  app, 2, MUIM_Application_ReturnID, ID_SM_WIDTH);
 DoMethod(SM_Height, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
  app, 2, MUIM_Application_ReturnID, ID_SM_HEIGHT);

 DoMethod(ModeSelWin, MUIM_Window_SetCycleChain,
  SM_List, SM_Save, SM_Use, SM_Exit, SM_OSCAN, SM_Width, SM_Height, NULL);

 set(ModeSelWin, MUIA_Window_ActiveObject, SM_Save);

 for(Scan = This; Scan; Scan = Scan->Next)
  {
  DoMethod(SM_List, MUIM_List_InsertSingle, Scan->ModeName, MUIV_List_Insert_Sorted);
  } /* for */
 
 set(SM_List, MUIA_List_Active, MUIV_List_Active_Top);

 DoMethod(app, OM_ADDMEMBER, ModeSelWin);
#ifdef WCS_MUI_2_HACK
/* This is not needed here, but will be when ScreenMode selection
** can be done from within the program. */

/*    MUI2_MenuCheck_Hack(); */
#endif /* WCS_MUI_2_HACK */
 set(ModeSelWin, MUIA_Window_Open, TRUE);
   } /* if */

Selected = This;

for(Finished = NULL; !Finished;)
 {
 if(ReturnID = DoMethod(app, MUIM_Application_Input, &Signalz))
  {
  switch(ReturnID)
   {
   case ID_SM_OSCAN:
    {
    /* Do not break, fall through to below. */
    } /* ID_SM_OSCAN */
   case ID_SM_LIST:
    {
    get(SM_List, MUIA_List_Active, &CheckVal);
    DoMethod(SM_List, MUIM_List_GetEntry, CheckVal, &ModeText);
    for(Scan = This; Scan;)
     {
     Selected = Scan;
     if((unsigned char *)&Scan->ModeName == ModeText)
      {
      Scan = NULL;
      } /* if */
     else
      Scan = Scan->Next;
     } /* for */

    get(SM_OSCAN, MUIA_Cycle_Active, &CheckVal);
    Update = 1;
    if(Selected->UX != Selected->OX)
     Update = 0;
    if(Selected->UY != Selected->OY)
     Update = 0;
    
    if(CheckVal == 0)
     {
     Selected->OX = Selected->X;
     Selected->OY = Selected->Y;
     } /* if */
    else
     {
     Selected->OX = Selected->OScans[CheckVal - 1].x;
     Selected->OY = Selected->OScans[CheckVal - 1].y;
     } /* else */
    if(Update)
     {
     Selected->UX = Selected->OX;
     Selected->UY = Selected->OY;
     } /* if */

    sprintf(ModeInfo, "Mode: 0x%08lx\nRes : %dx%d - %dx%d\nAuto: %dx%d\nScan: %dns\n\nAttributes\n",
     Selected->ModeID, Selected->X, Selected->Y, Selected->OX, Selected->OY,
     Selected->MaxX, Selected->MaxY, Selected->PixelSpeed);
    
    if(Selected->PropertyFlags & DIPF_IS_LACE)
     strcat(ModeInfo,"Laced ");
    if(Selected->PropertyFlags & DIPF_IS_HAM)
     strcat(ModeInfo,"HAM ");
    if(Selected->PropertyFlags & DIPF_IS_ECS)
     strcat(ModeInfo,"ECS ");
    if(Selected->PropertyFlags & DIPF_IS_AA)
     strcat(ModeInfo,"AGA ");
    if(Selected->PropertyFlags & DIPF_IS_PAL)
     strcat(ModeInfo,"PAL ");
    if(Selected->PropertyFlags & DIPF_IS_GENLOCK)
     strcat(ModeInfo,"Genlockable ");
    if(Selected->PropertyFlags & DIPF_IS_DRAGGABLE)
     strcat(ModeInfo,"Draggable ");
    if(Selected->PropertyFlags & DIPF_IS_PANELLED)
     strcat(ModeInfo,"Panelled ");
    if(Selected->PropertyFlags & DIPF_IS_EXTRAHALFBRITE)
     strcat(ModeInfo,"EHB ");
    if(Selected->PropertyFlags & DIPF_IS_FOREIGN)
     strcat(ModeInfo,"Foreign ");
    
    set(SM_Text, MUIA_Floattext_Text, ModeInfo);
    
    set(SM_Width, MUIA_String_Integer, Selected->UX);
    set(SM_Height, MUIA_String_Integer, Selected->UY);
    
    break;
    } /* ID_SM_LIST */
   case ID_SM_HEIGHT:
    {
    get(SM_Height, MUIA_String_Integer, &CheckVal);
    if(CheckVal < Selected->OY)
     {
     CheckVal = Selected->OY;
     set(SM_Height, MUIA_String_Integer, CheckVal);
     set(ModeSelWin, MUIA_Window_ActiveObject, SM_Height);
     } /* if */
    else if(CheckVal > Selected->MaxY)
     {
     CheckVal = Selected->MaxY;
     set(SM_Height, MUIA_String_Integer, CheckVal);
     set(ModeSelWin, MUIA_Window_ActiveObject, SM_Height);
     } /* else if */
    else
     set(ModeSelWin, MUIA_Window_ActiveObject, SM_Width);
    Selected->UY = CheckVal;
    break;
    } /* ID_SM_HEIGHT */
   case ID_SM_WIDTH:
    {
    get(SM_Width, MUIA_String_Integer, &CheckVal);
    if(CheckVal < Selected->OX)
     {
     CheckVal = Selected->OX;
     set(SM_Width, MUIA_String_Integer, CheckVal);
     set(ModeSelWin, MUIA_Window_ActiveObject, SM_Width);
     } /* if */
    else if(CheckVal > Selected->MaxX)
     {
     CheckVal = Selected->MaxX;
     set(SM_Width, MUIA_String_Integer, CheckVal);
     set(ModeSelWin, MUIA_Window_ActiveObject, SM_Width);
     } /* else if */
    else
     set(ModeSelWin, MUIA_Window_ActiveObject, SM_Height);
    Selected->UX = CheckVal;
    break;
    } /* ID_SM_WIDTH */
   case ID_SM_SAVE:
    {
    ScrnData->ModeID = Selected->ModeID;
    ScrnData->Width = Selected->UX;
    ScrnData->Height = Selected->UY;
    /* Do something more here */
    } /* ID_SM_SAVE */
   case ID_SM_USE:
    {
    
    Finished = 1;
    
    get(SM_Height, MUIA_String_Integer, &CheckVal);
    if(CheckVal < Selected->OY)
     {
     CheckVal = Selected->OY;
     set(SM_Height, MUIA_String_Integer, CheckVal);
     Finished = 0;
     } /* if */
    if(CheckVal > Selected->MaxY)
     {
     CheckVal = Selected->MaxY;
     set(SM_Height, MUIA_String_Integer, CheckVal);
     Finished = 0;
     } /* if */
    Selected->UY = CheckVal;

    get(SM_Width, MUIA_String_Integer, &CheckVal);
    if(CheckVal < Selected->OX)
     {
     CheckVal = Selected->OX;
     set(SM_Width, MUIA_String_Integer, CheckVal);
     Finished = 0;
     } /* if */
    if(CheckVal > Selected->MaxX)
     {
     CheckVal = Selected->MaxX;
     set(SM_Width, MUIA_String_Integer, CheckVal);
     Finished = 0;
     } /* if */
    Selected->UX = CheckVal;
    
    if(Finished)
     {
     DoMethod(app, OM_REMMEMBER, ModeSelWin);
     MUI_DisposeObject(ModeSelWin);
     return(Selected);
     } /* if */
    break;
    } /* ID_SM_USE */
   case ID_SM_EXIT:
    {
    return(NULL);
    break;
    } /* ID_SM_EXIT */
   } /* switch */
  } /* if */
 else
  {
  if(!Finished)
   {
   Wait(Signalz);
   } /* if */
  } /* else */
 } /* for */


#ifdef PRINTMODES_DEBUG
for(Scan = This; Scan; Scan = Scan->Next)
 {
 printf("%08lx: ", Scan->ModeID);
 printf("\"%s\" ", Scan->ModeName);
 printf("%ld x %ld - %ld x %ld.\n", Scan->X, Scan->Y, Scan->OX, Scan->OY);
 printf("%dns ", Scan->PixelSpeed);
 if(Scan->PropertyFlags & DIPF_IS_LACE)
  printf("Laced ");
 if(Scan->PropertyFlags & DIPF_IS_HAM)
  printf("HAM ");
 if(Scan->PropertyFlags & DIPF_IS_ECS)
  printf("ECS ");
 if(Scan->PropertyFlags & DIPF_IS_AA)
  printf("AGA ");
 if(Scan->PropertyFlags & DIPF_IS_PAL)
  printf("PAL ");
 if(Scan->PropertyFlags & DIPF_IS_GENLOCK)
  printf("Genlockable ");
 if(Scan->PropertyFlags & DIPF_IS_DRAGGABLE)
  printf("Draggable ");
 if(Scan->PropertyFlags & DIPF_IS_PANELLED)
  printf("Panelled ");
 if(Scan->PropertyFlags & DIPF_IS_EXTRAHALFBRITE)
  printf("EHB ");
 if(Scan->PropertyFlags & DIPF_IS_FOREIGN)
  printf("Foreign ");
 printf("\n");

 } /* for */
#endif /* PRINTMODES_DEBUG */


} /* ModeList_Choose() */
Ejemplo n.º 8
0
/**
 * Initialize the filter window.
 */
static void init_filter(void)
{
	static struct Hook filter_construct_hook;
	static struct Hook filter_destruct_hook;
	static struct Hook filter_display_hook;
	static struct Hook move_objstr_hook, move_strobj_hook;
	Object *ok_button, *cancel_button, *save_button;
	Object *filter_move_popobject, *filter_remote_label;

	init_hook(&filter_construct_hook,(HOOKFUNC)filter_construct);
	init_hook(&filter_destruct_hook,(HOOKFUNC)filter_destruct);
	init_hook(&filter_display_hook,(HOOKFUNC)filter_display);
	init_hook(&move_objstr_hook, (HOOKFUNC)move_objstr);
	init_hook(&move_strobj_hook, (HOOKFUNC)move_strobj);

	filter_wnd = WindowObject,
		MUIA_Window_ID, MAKE_ID('F','I','L','T'),
		MUIA_Window_Title, _("SimpleMail - Edit Filter"),
		WindowContents, VGroup,
			Child, VGroup,
				Child, HGroup,
					Child, VGroup,
						MUIA_HorizWeight,40,
						Child, VGroup,
							MUIA_Group_Spacing, 0,
							Child, NListviewObject,
								MUIA_NListview_NList, filter_list = FilterListObject,
									MUIA_NList_AutoVisible, 1, /* keep the active filter visible */
									MUIA_NList_ConstructHook, &filter_construct_hook,
									MUIA_NList_DestructHook, &filter_destruct_hook,
									MUIA_NList_DisplayHook, &filter_display_hook,
									End,
								End,
							Child, HGroup,
								Child, filter_name_string = UTF8StringObject,
									StringFrame,
									End,
								End,
							End,
						Child, ColGroup(2),
							Child, filter_new_button = MakeButton(_("_New")),
							Child, filter_remove_button = MakeButton(_("_Remove")),
							Child, filter_moveup_button = MakeButton(_("Move up")),
							Child, filter_movedown_button = MakeButton(_("Move Down")),
							End,
						End,
					Child, BalanceObject, End,
					Child, VGroup,
						Child, HorizLineTextObject(_("Activity")),
						Child, HGroup,
							Child, RectangleObject,MUIA_Weight,25,End,
							Child, ColGroup(5),
								Child, MakeLabel(_("On request")),
								Child, filter_request_check = MakeCheck(NULL,FALSE),
								Child, RectangleObject,MUIA_Weight,200,End,
								Child, MakeLabel(_("On sent mails")),
								Child, filter_sent_check = MakeCheck(NULL,FALSE),

								Child, filter_remote_label = MakeLabel(_("Remotly on POP3 server")),
								Child, filter_remote_check = MakeCheck(NULL,FALSE),
								Child, RectangleObject,MUIA_Weight,200,End,
								Child, MakeLabel(_("On new mails")),
								Child, filter_new_check = MakeCheck(NULL,FALSE),
								End,
							Child, RectangleObject,MUIA_Weight,25,End,
							End,
						Child, HorizLineTextObject(_("Rules")),
						Child, VGroupV,
							Child, filter_rule_group = ColGroup(2),
								Child, HVSpace,
								Child, HVSpace,
								End,
							End,
						Child, HGroup,
							Child, filter_add_rule_button = MakeButton(_("Add new rule")),
							Child, filter_apply_now_button = MakeButton(_("Apply now")),
							End,
						Child, HorizLineTextObject(_("Action")),
						Child, VGroup,
							Child, ColGroup(3),
								Child, MakeLabel(_("Move to Folder")),
								Child, filter_move_check = MakeCheck(_("Move to Folder"),FALSE),
								Child, filter_move_popobject = PopobjectObject,
									MUIA_Disabled, TRUE,
									MUIA_Popstring_Button, PopButton(MUII_PopUp),
									MUIA_Popstring_String, filter_move_text = TextObject, TextFrame, MUIA_Background, MUII_TextBack, End,
									MUIA_Popobject_ObjStrHook, &move_objstr_hook,
									MUIA_Popobject_StrObjHook, &move_strobj_hook,
									MUIA_Popobject_Object, NListviewObject,
										MUIA_NListview_NList, filter_folder_list = FolderTreelistObject,
											End,
										End,
									End,

								Child, MakeLabel(_("Execute ARexx Script")),
								Child, filter_arexx_check = MakeCheck(_("Execute ARexx Script"),FALSE),
								Child, filter_arexx_popasl = PopaslObject,
									MUIA_Disabled, TRUE,
									MUIA_Popstring_Button, PopButton(MUII_PopFile),
									MUIA_Popstring_String, filter_arexx_string = BetterStringObject,
										StringFrame,
										MUIA_CycleChain,1,
										MUIA_String_Acknowledge, TRUE,
										End,
									End,

								Child, MakeLabel(_("Play Sound")),
								Child, filter_sound_check = MakeCheck(_("Play Sound"),FALSE),
								Child, filter_sound_string = AudioSelectGroupObject, MUIA_Disabled, TRUE, End,

								End,
							End,
						End,
					End,
				End,
			Child, HorizLineObject,
			Child, HGroup,
				Child, save_button = MakeButton(Q_("?filter:_Save")),
				Child, ok_button = MakeButton(_("_Use")),
				Child, cancel_button = MakeButton(_("_Cancel")),
				End,
			End,
		End;

	if (filter_wnd)
	{
		char *short_help_txt = _("If activated the filter will be used remotly on POP3 servers\n"
                             "which support the TOP command. Mails which matches the filter\n"
														 "are presented to the user and automatically marked as to be ignored.");

		set(filter_remote_label, MUIA_ShortHelp, short_help_txt);
		set(filter_remote_check, MUIA_ShortHelp, short_help_txt);

		DoMethod(App, OM_ADDMEMBER, (ULONG)filter_wnd);
		DoMethod(filter_wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_cancel);
		DoMethod(ok_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_ok);
		DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_ok);
		DoMethod(save_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)save_filter);
		DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_cancel);

		DoMethod(filter_new_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_new);
		DoMethod(filter_remove_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_remove);
		DoMethod(filter_moveup_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_list, 3, MUIM_NList_Move, MUIV_NList_Move_Active, MUIV_NList_Move_Previous);
		DoMethod(filter_movedown_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_list, 3, MUIM_NList_Move, MUIV_NList_Move_Active, MUIV_NList_Move_Next);

		set(filter_name_string, MUIA_String_AttachedList, (ULONG)filter_list);
		DoMethod(filter_list, MUIM_Notify, MUIA_NList_Active, MUIV_EveryTime, (ULONG)filter_list, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_active);
		DoMethod(filter_name_string, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, (ULONG)filter_list, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_name);

		DoMethod(filter_add_rule_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_add_rule_gui);
		DoMethod(filter_apply_now_button, MUIM_Notify, MUIA_Pressed, FALSE, (ULONG)filter_wnd, 3, MUIM_CallHook, (ULONG)&hook_standard, (ULONG)filter_apply);
		DoMethod(filter_move_check, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, (ULONG)filter_move_popobject, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue);
		DoMethod(filter_sound_check, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, (ULONG)filter_sound_string, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue);
		DoMethod(filter_arexx_check, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, (ULONG)filter_arexx_popasl, 3, MUIM_Set, MUIA_Disabled, MUIV_NotTriggerValue);
		DoMethod(filter_folder_list, MUIM_Notify, MUIA_NList_DoubleClick, TRUE, (ULONG)filter_move_popobject, 2, MUIM_Popstring_Close, 1);

		filter_update_folder_list();
	}
}
Ejemplo n.º 9
0
/*** Methods ****************************************************************/
Object * NetPEditor__OM_NEW(Class *CLASS, Object *self, struct opSet *message)
{
    Object  *deviceString, *IPString, *maskString, *gateString,
            *DNSString[2], *hostString, *domainString, *DHCPState, *autostart;

    DHCPCycle[0] = _(MSG_IP_MODE_MANUAL);
    DHCPCycle[1] = _(MSG_IP_MODE_DHCP);

    NetworkTabs[0] = _(MSG_TAB_IP_CONFIGURATION);
    NetworkTabs[1] = _(MSG_TAB_COMPUTER_NAME);

    self = (Object *)DoSuperNewTags
           (
               CLASS, self, NULL,

               MUIA_PrefsEditor_Name, __(MSG_NAME),
               MUIA_PrefsEditor_Path, (IPTR)"AROSTCP/arostcp.prefs",


               Child, RegisterGroup((IPTR)NetworkTabs),
               Child, (IPTR)ColGroup(2),
               Child, (IPTR)Label2(__(MSG_DEVICE)),Child, (IPTR)PopaslObject,
               MUIA_Popasl_Type,              ASL_FileRequest,
               ASLFO_MaxHeight,               100,
               MUIA_Popstring_String,  (IPTR)(deviceString = (Object *)StringObject, TextFrame, MUIA_Background, MUII_TextBack, End),
               MUIA_Popstring_Button,  (IPTR)PopButton(MUII_PopUp),
               End,

               Child, (IPTR)Label2(__(MSG_IP_MODE)), Child, (IPTR)(DHCPState = (Object *)CycleObject, MUIA_Cycle_Entries, (IPTR)DHCPCycle, End),
               Child, (IPTR)Label2(__(MSG_IP)), Child, (IPTR)(IPString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_MASK)),Child, (IPTR)(maskString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_GATE)),Child, (IPTR)(gateString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_DNS1)),Child, (IPTR)(DNSString[0] = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_DNS2)),Child, (IPTR)(DNSString[1] = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789.", End),
               Child, (IPTR)Label2(__(MSG_AUTOSTART_STACK)),
               Child, (IPTR)HGroup,
               Child, (IPTR)(autostart = MUI_MakeObject(MUIO_Checkmark, NULL)),
               Child, (IPTR)HVSpace,
               End,
               End,

               Child, (IPTR)ColGroup(2),
               Child, (IPTR)Label2(__(MSG_HOST_NAME)), Child, (IPTR)(hostString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789abcdefghijklmnopqrstuvwxyz-", End),
               Child, (IPTR)Label2(__(MSG_DOMAIN_NAME)), Child, (IPTR)(domainString = (Object *)StringObject, TextFrame, MUIA_String_Accept, (IPTR)"0123456789abcdefghijklmnopqrstuvwxyz-.", End),
               End,

               End, // register

               TAG_DONE
           );


    if (self != NULL) {
        struct NetPEditor_DATA *data = INST_DATA(CLASS, self);
        data->netped_deviceString  = deviceString;
        data->netped_IPString = IPString;
        data->netped_maskString = maskString;
        data->netped_gateString = gateString;
        data->netped_DNSString[0] = DNSString[0];
        data->netped_DNSString[1] = DNSString[1];
        data->netped_hostString = hostString;
        data->netped_domainString = domainString;
        data->netped_DHCPState = DHCPState;
        data->netped_Autostart = autostart;

        /*-- Setup notifications -------------------------------------------*/
        DoMethod
        (
            deviceString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            IPString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            maskString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );

        DoMethod
        (
            gateString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            DNSString[0], MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            DNSString[1], MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            hostString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            domainString, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            autostart, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
            (IPTR)self, 3, MUIM_Set, MUIA_PrefsEditor_Changed, TRUE
        );
        DoMethod
        (
            DHCPState, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
            (IPTR)self, 1, MUIM_NetPEditor_IPModeChanged

        );
    }

    return self;
}
Ejemplo n.º 10
0
int joyai_config(int joy)
{
    BOOL running = TRUE;
    keysym_type *keysym = (joy == 2) ? keysym_2 : keysym_1;
    ULONG signals;

    if (!amigainput_lib_loaded) {
        return -1;
    }

    if (CTX == NULL) {
        return -1;
    }

    get_cfg(joy);
    ai_release();

    memset(&devices, 0, sizeof(devices));
    memset(&inputs, 0, sizeof(inputs));

    if (joy_id[joy - 1] != -1) {
        ai_handle[0] = AIN_ObtainDevice(CTX, joy_id[joy - 1]);
        if (ai_handle[0] != NULL) {
            AIN_ReleaseDevice(CTX, ai_handle[0]);
            ai_handle[0] = NULL;
        } else {
            joy_id[joy - 1] = -1;
        }
    }

    devices.ids[devices.count] = -1;
    devices.names[devices.count] = lib_stralloc("-");
    devices.count++;

    default_id = joy_id[joy - 1];
    default_count = 0;

    AIN_EnumDevices(CTX, enumfunc, &devices);

    update_inputs(joy_id[joy - 1]);

    {
        APTR label, text[NUM_KEYSYM], button, app, main_group, window, ok, cancel, Odevice, Oinput[NUM_KEYSYM];

        app = ApplicationObject,
                MUIA_Application_Author, "Mathias Roslund & Marco van den Heuvel",
                MUIA_Application_Base, KEYNAME,
                MUIA_Application_Title, KEYNAME,
                MUIA_Application_Version, "$VER: " KEYNAME " v1.0",
                MUIA_Application_Copyright, "Mathias Roslund & Marco van den Heuvel",
                MUIA_Application_Description, "Versatile Commodore Emulator",
                SubWindow, window = WindowObject,
                MUIA_Window_Title, KEYNAME,
                MUIA_Window_ID, MAKE_ID('0', 'W', 'I', 'N'),
                MUIA_Window_Screen, canvaslist->os->screen,
                WindowContents, VGroup,
                Child, HGroup,
                Child, TextObject,
                MUIA_Text_PreParse, "\033r",
                MUIA_Text_Contents, "AI Device",
                MUIA_Weight, 0,
                MUIA_InnerLeft, 0,
                MUIA_InnerRight, 0,
                End,
                Child, Odevice = CycleObject,
                MUIA_Cycle_Entries, devices.names,
	          MUIA_Cycle_Active, default_count,
                End,
                End,
                Child, main_group = ColGroup(4),
                End,
                Child, HGroup,
                Child, ok = TextObject,
                ButtonFrame,
                MUIA_Background, MUII_ButtonBack,
                MUIA_Text_Contents, "Ok",
                MUIA_Text_PreParse, "\033c",
                MUIA_InputMode, MUIV_InputMode_RelVerify,
                End,
                Child, cancel = TextObject,
                ButtonFrame,
                MUIA_Background, MUII_ButtonBack,
                MUIA_Text_Contents, "Cancel",
                MUIA_Text_PreParse, "\033c",
                MUIA_InputMode, MUIV_InputMode_RelVerify,
                End,
                End,
                End,
                End,
                End;

        if (app) {
            unsigned int i;

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

            DoMethod(Odevice, MUIM_Notify, MUIA_Cycle_Active, MUIV_EveryTime,
                     app, 2, MUIM_Application_ReturnID, DEV_CHANGE);

            DoMethod(cancel, MUIM_Notify, MUIA_Pressed, FALSE,
                     app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);

            DoMethod(ok, MUIM_Notify, MUIA_Pressed, FALSE,
                     app, 2, MUIM_Application_ReturnID, BTN_OK);

            for (i = 0; i < NUM_KEYSYM; i++) {

                /* label */
                label = TextObject,
                          MUIA_Text_PreParse, "\033r",
                          MUIA_Text_Contents, keysym[i].label,
                          MUIA_InnerLeft, 0,
                          MUIA_InnerRight, 0,
                        End;

                Oinput[i] = CycleObject,
                              MUIA_Cycle_Entries, inputs.names,
                              MUIA_Cycle_Active, offset_to_active(keysym[i].type, keysym[i].offset),
                            End,

                text[i] = TextObject,
                            MUIA_Background, MUII_TextBack,
                            MUIA_Frame, MUIV_Frame_Text,
                            MUIA_Text_Contents, rawkey_to_name(keysym[i].rawkey),
                          End;

                button = TextObject,
                           ButtonFrame,
                           MUIA_Background, MUII_ButtonBack,
                           MUIA_Text_Contents, "Change",
                           MUIA_Text_PreParse, "\033c",
                           MUIA_InputMode, MUIV_InputMode_RelVerify,
                         End;

                DoMethod(button, MUIM_Notify, MUIA_Pressed, FALSE,
                         app, 2, MUIM_Application_ReturnID, (i + 1));

                /* add to window */

                DoMethod(main_group, OM_ADDMEMBER, label);
                DoMethod(main_group, OM_ADDMEMBER, Oinput[i]);
                DoMethod(main_group, OM_ADDMEMBER, text[i]);
                DoMethod(main_group, OM_ADDMEMBER, button);

            }
        }

        if (app) {
            unsigned int i;

            set(window, MUIA_Window_Open, TRUE);
            while (running) {
                unsigned long retval = DoMethod(app, MUIM_Application_Input, &signals);

                switch (retval) {
                    case MUIV_Application_ReturnID_Quit:
                        running = FALSE;
                        break;
                    case BTN_OK:
                        for (i = 0; i < NUM_KEYSYM; i++) {
                            ULONG active;

                            get(Oinput[i], MUIA_Cycle_Active, &active);
                            keysym[i].type = inputs.types[active];
                            keysym[i].offset = inputs.offsets[active];
                        }
                        set_cfg(joy);
                        running = FALSE;
                        break;
                    case DEV_CHANGE:
                        {
                            ULONG active;

                            get(Odevice, MUIA_Cycle_Active, &active);
                            joy_id[joy - 1] = devices.ids[active];
                            update_inputs(joy_id[joy - 1]);
                            for (i = 0; i < NUM_KEYSYM; i++) {
                                set(Oinput[i], MUIA_Cycle_Entries, inputs.names);
                                set(Oinput[i], MUIA_Cycle_Active, 0);
                            }
                        }
                        break;
                    default:
                        if ((retval >= 1) && (retval <= (1 + NUM_KEYSYM))) {
                            int keycode, index, result;
                            result = get_key(joy_id[joy - 1], &keycode, &index);
                            if (result == 1) { /* KEY */
                                keysym[retval - 1].rawkey = keycode;
                                set(text[retval - 1], MUIA_Text_Contents, rawkey_to_name(keycode));
                            } else if (result == 2) { /* AI */
                                index = offset_to_index(index);
                                if (index >= 0) {
                                    set(Oinput[retval - 1], MUIA_Cycle_Active, index);
                                }
                            }
                        }
                        break;
                }
                if (running && signals) {
                    Wait(signals);
                }
            }
            MUI_DisposeObject(app);
        }  
    }

#undef DEV_CHANGE
#undef BTN_OK

    ai_attach();

    return 0;
}
Ejemplo n.º 11
0
static ULONG CreateObj(Object *o, SW_IDATA *idata, struct TagItem *ti)
{
   Object *g, *to, *b_Add = NULL, *b_Del, *b_Edit, *b_SelAll, *b_Xfer;

   set(o, MUIA_Group_Horiz, FALSE);

   // -- set init-time attrs for saved/postdir -------------------------------
   
   idata->SWA_NPostList_PostDir =
      (idata->SWA_NPostList_Saved = GetTagUL(SWA_NPostList_Saved, FALSE, ti)) ?
         SWV_NPostList_PostSvDir : SWV_NPostList_DefPostDir;

   DoMethod(o, OM_ADDMEMBER,
            to = SWUI_FrameText(GetS(SWS_L_TopTitle), 0,
                                (HGroup,
                                 Child, (Object *)
                                    DoMethod(idata->SWA_NPostList_ListCol,
                                             SWM_ListCol_Popup,
                                             '-', GetS(SWS_H_ListCol)),
                                 Child, (Object *)
                                    DoMethod(idata->SWA_NPostList_ListCol,
                                             SWM_ListCol_ClipBt,
                                             'c', GetS(SWS_H_Clip)),
                                 End), NULL));

   if (!to) return FAILURE;

   DoMethod(o, OM_ADDMEMBER,
            idata->SWA_NList_LV = ListviewObject,
            MUIA_CycleChain,           1,
            MUIA_ShortHelp,            GetS(SWS_H_List),
            MUIA_Listview_Input,       TRUE,
            MUIA_Listview_MultiSelect, MUIV_Listview_MultiSelect_Default,
            MUIA_Listview_DragType,    MUIV_Listview_DragType_Immediate,
            MUIA_Listview_List, idata->SWA_NList_L = ObjListObject,
            InputListFrame,
            SWA_ObjList_Object,       o,
            MUIA_List_Format,         DoMethod(idata->SWA_NPostList_ListCol,
                                               SWM_ListCol_BuildFmt),
            MUIA_List_DragSortable,  TRUE,
            MUIA_List_Title,         TRUE,
            MUIA_List_DisplayHook,   &idata->DspHook,
            MUIA_List_DestructHook,  &idata->DstHook,
            MUIA_List_CompareHook,   &idata->CmpHook,
            End,
          End);

   if (!idata->SWA_NList_LV) return FAILURE;

   SWM_SetListColNotify(idata->SWA_NPostList_ListCol, idata->SWA_NList_L);

   DoMethod(idata->SWA_NList_L, MUIM_Notify,
            MUIA_List_Entries, MUIV_EveryTime,
            to, 4, MUIM_SetAsString, MUIA_Text_Contents,
            GetS(SWS_L_TopTitle), MUIV_TriggerValue);

   idata->SWA_AppBase_TopObj = GetTagObj(SWA_AppBase_TopObj, NULL, ti);

   if (idata->SWA_NPostList_Saved) {
      DoMethod(o, OM_ADDMEMBER,
               g = VGroup,
                  MUIA_Background, MUII_GroupBack,
                  Child, ColGroup(2),
                     Child, Label2(GetS(SWS_L_Subj)),
                     Child, s_Subj  = MkTO(),
                     Child, Label2(GetS(SWS_L_Grp)),
                     Child, s_Grp  = MkTO(),
                  End,
                  Child, HGroup,
                     MUIA_Group_SameSize, TRUE,
                     Child, b_Xfer   = MkBt(SWS_B_MoveToOut, SWS_H_MoveToOut),
                     Child, b_Del    = MkBt(SWS_B_Del,       SWS_H_Del),
                     Child, b_Edit   = MkBt(SWS_B_Edit,      SWS_H_Edit),
                     Child, b_SelAll = MkBt(SWS_B_SelAll,    SWS_H_SelAll),
                  End,
               End);

      s_SubjGAttr = MUIA_Text_Contents;
      s_GrpGAttr  = MUIA_Text_Contents;

      LDoM(o, idata, b_Edit, SWM_NPost_Edit, TRUE);

      DoMethod(idata->SWA_NList_LV, DCLK,
               o, 7, SWM_Root_ListDoMethod, idata->SWA_NList_L,
               SWV_ListDoMethod_Active, SWV_ListDoMethod_Entry, 2,
               SWM_NPost_Edit, TRUE);
   } else {
      DoMethod(o, OM_ADDMEMBER,
               g = VGroup,
                  MUIA_Background, MUII_GroupBack,
                  Child, ColGroup(2),
                     Child, Label2(GetS(SWS_L_Subj)),
                     Child, s_Subj  = StringObject,
                                        StringFrame,
                                        MUIA_CycleChain,        1,
                                        MUIA_HorizWeight,    5000,
                                        MUIA_String_MaxLen,  8192,
                                      End,
                     Child, Label2(GetS(SWS_L_Grp)),
                     Child, idata->GLPop = NewObject(NGListClass(), NULL,
                                                     SWA_AppBase_TopObj,
                                                       idata->SWA_AppBase_TopObj,
                                                     SWA_NGList_HelpL,
                                                       GetS(SWS_NG_H_Left),
                                                     SWA_NGList_HelpR,
                                                       GetS(SWS_NG_H_Right),
                                                     TAG_DONE),
                  End,
                  Child, HGroup,
                     MUIA_Group_SameSize, TRUE,
                     Child, b_Add         = MkBt(SWS_B_Add,       SWS_H_Add),
                     Child, b_Del         = MkBt(SWS_B_Del,       SWS_H_Del),
                     Child, b_Edit        = MkBt(SWS_B_Edit,      SWS_H_Edit),
                     Child, idata->b_Post = MkBt(SWS_B_Post,      SWS_H_Post),
                     Child, b_SelAll      = MkBt(SWS_B_SelAll,    SWS_H_SelAll),
                     Child, b_Xfer        = MkBt(SWS_B_MoveToSent,SWS_H_MoveToSent),
                  End,
               End);

                                      
      s_Grp  = SWGetObj(idata->GLPop, SWA_NGList_Str);

      LDoM(o, idata, b_Edit, SWM_NPost_Edit, FALSE);

      DoMethod(idata->SWA_NList_LV, DCLK,
               o, 7, SWM_Root_ListDoMethod, idata->SWA_NList_L,
               SWV_ListDoMethod_Active, SWV_ListDoMethod_Entry, 2,
               SWM_NPost_Edit, FALSE);
   }

   s_SubjAttr  = SWA_NPost_Subj;
   s_GrpAttr   = SWA_NPost_Grp;
   
   if (!g) return FAILURE;

   DoMethod(b_SelAll, NOTP, idata->SWA_NList_L, 4,
            MUIM_List_Select, MUIV_List_Select_All, MUIV_List_Select_On, NULL);

   DoMethod(b_Xfer, NOTP, o, 1, SWM_NPostList_XferSel);
   
   if (b_Add) {
      DoMethod(b_Add,   NOTP, o, 2, SWM_NList_Add, NULL);
      DoMethod(b_Add,   NOTP, MUIV_Notify_Window, 3,
               MUIM_Set, MUIA_Window_ActiveObject, s_Subj);
   }

   LDoM(o, idata, b_Del, SWM_NPost_Delete, 0);
   DoMethod(b_Del,   NOTP, o, 1, SWM_NList_RemoveSel);

   if (idata->b_Post) {
      DoMethod(idata->b_Post, NOTP, o, 1, SWM_NPostList_Post);
   }

   if (s_Subj) {
      SetAttrs(s_Subj,
               MUIA_Disabled,              TRUE,
               MUIA_String_AttachedList,   idata->SWA_NList_LV,
               TAG_DONE);
   }

   if (s_Grp) {
      SetAttrs(s_Grp,
               MUIA_Disabled,              TRUE,
               MUIA_String_AttachedList,   idata->SWA_NList_LV,
               TAG_DONE);
   }

   setlent(o, SWA_ObjNoChildCopy, TRUE);

   DoMethod(o, SWM_NPostList_OnOffLine,
            SWGetUL(NN_TCPList(idata), SWA_NTCPList_Online));

   DoMethod(NN_TCPList(idata), MUIM_Notify, SWA_NTCPList_Online,
            MUIV_EveryTime, o,2,SWM_NPostList_OnOffLine, MUIV_TriggerValue);

   DoMethod(o, MUIM_Notify, MUIA_AppMessage, MUIV_EveryTime,
            o, 2, SWM_NPostList_AppMessage, MUIV_TriggerValue);

   return SUCCESS;
}
Ejemplo n.º 12
0
void main( void )
{
	int Done = FALSE;
	ULONG sig;
	static STRPTR styleoptions[] = { "IRC", "Email", "HTML", NULL };
	if( !( MUIMasterBase = OpenLibrary( MUIMASTER_NAME, 19 ) ) )
		return;

	if( app = ApplicationObject,
		MUIA_Application_Title, "TextInputDemo",
		MUIA_Application_Version, "$VER: TextInput Demo 2.0",
		MUIA_Application_Copyright, "© 1997-99 by Oliver Wagner, All Rights Reserved",
		MUIA_Application_Author, "Oliver Wagner",
		MUIA_Application_Description, "Demo for Textinput.mcc",
		MUIA_Application_Base, "TEXTINPUT-DEMO",
		SubWindow, win = WindowObject,
			MUIA_Window_ID, 42,
			MUIA_Window_Title, "TextInput Demo",
			WindowContents, VGroup,
				Child, HGroup,
					Child, Label1( "Style:" ),
					Child, Cycle( styleoptions ),
				End,
				Child, HGroup, GroupFrameT( "Single line" ),
					Child, ColGroup( 2 ),
						Child, Label2( "Input:" ),
						Child, ti1 = TextinputObject, StringFrame, MUIA_CycleChain, 1,
							MUIA_ControlChar, 'a',
							MUIA_Textinput_Multiline, FALSE, 
							MUIA_Textinput_Contents, C1,
						End,
						Child, Label2( "NoInput:" ),
						Child, ti2 = TextinputObject, TextFrame, 
							MUIA_Background, MUII_TextBack,
							MUIA_Textinput_NoInput, TRUE,
							MUIA_Textinput_Contents, C1,
						End,
					End,
				End,
				Child, VGroup, GroupFrameT( "Multi line with scroll" ),
					Child, timl1 = TextinputscrollObject, StringFrame, MUIA_CycleChain, 1,
						MUIA_ControlChar, 'b',
						MUIA_Textinput_Multiline, TRUE, 
						MUIA_Textinput_Contents, C2,
					End,
					Child, bt_get = SimpleButton( "Get contents (to shell window)" ),
				End,
				Child, HGroup, GroupFrameT( "NoInput multi line with Scroll" ),
					Child, timl2 = TextinputscrollObject, TextFrame, MUIA_Background,MUII_TextBack,MUIA_CycleChain, 1,
						MUIA_ControlChar, 'c',
						MUIA_Textinput_NoInput, TRUE,
						MUIA_Textinput_Multiline, TRUE, 
						MUIA_Textinput_AutoExpand, TRUE,
						MUIA_Textinput_Contents, C2,
						MUIA_Textinput_MinVersion, 12,
						MUIA_Textinput_WordWrap, 60,
					End,
				End,
				Child, HGroup, GroupFrameT( "Old stringgadget" ),
					Child, String( C1, 256 ),
				End,
			End,
		End,
	End )
	{
		DoMethod( win, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
			app, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit
		);
		DoMethod( bt_get, MUIM_Notify, MUIA_Pressed, FALSE,
			app, 2, MUIM_Application_ReturnID, 2
		);
		DoMethod( ti1, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
			ti2, 3, MUIM_Set, MUIA_Text_Contents, MUIV_TriggerValue
		);
		DoMethod( timl1, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime,
			timl2, 3, MUIM_Set, MUIA_Text_Contents, MUIV_TriggerValue
		);
		DoMethod( ti1, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime,
			ti1, 3, MUIM_Set, MUIA_Textinput_Contents, ""
		);
		set( win, MUIA_Window_Open, TRUE );
		while( !Done )
		{
			LONG id;
			id = DoMethod( app, MUIM_Application_Input, &sig );
			switch( id )
			{
				case MUIV_Application_ReturnID_Quit:
					Done = TRUE;
				case 2:
					{
						char *p;
						get( timl1, MUIA_Textinput_Contents, &p );
						PutStr( ">>>>>\n" );
						PutStr( p );
						PutStr( "<<<<<\n" );
					}
					break;
			}
			if( sig )
				if( Wait( sig | SIGBREAKF_CTRL_C ) & SIGBREAKF_CTRL_C )
					Done = TRUE;
		}
		MUI_DisposeObject( app );
	}
	CloseLibrary( MUIMasterBase );

}
Ejemplo n.º 13
0
Archivo: win.c Proyecto: michalsc/AROS
static IPTR mNew(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct data temp;

    memset(&temp,0,sizeof(temp));

    if((obj = (Object *)DoSuperNew(cl,obj,
        MUIA_HelpNode,           "WIN",
        MUIA_Window_ID,          MAKE_ID('M', 'W', 'I', 'N'),
        MUIA_Window_Title,       getString(MSG_Win_WinTitle),
        MUIA_Window_ScreenTitle, getString(MSG_App_ScreenTitle),

        WindowContents, VGroup,
            Child, temp.reg = RegisterObject,
                MUIA_Background,       MUII_RegisterBack,
                MUIA_CycleChain,       TRUE,
                MUIA_Register_Titles,  tabs,

                /* Browsers */
                Child, temp.browsers = appListObject,
                    MUIA_AppList_Type, MUIV_AppList_Type_Browser,
                End,

                /* Mailers */
                Child, temp.mailers = appListObject,
                    MUIA_AppList_Type, MUIV_AppList_Type_Mailer,
                End,

                /* FTPs */
                Child, temp.FTPs = appListObject,
                    MUIA_AppList_Type, MUIV_AppList_Type_FTP,
                End,

                /* Miscellaneous */
                Child, temp.misc = VGroup,
                    MUIA_HelpNode, "MISCS",

                    /* Defaults */
                    Child, VGroup,
                        GroupFrameT(getString(MSG_Misc_Defaults)),
                        Child, HGroup,
                            Child, ColGroup(2),
                                Child, temp.show = ocheckmark(MSG_Misc_Show,MSG_Misc_Show_Help),
                                Child, ollabel1(MSG_Misc_Show),
                                Child, temp.toFront = ocheckmark(MSG_Misc_Bring,MSG_Misc_Bring_Help),
                                Child, ollabel1(MSG_Misc_Bring),
                                Child, temp.newWin = ocheckmark(MSG_Misc_Open,MSG_Misc_Open_Help),
                                Child, ollabel1(MSG_Misc_Open),
                                Child, temp.launch = ocheckmark(MSG_Misc_Launch,MSG_Misc_Launch_Help),
                                Child, ollabel1(MSG_Misc_Launch),
                            End,
                            Child, HSpace(0),
                        End,
                        Child, VSpace(0),
                    End,

                    /* Options */
                    Child, VGroup,
                        GroupFrameT(getString(MSG_Misc_Options)),
                        Child, HGroup,
                            Child, ColGroup(2),
                                Child, temp.prepend = ocheckmark(MSG_Misc_Prepend,MSG_Misc_Prepend_Help),
                                Child, ollabel1(MSG_Misc_Prepend),
                                Child, temp.mailto = ocheckmark(MSG_Misc_UseMailer,MSG_Misc_UseMailer_Help),
                                Child, ollabel1(MSG_Misc_UseMailer),
                                Child, temp.useFTP = ocheckmark(MSG_Misc_UseFTP,MSG_Misc_UseFTP_Help),
                                Child, ollabel1(MSG_Misc_UseFTP),
                            End,
                            Child, HSpace(0),
                        End,
                        Child, VSpace(0),
                    End,
                End,
            End,
            /* Buttons */
            Child, HGroup,
                Child, temp.save = obutton(MSG_Win_Save,MSG_Win_Save_Help),
                Child, wspace(16),
                Child, temp.use = obutton(MSG_Win_Use,MSG_Win_Use_Help),
                Child, wspace(16),
                Child, temp.apply = obutton(MSG_Win_Apply,MSG_Win_Apply_Help),
                Child, wspace(16),
                Child, temp.cancel = obutton(MSG_Win_Cancel,MSG_Win_Cancel_Help),
            End,

        End,
        TAG_MORE, msg->ops_AttrList)) != NULL)
    {
        struct data *data = INST_DATA(cl,obj);

        /* init instance data */
        CopyMem(&temp,data,sizeof(*data));

        data->browserList = (Object *)xget(data->browsers, MUIA_AppList_ListObj);
        data->mailerList = (Object *)xget(data->mailers, MUIA_AppList_ListObj);
        data->FTPList = (Object *)xget(data->FTPs, MUIA_AppList_ListObj);

        /* buttons */
        set(obj,MUIA_Window_DefaultObject,data->browserList);

        /* window notifies */
        DoMethod(obj,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,MUIV_Notify_Application,2,
            MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);

        /* buttons notifies */
        DoMethod(data->save,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,2,MUIM_Win_StorePrefs,MUIV_Win_StorePrefs_Save);
        DoMethod(data->use,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,2,MUIM_Win_StorePrefs,MUIV_Win_StorePrefs_Use);
        DoMethod(data->apply,MUIM_Notify,MUIA_Pressed,FALSE,(IPTR)obj,2,MUIM_Win_StorePrefs,MUIV_Win_StorePrefs_Apply);
        DoMethod(data->cancel,MUIM_Notify,MUIA_Pressed,FALSE,MUIV_Notify_Application,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
    }

    return (IPTR)obj;
}
Ejemplo n.º 14
0
/// US_New
//  Creates user list window
static struct US_ClassData *US_New(BOOL supervisor)
{
  struct US_ClassData *data;

  ENTER();

  if((data = calloc(1, sizeof(struct US_ClassData))) != NULL)
  {
    data->Supervisor = supervisor;
    data->GUI.WI = WindowObject,
       MUIA_Window_Title, tr(MSG_MA_MUsers),
       MUIA_Window_ScreenTitle, CreateScreenTitle(data->ScreenTitle, sizeof(data->ScreenTitle), tr(MSG_MA_MUsers)),
       MUIA_HelpNode, "Windows/Userswindow",
       MUIA_Window_ID, MAKE_ID('U','S','E','R'),
       WindowContents, VGroup,
          Child, NListviewObject,
             MUIA_CycleChain, TRUE,
             MUIA_NListview_NList, data->GUI.LV_USERS = UserListObject,
             End,
          End,
          Child, VGroup, GroupFrameT(tr(MSG_MA_Settings)),
             Child, ColGroup(2),
                Child, Label2(tr(MSG_US_UserName)),
                Child, data->GUI.ST_USER = MakeString(SIZE_NAME, tr(MSG_US_UserName)),
                Child, Label2(tr(MSG_US_Password)),
                Child, data->GUI.ST_PASSWD = MakePassString(tr(MSG_US_Password)),
                Child, Label2(tr(MSG_US_MailDirectory)),
                Child, data->GUI.PO_MAILDIR = PopaslObject,
                   MUIA_Popasl_Type,ASL_FileRequest,
                   MUIA_Popstring_String,data->GUI.ST_MAILDIR = MakeString(SIZE_PATH,tr(MSG_US_MailDirectory)),
                   MUIA_Popstring_Button,PopButton(MUII_PopDrawer),
                   ASLFR_DrawersOnly, TRUE,
                End,
             End,
             Child, VGroup,
                Child, MakeCheckGroup((Object **)&data->GUI.CH_USEADDR, tr(MSG_US_GlobalAddrBook)),
                Child, MakeCheckGroup((Object **)&data->GUI.CH_USEDICT, tr(MSG_US_GlobalDict)),
                Child, MakeCheckGroup((Object **)&data->GUI.CH_ROOT,tr(MSG_US_SuperVisor)),
             End,
             Child, VGroup,
                MUIA_ShowMe, supervisor,
                Child, MakeCheckGroup((Object **)&data->GUI.CH_CLONE, tr(MSG_US_CopyConfig)),
             End,
          End,
          Child, ColGroup(2),
             MUIA_ShowMe, supervisor,
             Child, data->GUI.BT_ADD = MakeButton(tr(MSG_US_AddUser)),
             Child, data->GUI.BT_DEL = MakeButton(tr(MSG_US_DelUser)),
          End,
       End,
    End;

    if(data->GUI.WI != NULL)
    {
      DoMethod(G->App, OM_ADDMEMBER, data->GUI.WI);

      SetHelp(data->GUI.ST_USER   ,MSG_HELP_US_ST_USER);
      SetHelp(data->GUI.ST_MAILDIR,MSG_HELP_US_ST_MAILDIR);
      SetHelp(data->GUI.ST_PASSWD ,MSG_HELP_US_ST_PASSWD);
      SetHelp(data->GUI.CH_USEADDR,MSG_HELP_US_CH_USEADDR);
      SetHelp(data->GUI.CH_USEDICT,MSG_HELP_US_CH_USEDICT);
      SetHelp(data->GUI.CH_CLONE  ,MSG_HELP_US_CH_CLONE);
      SetHelp(data->GUI.CH_ROOT   ,MSG_HELP_US_CH_ROOT);
      SetHelp(data->GUI.BT_ADD    ,MSG_HELP_US_BT_ADD);
      SetHelp(data->GUI.BT_DEL    ,MSG_HELP_US_BT_DEL);

      DoMethod(data->GUI.LV_USERS,  MUIM_Notify,MUIA_NList_Active,       MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_GetUSEntryHook);
      DoMethod(data->GUI.ST_USER,   MUIM_Notify,MUIA_String_Contents,    MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.ST_MAILDIR,MUIM_Notify,MUIA_String_Contents,    MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.ST_PASSWD, MUIM_Notify,MUIA_String_Contents,    MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.CH_USEADDR,MUIM_Notify,MUIA_Selected,           MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.CH_USEDICT,MUIM_Notify,MUIA_Selected,           MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.CH_ROOT,   MUIM_Notify,MUIA_Selected,           MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.CH_CLONE,  MUIM_Notify,MUIA_Selected,           MUIV_EveryTime,MUIV_Notify_Application,2,MUIM_CallHook,&US_PutUSEntryHook);
      DoMethod(data->GUI.BT_ADD,    MUIM_Notify,MUIA_Pressed,            FALSE         ,MUIV_Notify_Application,2,MUIM_CallHook,&US_AddHook);
      DoMethod(data->GUI.BT_DEL,    MUIM_Notify,MUIA_Pressed,            FALSE         ,MUIV_Notify_Application,2,MUIM_CallHook,&US_DelHook);
      DoMethod(data->GUI.WI,        MUIM_Notify,MUIA_Window_CloseRequest,TRUE          ,MUIV_Notify_Application,2,MUIM_CallHook,&US_CloseHook);
    }
    else
    {
      free(data);
      data = NULL;
    }
  }

  RETURN(data);
  return data;
}
Ejemplo n.º 15
0
int
main(UNUSED int argc,char **argv)
{
    int res;

    if ((IntuitionBase = (APTR)OpenLibrary("intuition.library",39)) != NULL &&
        GETINTERFACE("main", IIntuition, IntuitionBase))
    {
        if ((MUIMasterBase = OpenLibrary("muimaster.library",19)) != NULL &&
            GETINTERFACE("main", IMUIMaster, MUIMasterBase))
        {
            Object *app, *win, *mg, *sb, *viewMode, *buttonsPos, *labelPos, *borderless, *sunny,
                   *raised, *scaled, *keys, *bspacer, *fixed, *free, *update, *rows, *cols, *s4, *h0,
                   *rb, *rs, *ri;

            if ((app = ApplicationObject,
                    MUIA_Application_Title,        "TheBar Demo3",
                    MUIA_Application_Version,      "$VER: TheBarDemo3 1.0 (24.6.2003)",
                    MUIA_Application_Copyright,    "Copyright 2003 by Alfonso Ranieri",
                    MUIA_Application_Author,       "Alfonso Ranieri <*****@*****.**>",
                    MUIA_Application_Description,  "TheBar example",
                    MUIA_Application_Base,         "THEBAREXAMPLE",
                    MUIA_Application_UsedClasses,  usedClasses,

                    SubWindow, win = WindowObject,
                        MUIA_Window_ID,    MAKE_ID('M','A','I','N'),
                        MUIA_Window_Title, "TheBar Demo3",

                        WindowContents, mg = VGroup,

                            Child, sb = TheBarObject,
                                MUIA_Group_Horiz,             TRUE,
                                MUIA_TheBar_IgnoreAppearance, TRUE,
                                MUIA_TheBar_ViewMode,         MUIV_TheBar_ViewMode_Gfx,
                                MUIA_TheBar_Buttons,          buttons,
                                MUIA_TheBar_PicsDrawer,       "PROGDIR:Pics",
                                MUIA_TheBar_Pics,             pics,
                                MUIA_TheBar_SelPics,          spics,
                                MUIA_TheBar_DisPics,          dpics,
                            End,

                            Child, VGroup,
                                GroupFrameT("Appearance"),
                                Child, ColGroup(2),
                                    Child, Label2("Rows"),
                                    Child, HGroup,
                                        Child, rows = MUI_MakeObject(MUIO_Radio,NULL,rowss),
                                        Child, HSpace(0),
                                    End,
                                    Child, Label2("Columns"),
                                    Child, HGroup,
                                        Child, cols = MUI_MakeObject(MUIO_Radio,NULL,colss),
                                        Child, HSpace(0),
                                    End,
                                    Child, Label2("ViewMode"),
                                    Child, viewMode = MUI_MakeObject(MUIO_Cycle,NULL,viewModes),
                                    Child, Label2("Buttons position"),
                                    Child, buttonsPos = MUI_MakeObject(MUIO_Cycle,NULL,buttonsPoss),
                                    Child, Label2("Label position"),
                                    Child, labelPos = MUI_MakeObject(MUIO_Cycle,NULL,labelPoss),
                                End,
                                Child, ScrollgroupObject,
                                    MUIA_Scrollgroup_FreeHoriz, FALSE,
                                    MUIA_Scrollgroup_Contents, VirtgroupObject,
                                        MUIA_Frame, MUIV_Frame_Virtual,
                                        Child, HGroup,
                                            Child, ColGroup(2),
                                                Child, borderless = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel1("Borderless"),
                                                Child, sunny = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel1("Sunny"),
                                                Child, raised = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel1("Raised"),
                                                Child, scaled = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel1("Scaled"),
                                                Child, keys = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel1("Enable keys"),
                                                Child, bspacer = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel1("Bar spacer"),
                                                Child, fixed = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Fixed"),
                                                Child, free = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Disable 0"),
                                                Child, h0 = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Hide 0"),
                                                Child, s4 = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Sleep 4"),
                                                Child, RectangleObject, MUIA_FixHeightTxt,"a",End,
                                                Child, RectangleObject, MUIA_FixHeightTxt,"a",End,
                                                Child, rb = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Remove Bars"),
                                                Child, rs = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Remove Spaces"),
                                                Child, ri = MUI_MakeObject(MUIO_Checkmark,NULL),
                                                Child, LLabel("Remove Images"),
                                            End,
                                            Child, HSpace(0),
                                        End,
                                        Child, VSpace(0),
                                    End,
                                End,
                                Child, update = MUI_MakeObject(MUIO_Button,"_Update"),
                            End,
                        End,
                    End,
                End) != NULL)
            {
                ULONG sigs = 0;
                LONG id;

                set(rows,MUIA_Group_Horiz,TRUE);
                set(cols,MUIA_Group_Horiz,TRUE);
                set(viewMode,MUIA_Cycle_Active,1);
                set(s4,MUIA_Selected,TRUE);
                DoMethod(sb,MUIM_TheBar_SetAttr,4,MUIA_TheBar_Attr_Sleep,TRUE);

                DoMethod(win,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,MUIV_Notify_Application,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
                DoMethod(update,MUIM_Notify,MUIA_Pressed,FALSE,app,2,MUIM_Application_ReturnID,TAG_USER);

                set(win,MUIA_Window_Open,TRUE);

                while ((id = DoMethod(app,MUIM_Application_NewInput,&sigs))!=MUIV_Application_ReturnID_Quit)
                {
                    if (id==(LONG)TAG_USER)
                    {
                        IPTR c = 0,
                             r = 0,
                             vm = 0,
                             bp = 0,
                             lp = 0,
                             br = 0,
                             su = 0,
                             ra = 0,
                             sc = 0,
                             k = 0,
                             bs = 0,
                             fi = 0,
                             fr = 0,
                             hl0 = 0,
                             sl4 = 0,
                             rbl = 0,
                             rsl = 0,
                             ril = 0,
                             rem = 0;

                        get(rows,MUIA_Radio_Active,&r);
                        if (r==4) r = 6;
                        get(cols,MUIA_Radio_Active,&c);

                        get(viewMode,MUIA_Cycle_Active,&vm);
                        get(buttonsPos,MUIA_Cycle_Active,&bp);
                        get(labelPos,MUIA_Cycle_Active,&lp);

                        get(borderless,MUIA_Selected,&br);
                        get(sunny,MUIA_Selected,&su);
                        get(raised,MUIA_Selected,&ra);
                        get(scaled,MUIA_Selected,&sc);
                        get(keys,MUIA_Selected,&k);
                        get(bspacer,MUIA_Selected,&bs);
                        get(fixed,MUIA_Selected,&fi);
                        get(free,MUIA_Selected,&fr);

                        get(h0,MUIA_Selected,&hl0);
                        get(s4,MUIA_Selected,&sl4);

                        get(rb,MUIA_Selected,&rbl);
                        get(rs,MUIA_Selected,&rsl);
                        get(ri,MUIA_Selected,&ril);
                        rem = 0;
                        if (rbl) rem |= MUIV_TheBar_RemoveSpacers_Bar;
                        if (rsl) rem |= MUIV_TheBar_RemoveSpacers_Button;
                        if (ril) rem |= MUIV_TheBar_RemoveSpacers_Image;

                        DoMethod(mg,MUIM_Group_InitChange);
                        DoMethod(sb,MUIM_Group_InitChange);

                        SetAttrs(sb,MUIA_TheBar_Columns,      c,
                                    MUIA_TheBar_Rows,         r,
                                    MUIA_TheBar_ViewMode,     vm,
                                    MUIA_TheBar_Borderless,   br,
                                    MUIA_TheBar_Sunny,        su,
                                    MUIA_TheBar_Raised,       ra,
                                    MUIA_TheBar_Scaled,       sc,
                                    MUIA_TheBar_EnableKeys,   k,
                                    MUIA_TheBar_BarSpacer,    bs,
                                    MUIA_TheBar_RemoveSpacers,rem,
                                    MUIA_TheBar_LabelPos,     lp,
                                    TAG_DONE);

                        DoMethod(sb,MUIM_TheBar_SetAttr,0,MUIA_TheBar_Attr_Hide,hl0);
                        DoMethod(sb,MUIM_TheBar_SetAttr,4,MUIA_TheBar_Attr_Sleep,sl4);

                        DoMethod(sb,MUIM_TheBar_SetAttr,6,MUIA_TheBar_Attr_Disabled,fr);

                        DoMethod(sb,MUIM_Group_ExitChange);
                        DoMethod(mg,MUIM_Group_ExitChange);
                    }

                    if (sigs)
                    {
                        sigs = Wait(sigs | SIGBREAKF_CTRL_C);
                        if (sigs & SIGBREAKF_CTRL_C) break;
                    }
                }

                MUI_DisposeObject(app);

                res = RETURN_OK;
            }
            else
            {
                printf("%s: can't create application\n",argv[0]);
                res = RETURN_FAIL;
            }

            CLOSELIB(MUIMasterBase, IMUIMaster);
        }
        else
        {
            printf("%s: Can't open muimaster.library ver 19 or higher\n",argv[0]);
            res = RETURN_ERROR;
        }

        CLOSELIB(IntuitionBase, IIntuition);
    }
    else
    {
        printf("%s: Can't open intuition.library ver 39 or higher\n",argv[0]);
        res = RETURN_ERROR;
    }

    return res;
}
Ejemplo n.º 16
0
Object *CreatePrefsGroup(struct InstData_MCP *data)
{
  Object *example;
  Object **objs = data->Objects;
  Object *group;
  static const char *key01[2];
  static const char *key02[2];
  static const char *key03[2];
  static const char *key04[2];
  static const char *key05[2];
  static const char *key06[2];
  static const char *key07[2];
  static const char *key08[2];
  static const char *key09[2];
  static const char *key10[2];
  static const char *key11[2];
  static const char *key12[2];
  static const char *key13[2];
  static const char *key14[2];
  static const char *key15[2];
  static const char *key16[2];
  static const char *key17[2];
  static const char *key18[2];

  static const char infotext1[] = "\033bBetterString.mcp " LIB_REV_STRING "\033n (" LIB_DATE ")\n"
                                  "Copyright (C) 1997-2000 Allan Odgaard\n"
                                  LIB_COPYRIGHT;
  static const char infotext2[] = "\n"
                                  "Distributed under the terms of the LGPL2.\n"
                                  "\n"
                                  "For the latest version, check out:\n"
                                  "http://www.sf.net/projects/bstring-mcc/\n"
                                  "\n";

  static const char **keyinfo[] =
  {
    key01, key02, key03, key04, key05, key06, key07, key08, key09, key10,
    key11, key12, key13, key14, key15, key16, key17, key18,
    NULL
  };

  key01[0] = GetStr(MSG_Help_Copy_Shortcut);                   key01[1] = GetStr(MSG_Help_Copy);
  key02[0] = GetStr(MSG_Help_Cut_Shortcut);                    key02[1] = GetStr(MSG_Help_Cut);
  key03[0] = GetStr(MSG_Help_Paste_Shortcut);                  key03[1] = GetStr(MSG_Help_Paste);
  key04[0] = GetStr(MSG_Help_Undo_Shortcut);                   key04[1] = GetStr(MSG_Help_Undo);
  key05[0] = GetStr(MSG_Help_Redo_Shortcut);                   key05[1] = GetStr(MSG_Help_Redo);
  key06[0] = GetStr(MSG_Help_ToggleBuffer_Shortcut);           key06[1] = GetStr(MSG_Help_ToggleBuffer);
  key07[0] = GetStr(MSG_Help_ToggleCaseChar_Shortcut);         key07[1] = GetStr(MSG_Help_ToggleCaseChar);
  key08[0] = GetStr(MSG_Help_ToggleCaseWord_Shortcut);         key08[1] = GetStr(MSG_Help_ToggleCaseWord);
  key09[0] = GetStr(MSG_Help_IncreaseNumber_Shortcut);         key09[1] = GetStr(MSG_Help_IncreaseNumber);
  key10[0] = GetStr(MSG_Help_DecreaseNumber_Shortcut);         key10[1] = GetStr(MSG_Help_DecreaseNumber);
  key11[0] = GetStr(MSG_Help_HexToDecimal_Shortcut);           key11[1] = GetStr(MSG_Help_HexToDecimal);
  key12[0] = GetStr(MSG_Help_DecimalToHex_Shortcut);           key12[1] = GetStr(MSG_Help_DecimalToHex);
  key13[0] = GetStr(MSG_Help_FilenameCompletition_Shortcut);   key13[1] = GetStr(MSG_Help_FilenameCompletition);
  key14[0] = GetStr(MSG_Help_Mark_Shortcut);                   key14[1] = GetStr(MSG_Help_Mark);
  key15[0] = GetStr(MSG_Help_GotoToStartEndOfLine_Shortcut);   key15[1] = GetStr(MSG_Help_GotoToStartEndOfLine);
  key16[0] = GetStr(MSG_Help_DeleteToStartEndOfLine_Shortcut); key16[1] = GetStr(MSG_Help_DeleteToStartEndOfLine);
  key17[0] = GetStr(MSG_Help_GotoToPrevNextWord_Shortcut);     key17[1] = GetStr(MSG_Help_GotoToPrevNextWord);
  key18[0] = GetStr(MSG_Help_DeleteToPrevNextWord_Shortcut);   key18[1] = GetStr(MSG_Help_DeleteToPrevNextWord);

  group = VGroup,

    Child, PopobjectObject,
      MUIA_Popstring_String,  example = BetterStringObject, StringFrame,
        MUIA_String_Contents,  GetStr(MSG_String_TestString),
        MUIA_String_Format,    MUIV_String_Format_Center,
        MUIA_CycleChain,      TRUE,
        End,
      MUIA_Popstring_Button, PopButton(MUII_PopUp),
      MUIA_Popobject_Object, ListviewObject,
        MUIA_Listview_Input,    FALSE,
        MUIA_Listview_List,    ListObject, ReadListFrame,
          MUIA_List_DisplayHook,    &DisplayHook,
          MUIA_List_Format,        ",,",
          MUIA_List_SourceArray,    keyinfo,
          End,
        End,
      End,

    Child, VSpace(4),

    Child, ColGroup(2),
      Child, HSpace(-1),
      Child, HGroup,
        MUIA_Group_SameWidth, TRUE,
        Child, TextObject,
          MUIA_Font,          MUIV_Font_Tiny,
          MUIA_Text_Contents,  GetStr(MSG_Label_Background),
          MUIA_Text_PreParse, "\33c",
          End,
        Child, TextObject,
          MUIA_Font,          MUIV_Font_Tiny,
          MUIA_Text_Contents,  GetStr(MSG_Label_Text),
          MUIA_Text_PreParse, "\33c",
          End,
        End,

      Child, TxtLabel(GetStr(MSG_Label_Inactive)),
      Child, HGroup,
        Child, objs[InactiveBack] = PopimageObject,
          MUIA_Imageadjust_Type,  2,
          MUIA_CycleChain,      TRUE,
          MUIA_FixHeight,       0,
          End,
        Child, objs[InactiveText] = PoppenObject,
          MUIA_CycleChain,      TRUE,
          MUIA_FixHeight,       0,
          End,
        End,

      Child, TxtLabel(GetStr(MSG_Label_Active)),
      Child, HGroup,
        Child, objs[ActiveBack] = PopimageObject,
          MUIA_Imageadjust_Type,  2,
          MUIA_CycleChain,      TRUE,
          MUIA_FixHeight,       0,
          End,
        Child, objs[ActiveText] = PoppenObject,
          MUIA_CycleChain,      TRUE,
          MUIA_FixHeight,       0,
          End,
        End,

      Child, HSpace(-1),
      Child, RectangleObject,
        MUIA_Rectangle_HBar,  TRUE,
        MUIA_VertWeight,      0,
        End,

      Child, TxtLabel(GetStr(MSG_Label_Cursor)),
      Child, objs[Cursor] = PoppenObject,
        MUIA_CycleChain, TRUE,
        MUIA_FixHeight,  0,
        End,

      Child, TxtLabel(GetStr(MSG_Label_Marked)),
      Child, HGroup,
        Child, objs[MarkedBack] = PoppenObject,
          MUIA_CycleChain, TRUE,
          MUIA_FixHeight,  0,
          End,
        Child, objs[MarkedText] = PoppenObject,
          MUIA_CycleChain, TRUE,
          MUIA_FixHeight,  0,
          End,
        End,

      Child, HSpace(-1),
      Child, RectangleObject,
        MUIA_Rectangle_HBar,  TRUE,
        MUIA_VertWeight,      0,
      End,

      Child, HSpace(-1),
      Child, HGroup,
	    MUIA_Weight, 0,
        Child, objs[SelectOnActive] = MUI_MakeObject(MUIO_Checkmark, NULL),
        Child, TxtLLabel(GetStr(MSG_SelectOnActive)),
        Child, HSpace(-1),
      End,

      Child, HSpace(-1),
      Child, HGroup,
	    MUIA_Weight, 0,
        Child, objs[SelectPointer] = MUI_MakeObject(MUIO_Checkmark, NULL),
        Child, TxtLLabel(GetStr(MSG_SelectPointer)),
        Child, HSpace(-1),
      End,

    End,

    Child, CrawlingObject,
      TextFrame,
      MUIA_FixHeightTxt, infotext1,
      MUIA_Background,   "m1",

      Child, TextObject,
        MUIA_Text_Copy, FALSE,
        MUIA_Text_PreParse, "\033c",
        MUIA_Text_Contents, infotext1,
      End,

      Child, TextObject,
        MUIA_Text_Copy, FALSE,
        MUIA_Text_PreParse, "\033c",
        MUIA_Text_Contents, infotext2,
      End,

      Child, TextObject,
        MUIA_Text_Copy, FALSE,
        MUIA_Text_PreParse, "\033c",
        MUIA_Text_Contents, infotext1,
      End,
    End,

  End;

  // the inactive background will be the same as for String.mui on MUI4
  if(objs[InactiveBack] != NULL)
    set(objs[InactiveBack], MUIA_Disabled, data->mui4x);

  // the active background will be the same as for String.mui on MUI4
  if(objs[ActiveBack] != NULL)
    set(objs[ActiveBack], MUIA_Disabled, data->mui4x);

  if(objs[SelectOnActive] != NULL)
    set(objs[SelectOnActive], MUIA_ShortHelp, GetStr(MSG_HELP_SelectOnActive));

  // disable the pointer checkmark in case MUI already handles custom pointer types
  if(objs[SelectPointer] != NULL)
  {
    SetAttrs(objs[SelectPointer],
      MUIA_ShortHelp, GetStr(MSG_HELP_SelectPointer),
      MUIA_Disabled, xget(example, MUIA_PointerType) != MUIV_PointerType_Normal,
      TAG_DONE);
  }

  return group;
}
Ejemplo n.º 17
0
static IPTR mNew(struct IClass *cl, Object *obj, struct opSet *msg)
{
    struct data            temp;
    struct URL_BrowserNode *bn;
    struct TagItem         *attrs = msg->ops_AttrList;

    memset(&temp,0,sizeof(temp));

    temp.browserList  = (Object *)GetTagData(MUIA_BrowserEditWin_ListObj,(IPTR)NULL,attrs);
    if (!temp.browserList) return 0;

    bn = temp.bn = (struct URL_BrowserNode *)GetTagData(MUIA_BrowserEditWin_Browser,(IPTR)NULL,attrs);
    if (!bn) return 0;


    if((obj = (Object *)DoSuperNew(cl,obj,
        MUIA_HelpNode,             "BWIN",
        MUIA_Window_ID,            MAKE_ID('E','D','B','R'),
        MUIA_Window_Title,         getString(MSG_Browser_WinTitle),
        MUIA_Window_ScreenTitle,   getString(MSG_App_ScreenTitle),
        MUIA_Window_AllowTopMenus, FALSE,

        WindowContents, VGroup,
            Child, ColGroup(2),
                GroupFrameT(getString(MSG_Edit_Definitions)),

                Child, olabel2(MSG_Edit_Name),
                Child, temp.name = ostring(NAME_LEN,MSG_Edit_Name,MSG_Edit_Name_Help),

                Child, olabel2(MSG_Edit_Path),
                Child, temp.path = opopph(syms,names,PATH_LEN,MSG_Edit_Path,TRUE,MSG_Edit_Path_Help),
                Child, olabel2(MSG_Edit_Port),
                Child, temp.port = opopport(PORT_LEN,MSG_Edit_Port,MSG_Edit_Port_Help),
            End,

            Child, ColGroup(2),
                GroupFrameT(getString(MSG_Edit_ARexx)),

                Child, olabel2(MSG_Edit_Show),
                Child, temp.show = ostring(SHOWCMD_LEN,MSG_Edit_Show,MSG_Edit_Show_Help),

                Child, olabel2(MSG_Edit_Screen),
                Child, temp.toFront = ostring(TOFRONTCMD_LEN,MSG_Edit_Screen,MSG_Edit_Screen_Help),

                Child, olabel2(MSG_Edit_OpenURL),
                Child, temp.openURL = opopph(syms,names,OPENURLCMD_LEN,MSG_Edit_OpenURL,FALSE,MSG_Edit_OpenURL_Help),
                Child, olabel2(MSG_Edit_NewWin),
                Child, temp.openURLNW = opopph(syms,names,OPENURLWCMD_LEN,MSG_Edit_NewWin,FALSE,MSG_Edit_NewWin_Help),
            End,

            Child, ColGroup(3),
                Child, temp.use = obutton(MSG_Edit_Use,MSG_Edit_Use_Help),
                Child, RectangleObject, End,
                Child, temp.cancel = obutton(MSG_Edit_Cancel,MSG_Edit_Cancel_Help),
            End,
        End,
        TAG_MORE, attrs)) != NULL)
    {
        struct data *data = INST_DATA(cl,obj);

        CopyMem(&temp,data,sizeof(*data));

        set(data->name,MUIA_String_Contents,bn->ubn_Name);
        set(data->path,MUIA_String_Contents,bn->ubn_Path);
        set(data->port,MUIA_String_Contents,bn->ubn_Port);
        set(data->show,MUIA_String_Contents,bn->ubn_ShowCmd);
        set(data->toFront,MUIA_String_Contents,bn->ubn_ToFrontCmd);
        set(data->openURL,MUIA_String_Contents,bn->ubn_OpenURLCmd);
        set(data->openURLNW,MUIA_String_Contents,bn->ubn_OpenURLWCmd);
    }

    return (IPTR)obj;
}
Ejemplo n.º 18
0
/* /// "nHIDCtrlGUITask()" */
AROS_UFH0(void, GM_UNIQUENAME(nHIDCtrlGUITask))
{
    AROS_USERFUNC_INIT
    
    struct Task *thistask;
    struct NepHidBase *nh;
    struct NepClassHid *nch;

    thistask = FindTask(NULL);

#undef ps
#define ps nch->nch_HCPsdBase
#undef IntuitionBase
#define IntuitionBase nch->nch_HCIntBase
#undef MUIMasterBase
#define MUIMasterBase nch->nch_HCMUIBase

    nch = thistask->tc_UserData;
    nch->nch_HCGUITask = thistask;
    nh = nch->nch_ClsBase;

    ++nh->nh_Library.lib_OpenCnt;
    NewList(&nch->nch_HCGUIItems);
    if(!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME, MUIMASTER_VMIN)))
    {
        KPRINTF(10, ("Couldn't open muimaster.library.\n"));
        GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
        return;
    }

    if(!(IntuitionBase = OpenLibrary("intuition.library", 39)))
    {
        KPRINTF(10, ("Couldn't open intuition.library.\n"));
        GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
        return;
    }

    if(!(ps = OpenLibrary("poseidon.library", 4)))
    {
        KPRINTF(10, ("Couldn't open poseidon.library.\n"));
        GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
        return;
    }

    nch->nch_HCActionClass = MUI_CreateCustomClass(NULL, MUIC_Area  , NULL, sizeof(struct ActionData), GM_UNIQUENAME(HCActionDispatcher));

    if(!nch->nch_HCActionClass)
    {
        KPRINTF(10, ("Couldn't create ActionClass.\n"));
        GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
        return;
    }
    nch->nch_HCApp = ApplicationObject,
        MUIA_Application_Title      , (IPTR)nch->nch_CDC->cdc_HIDCtrlTitle,
        MUIA_Application_Version    , (IPTR)VERSION_STRING,
        MUIA_Application_Copyright  , (IPTR)"©2002-2009 Chris Hodges",
        MUIA_Application_Author     , (IPTR)"Chris Hodges <*****@*****.**>",
        MUIA_Application_Description, (IPTR)"HID Device Output Control",
        MUIA_Application_Base       , (IPTR)nch->nch_CDC->cdc_HIDCtrlRexx,
        MUIA_Application_HelpFile   , (IPTR)"HELP:Poseidon.guide",
        MUIA_Application_Menustrip  , (IPTR)MenustripObject,
            Child, (IPTR)MenuObjectT((IPTR)"Project"),
                Child, (IPTR)(nch->nch_HCAboutMI = MenuitemObject,
                    MUIA_Menuitem_Title, (IPTR)"About...",
                    MUIA_Menuitem_Shortcut, (IPTR)"?",
                    End),
                Child, (IPTR)MenuitemObject,
                    MUIA_Menuitem_Title, (IPTR)NM_BARLABEL,
                    End,
                Child, (IPTR)(nch->nch_HCCloseMI = MenuitemObject,
                    MUIA_Menuitem_Title, (IPTR)"Hide",
                    MUIA_Menuitem_Shortcut, (IPTR)"H",
                    End),
                End,
            Child, (IPTR)MenuObjectT((IPTR)"Settings"),
                Child, (IPTR)(nch->nch_HCMUIPrefsMI = MenuitemObject,
                    MUIA_Menuitem_Title, (IPTR)"MUI Settings",
                    MUIA_Menuitem_Shortcut, (IPTR)"M",
                    End),
                End,
            End,

        SubWindow, (IPTR)(nch->nch_HCMainWindow = WindowObject,
            MUIA_Window_ID   , MAKE_ID('H','C','T','L'),
            MUIA_Window_Title, (IPTR)nch->nch_CDC->cdc_HIDCtrlTitle,
            MUIA_HelpNode, (IPTR)GM_UNIQUENAME(libname),

            WindowContents, (IPTR)VGroup,
                Child, (IPTR)(nch->nch_HCActionObj = NewObject(nch->nch_HCActionClass->mcc_Class, 0, MUIA_ShowMe, FALSE, TAG_END)),
                Child, (IPTR)(nch->nch_HCGroupObj = ColGroup(4),
                    End),
                Child, (IPTR)(nch->nch_HCCloseObj = TextObject, ButtonFrame,
                    MUIA_Background, MUII_ButtonBack,
                    MUIA_CycleChain, 1,
                    MUIA_InputMode, MUIV_InputMode_RelVerify,
                    MUIA_Text_Contents, (IPTR)"\33c Hide ",
                    End),
                End,
            End),
        End;

    if(!nch->nch_HCApp)
    {
        KPRINTF(10, ("Couldn't create application\n"));
        GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
        return;
    }

    {
        struct ActionData *ad = INST_DATA(nch->nch_HCActionClass->mcc_Class, nch->nch_HCActionObj);
        ad->ad_NCH = nch;
    }
    /* add items */
    {
        struct NepHidReport *nhr;
        struct NepHidItem **nhiptr;
        struct NepHidItem *nhi;
        struct NepHidGItem *nhgi;
        UWORD count;
        Object *obj;
        UWORD numobj = 0;

        nhr = (struct NepHidReport *) nch->nch_HidReports.lh_Head;
        while(nhr->nhr_Node.ln_Succ)
        {
            if((count = nhr->nhr_OutItemCount))
            {
                nhiptr = nhr->nhr_OutItemMap;
                if(nhiptr)
                {
                    do
                    {
                        nhi = *nhiptr++;
                        obj = NULL;
                        nhgi = NULL;
                        if(nhi->nhi_Flags & RPF_MAIN_VARIABLE)
                        {
                            if(nhi->nhi_Flags & RPF_MAIN_RELATIVE)
                            {
                                if((nhi->nhi_LogicalMin == 0) && (nhi->nhi_LogicalMax == 1))
                                {
                                    if((nhgi = nAllocGHCItem(nch, nhi, NULL, nhi->nhi_Usage)))
                                    {
                                        /* one shot */
                                        obj = VGroup,
                                            Child, (IPTR)VSpace(0),
                                            Child, (IPTR)(nhgi->nhgi_GUIObj = TextObject, ButtonFrame,
                                                MUIA_Background, MUII_ButtonBack,
                                                MUIA_CycleChain, 1,
                                                MUIA_InputMode, MUIV_InputMode_RelVerify,
                                                MUIA_Text_PreParse, (IPTR)"\33c",
                                                MUIA_Text_Contents, (IPTR)nhgi->nhgi_Name,
                                                End),
                                            Child, (IPTR)VSpace(0),
                                            End;
                                        nhgi->nhgi_ObjType = NHGIOT_SHOTBUTTON;
                                    }
                                }
                                else if(nhi->nhi_LogicalMin < 0)
                                {
                                    if((nhgi = nAllocGHCItem(nch, nhi, NULL, nhi->nhi_Usage)))
                                    {
                                        /* Horizontal slider */
                                        obj = VGroup,
                                            Child, (IPTR)VSpace(0),
                                            Child, (IPTR)HGroup,
                                                Child, (IPTR)Label((IPTR)nhgi->nhgi_Name),
                                                Child, (IPTR)(nhgi->nhgi_GUIObj = SliderObject, SliderFrame,
                                                    MUIA_Slider_Horiz, TRUE,
                                                    MUIA_CycleChain, 1,
                                                    MUIA_InputMode, MUIV_InputMode_Immediate,
                                                    MUIA_Numeric_Min, nhi->nhi_LogicalMin,
                                                    MUIA_Numeric_Max, nhi->nhi_LogicalMax,
                                                    MUIA_Numeric_Value, nhi->nhi_OldValue,
                                                    End),
                                                End,
                                            Child, (IPTR)VSpace(0),
                                            End;
                                        nhgi->nhgi_ObjType = NHGIOT_SLIDERIMM;
                                    }
                                } else {
                                    if((nhgi = nAllocGHCItem(nch, nhi, NULL, nhi->nhi_Usage)))
                                    {
                                        /* Vertical slider */
                                        obj = HGroup,
                                            Child, (IPTR)HSpace(0),
                                            Child, (IPTR)VGroup,
                                                Child, (IPTR)(nhgi->nhgi_GUIObj = SliderObject, SliderFrame,
                                                    MUIA_Slider_Horiz, FALSE,
                                                    MUIA_CycleChain, 1,
                                                    MUIA_InputMode, MUIV_InputMode_Immediate,
                                                    MUIA_Numeric_Min, nhi->nhi_LogicalMin,
                                                    MUIA_Numeric_Max, nhi->nhi_LogicalMax,
                                                    MUIA_Numeric_Value, nhi->nhi_OldValue,
                                                    End),
                                                Child, (IPTR)Label((IPTR)nhgi->nhgi_Name),
                                                End,
                                            Child, (IPTR)HSpace(0),
                                            End;
                                        nhgi->nhgi_ObjType = NHGIOT_SLIDERIMM;
                                    }
                                }
                            } else {
                                if((nhi->nhi_LogicalMin == 0) && (nhi->nhi_LogicalMax == 1))
                                {
                                    if((nhgi = nAllocGHCItem(nch, nhi, NULL, nhi->nhi_Usage)))
                                    {
                                        /* toggle button */
                                        obj = VGroup,
                                            Child, (IPTR)VSpace(0),
                                            Child, (IPTR)(nhgi->nhgi_GUIObj = TextObject, ButtonFrame,
                                                MUIA_Background, MUII_ButtonBack,
                                                MUIA_CycleChain, 1,
                                                MUIA_InputMode, MUIV_InputMode_Toggle,
                                                MUIA_Text_PreParse, (IPTR)"\33c",
                                                MUIA_Text_Contents, (IPTR)nhgi->nhgi_Name,
                                                End),
                                            Child, (IPTR)VSpace(0),
                                            End;
                                        nhgi->nhgi_ObjType = NHGIOT_TOGGLEBUTTON;
                                    }
                                }
                                else if(nhi->nhi_LogicalMin < 0)
                                {
                                    if((nhgi = nAllocGHCItem(nch, nhi, NULL, nhi->nhi_Usage)))
                                    {
                                        /* Horizontal slider */
                                        obj = VGroup,
                                            Child, (IPTR)VSpace(0),
                                            Child, (IPTR)HGroup,
                                                Child, (IPTR)Label((IPTR)nhgi->nhgi_Name),
                                                Child, (IPTR)(nhgi->nhgi_GUIObj = SliderObject, SliderFrame,
                                                    MUIA_Slider_Horiz, TRUE,
                                                    MUIA_CycleChain, 1,
                                                    MUIA_Numeric_Min, nhi->nhi_LogicalMin,
                                                    MUIA_Numeric_Max, nhi->nhi_LogicalMax,
                                                    MUIA_Numeric_Value, nhi->nhi_OldValue,
                                                    End),
                                                End,
                                            Child, (IPTR)VSpace(0),
                                            End;
                                        nhgi->nhgi_ObjType = NHGIOT_SLIDER;
                                    }
                                } else {
                                    if((nhgi = nAllocGHCItem(nch, nhi, NULL, nhi->nhi_Usage)))
                                    {
                                        /* Vertical slider */
                                        obj = HGroup,
                                            Child, (IPTR)HSpace(0),
                                            Child, (IPTR)VGroup,
                                                Child, (IPTR)(nhgi->nhgi_GUIObj = SliderObject, SliderFrame,
                                                    MUIA_Slider_Horiz, FALSE,
                                                    MUIA_CycleChain, 1,
                                                    MUIA_Numeric_Min, nhi->nhi_LogicalMin,
                                                    MUIA_Numeric_Max, nhi->nhi_LogicalMax,
                                                    MUIA_Numeric_Value, nhi->nhi_OldValue,
                                                    End),
                                                Child, (IPTR)Label(nhgi->nhgi_Name),
                                                End,
                                            Child, (IPTR)HSpace(0),
                                            End;
                                        nhgi->nhgi_ObjType = NHGIOT_SLIDER;
                                    }
                                }
                            }
                        }
                        if(obj)
                        {
                            DoMethod(nch->nch_HCGroupObj, OM_ADDMEMBER, obj);
                            switch(nhgi->nhgi_ObjType)
                            {
                                case NHGIOT_SHOTBUTTON:
                                    DoMethod(nhgi->nhgi_GUIObj, MUIM_Notify, MUIA_Pressed, FALSE,
                                             nch->nch_HCActionObj, 2, MUIM_Action_UpdateHIDCtrl, nhgi);
                                    break;

                                case NHGIOT_TOGGLEBUTTON:
                                    DoMethod(nhgi->nhgi_GUIObj, MUIM_Notify, MUIA_Selected, MUIV_EveryTime,
                                             nch->nch_HCActionObj, 2, MUIM_Action_UpdateHIDCtrl, nhgi);
                                    break;

                                case NHGIOT_SLIDERIMM:
                                    DoMethod(nhgi->nhgi_GUIObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
                                             nch->nch_HCActionObj, 2, MUIM_Action_UpdateHIDCtrl, nhgi);
                                    break;

                                case NHGIOT_SLIDER:
                                    DoMethod(nhgi->nhgi_GUIObj, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime,
                                             nch->nch_HCActionObj, 2, MUIM_Action_UpdateHIDCtrl, nhgi);
                                    break;
                            }
                            numobj++;
                        }
                    } while(--count);
                }
            }
            nhr = (struct NepHidReport *) nhr->nhr_Node.ln_Succ;
        }
        if(!numobj)
        {
            DoMethod(nch->nch_HCGroupObj, OM_ADDMEMBER, Label("No output items in this interface!"));
        }
    }

    DoMethod(nch->nch_HCMainWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
             nch->nch_HCActionObj, 1, MUIM_Action_HideHIDControl);
    DoMethod(nch->nch_HCCloseObj, MUIM_Notify, MUIA_Pressed, FALSE,
             nch->nch_HCActionObj, 1, MUIM_Action_HideHIDControl);

    DoMethod(nch->nch_HCAboutMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
             nch->nch_HCActionObj, 1, MUIM_Action_About);
    DoMethod(nch->nch_HCCloseMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
             nch->nch_HCActionObj, 1, MUIM_Action_HideHIDControl);
    DoMethod(nch->nch_HCMUIPrefsMI, MUIM_Notify, MUIA_Menuitem_Trigger, MUIV_EveryTime,
             nch->nch_HCApp, 2, MUIM_Application_OpenConfigWindow, 0);

    {
        IPTR  isopen = 0;
        IPTR  iconify = 0;
        ULONG sigs;
        ULONG sigmask;
        LONG retid;

        if(nch->nch_CDC->cdc_HIDCtrlOpen)
        {
            get(nch->nch_HCApp, MUIA_Application_Iconified, &iconify);
            set(nch->nch_HCMainWindow, MUIA_Window_Open, TRUE);
            get(nch->nch_HCMainWindow, MUIA_Window_Open, &isopen);
            if(!(isopen || iconify))
            {
                GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
                return;
            }
        }
        sigmask = 0;
        do
        {
            retid = DoMethod(nch->nch_HCApp, MUIM_Application_NewInput, &sigs);
            if(sigs)
            {
                sigs = Wait(sigs | sigmask | SIGBREAKF_CTRL_C);
                if(sigs & SIGBREAKF_CTRL_C)
                {
                    break;
                }
            }
        } while(retid != MUIV_Application_ReturnID_Quit);
        set(nch->nch_HCMainWindow, MUIA_Window_Open, FALSE);
    }
    GM_UNIQUENAME(nHIDCtrlGUITaskCleanup)(nch);
    
    AROS_USERFUNC_EXIT
}
Ejemplo n.º 19
0
int main(void)
{
  if((DiskfontBase = OpenLibrary("diskfont.library", 38)) &&
    GETINTERFACE(IDiskfont, DiskfontBase))
  if((GfxBase = OpenLibrary("graphics.library", 38)) &&
    GETINTERFACE(IGraphics, GfxBase))
  if((IntuitionBase = (APTR)OpenLibrary("intuition.library", 38)) &&
    GETINTERFACE(IIntuition, IntuitionBase))
  if((KeymapBase = OpenLibrary("keymap.library", 37)) &&
    GETINTERFACE(IKeymap, KeymapBase))
  if((LocaleBase = OpenLibrary("locale.library", 38)) &&
    GETINTERFACE(ILocale, LocaleBase))
  if((LayersBase = OpenLibrary("layers.library", 38)) &&
    GETINTERFACE(ILayers, LayersBase))
  if((UtilityBase = (APTR)OpenLibrary("utility.library", 38)) &&
    GETINTERFACE(IUtility, UtilityBase))
  if((MUIMasterBase = OpenLibrary("muimaster.library", MUIMASTER_VMIN)) &&
    GETINTERFACE(IMUIMaster, MUIMasterBase))
  if((IFFParseBase = OpenLibrary("iffparse.library", 36)) &&
    GETINTERFACE(IIFFParse, IFFParseBase))
  {
    struct MUI_CustomClass *mcc;
    Object *a1, *a2, *app, *window, *bstring, *bstring2, *bpos, *ssize, *button, *numbutton;
    Object *menu;
    const char *classes[] = {"BetterString.mcp", NULL};

    #if defined(DEBUG)
    SetupDebug();
    #endif

    mcc = MUI_CreateCustomClass(NULL, "Area.mui", NULL, sizeof(struct InstData), ENTRY(_Dispatcher));

    /*
    menu = MenustripObject,
            MUIA_Family_Child, MenuObject, MUIA_Menu_Title, "Test",
              MUIA_Family_Child, MenuitemObject,
                MUIA_Menuitem_Title,    "Dummy",
                MUIA_Menuitem_Enabled,  TRUE,
                MUIA_Menuitem_Shortcut, "V",
              End,
            End,
           End,
    */

    app =  ApplicationObject,
          MUIA_Application_Author,      "BetterString.mcc Open Source Team",
          MUIA_Application_Base,        "BetterString-Test",
          MUIA_Application_Copyright,    "(C) 2005-2009 by BetterString.mcc Open Source Team",
          MUIA_Application_Description,  "BetterString.mcc demonstration program",
          MUIA_Application_Title,        "BetterString-Test",
          MUIA_Application_Version,      "$VER: BetterString-Demo V1.0 (18.05.2007)",
          MUIA_Application_UsedClasses, classes,

          MUIA_Application_Window, window = WindowObject,
            MUIA_Window_Title,  "BetterString-Test",
            MUIA_Window_ID,      MAKE_ID('M','A','I','N'),
            //MUIA_Window_Menustrip, menu,
            MUIA_Window_RootObject, VGroup,

            Child, PopaslObject,
                MUIA_Popstring_String,  NewObject(mcc->mcc_Class, NULL, StringFrame, MUIA_BetterString_NoInput, TRUE, MUIA_CycleChain, TRUE, End,
                MUIA_Popstring_Button,  MUI_MakeObject(MUIO_PopButton, MUII_PopUp),
                MUIA_Popasl_Type,       ASL_FontRequest,
                End,

            Child, ColGroup(2), StringFrame,
                MUIA_Background, MUII_GroupBack,
                Child, TextObject,
                    MUIA_Weight, 0,
                    MUIA_Text_Contents, "\33rName:",
                    End,
                Child, a1 = (Object *)NewObject(mcc->mcc_Class, NULL,
                    MUIA_CycleChain, TRUE,
                    MUIA_Background, MUII_GroupBack,
                    MUIA_String_AdvanceOnCR, TRUE,
                    MUIA_String_MaxLen, 10,
                    MUIA_ObjectID, MAKE_ID('N','A','M','E'),
                    End,
                Child, TextObject,
                    MUIA_Weight, 0,
                    MUIA_Text_Contents, "\33rStreet:",
                    End,
                Child, a2 = (Object *)NewObject(mcc->mcc_Class, NULL,
                    MUIA_CycleChain, TRUE,
                    MUIA_Background, MUII_GroupBack,
                    MUIA_String_AdvanceOnCR, TRUE,
                    MUIA_ObjectID, MAKE_ID('S','T','R','T'),
                    End,
                Child, TextObject,
                    MUIA_Weight, 0,
                    MUIA_Text_Contents, "\33rZip, City:",
                    End,
                Child, NewObject(mcc->mcc_Class, NULL,
                    MUIA_CycleChain, TRUE,
                    MUIA_Background, MUII_GroupBack,
                    MUIA_String_AdvanceOnCR, TRUE,
                    MUIA_ObjectID, MAKE_ID('C','I','T','Y'),
                    End,
                End,

              Child, TextObject,
                MUIA_Font, MUIV_Font_Tiny,
                MUIA_Text_Contents, "\33cBetterString.mcc",
                End,
              Child, NewObject(mcc->mcc_Class, NULL,
                StringFrame,
                MUIA_CycleChain, TRUE,
                MUIA_String_Secret, TRUE,
  //                  MUIA_String_MaxLen, 20,
                MUIA_String_AdvanceOnCR, TRUE,
                MUIA_BetterString_StayActive, TRUE,
  //                  MUIA_String_Accept, "0123456789",
                MUIA_String_Contents, "This is a wonderful example string!",
                End,
              Child, NewObject(mcc->mcc_Class, NULL,
                  StringFrame,
                  MUIA_CycleChain, TRUE,
                  MUIA_BetterString_InactiveContents, "This is a wonderful example string!",
                  End,
              Child, NewObject(mcc->mcc_Class, NULL,
                  StringFrame,
                  MUIA_CycleChain, TRUE,
                  MUIA_String_Secret, TRUE,
                  MUIA_BetterString_InactiveContents, "This is a wonderful example string!",
                  End,
              Child, TextObject,
                MUIA_Font, MUIV_Font_Tiny,
                MUIA_Text_Contents, "\33cCentered",
                End,
              Child, bstring = (Object *)NewObject(mcc->mcc_Class, NULL,
                ButtonFrame,
                MUIA_Font, MUIV_Font_Big,
  //                  StringFrame,
                MUIA_String_AdvanceOnCR, TRUE,
                MUIA_String_Format, MUIV_String_Format_Center,
                MUIA_String_Contents, "This is a wonderful example string!",
                MUIA_CycleChain, TRUE,
                End,
              Child, TextObject,
                MUIA_Font, MUIV_Font_Tiny,
                MUIA_Text_Contents, "\33cRight-Aligned",
                End,
              Child, bstring2 = NewObject(mcc->mcc_Class, NULL,
                MUIA_CycleChain, TRUE,
  //                  StringFrame,
                MUIA_String_AdvanceOnCR, TRUE,
                MUIA_String_Contents, "This is a wonderful example string!",
                MUIA_String_Format, MUIV_String_Format_Right,
                End,
              Child, TextObject,
                MUIA_Font, MUIV_Font_Tiny,
                MUIA_Text_Contents, "\33cStringObject",
                End,
              Child, StringObject,
                StringFrame,
                MUIA_String_AdvanceOnCR, TRUE,
                MUIA_String_Contents, "This is a standard StringObject",
                MUIA_String_Format, MUIV_String_Format_Right,
                MUIA_String_MaxLen, 1024,
                MUIA_CycleChain, TRUE,
                End,
              Child, HGroup,
                Child, button = SimpleButton("Insert"),
                Child, bpos = SliderObject,
                  MUIA_Slider_Horiz, TRUE,
                  MUIA_Numeric_Max, 60,
                  End,
                Child, ssize = SliderObject,
                  MUIA_Slider_Horiz, TRUE,
                  MUIA_Numeric_Min, -30,
                  MUIA_Numeric_Max, 30,
                  MUIA_Numeric_Value, 0,
                  End,
                Child, numbutton = NumericbuttonObject,
                  MUIA_Numeric_Min, -30,
                  MUIA_Numeric_Max, 30,
                  MUIA_Numeric_Value, 0,
                  MUIA_Disabled, TRUE,
                  End,
                End,
              End,
            End,
          End;

    if(app)
    {
      ULONG sigs;

      DoMethod(app, MUIM_Application_Load, MUIV_Application_Load_ENV);

      DoMethod(a1, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, a2, 3, MUIM_Set, MUIA_String_Contents, MUIV_TriggerValue);
      DoMethod(a2, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, a1, 3, MUIM_Set, MUIA_String_Contents, MUIV_TriggerValue);

      DoMethod(ssize, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, numbutton, 3, MUIM_Set, MUIA_Numeric_Value, MUIV_TriggerValue);
      DoMethod(bpos, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, bstring, 3, MUIM_Set, MUIA_String_BufferPos, MUIV_TriggerValue);
      DoMethod(ssize, MUIM_Notify, MUIA_Numeric_Value, MUIV_EveryTime, bstring, 3, MUIM_Set, MUIA_BetterString_SelectSize, MUIV_TriggerValue);
      DoMethod(button, MUIM_Notify, MUIA_Pressed, FALSE, bstring, 3, MUIM_BetterString_Insert, "*Test*", MUIV_BetterString_Insert_BufferPos);
      DoMethod(window, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, MUIV_Notify_Application, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);

      set(bstring, MUIA_BetterString_KeyDownFocus, bstring2);
      set(bstring2, MUIA_BetterString_KeyUpFocus, bstring);

      set(window, MUIA_Window_ActiveObject, bstring);
      set(window, MUIA_Window_DefaultObject, bstring);
      set(window, MUIA_Window_Open, TRUE);

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

        MUI_DisposeObject(app);
        if(mcc)
            MUI_DeleteCustomClass(mcc);
    }

    DROPINTERFACE(IMUIMaster);
    CloseLibrary(MUIMasterBase);
    MUIMasterBase = NULL;
  }

  if(IFFParseBase)
  {
    DROPINTERFACE(IIFFParse);
    CloseLibrary(IFFParseBase);
    IFFParseBase = NULL;
  }

  if(UtilityBase)
  {
    DROPINTERFACE(IUtility);
    CloseLibrary((struct Library *)UtilityBase);
  }

  if(LayersBase)
  {
    DROPINTERFACE(ILayers);
    CloseLibrary(LayersBase);
  }

  if(LocaleBase)
  {
    DROPINTERFACE(ILocale);
    CloseLibrary(LocaleBase);
  }

  if(KeymapBase)
  {
    DROPINTERFACE(IKeymap);
    CloseLibrary(KeymapBase);
  }

  if(IntuitionBase)
  {
    DROPINTERFACE(IIntuition);
    CloseLibrary((struct Library *)IntuitionBase);
  }

  if(GfxBase)
  {
    DROPINTERFACE(IGraphics);
    CloseLibrary(GfxBase);
  }

  if(DiskfontBase)
  {
    DROPINTERFACE(IDiskfont);
    CloseLibrary(DiskfontBase);
  }

  return 0;
}
Ejemplo n.º 20
0
Object *CreatePrefs(struct Toolbar_DataP *data)
{
  Object **objs = data->Gadgets;
  Object *textgroup, *imagegroup;
  Object *prefsgroup;

  static STRPTR LookStrings[4];
  static STRPTR BorderTypeStrings[4];
  static STRPTR SelectionModeStrings[4];
  static STRPTR PrecisionStrings[5];
  static STRPTR GhostEffectStrings[5];

  BorderTypeStrings[0] = LOCALE(MSG_BORDERTYPE_OLD, "Old");
  BorderTypeStrings[1] = LOCALE(MSG_BORDERTYPE_OFF, "Off");
  BorderTypeStrings[2] = LOCALE(MSG_BORDERTYPE_NEW,  "New");
  BorderTypeStrings[3] = NULL;

  SelectionModeStrings[0] = LOCALE(MSG_SELECTIONMODE_OLD, "Old");
  SelectionModeStrings[1] = LOCALE(MSG_SELECTIONMODE_OFF, "Off");
  SelectionModeStrings[2] = LOCALE(MSG_SELECTIONMODE_NEW,  "New");
  SelectionModeStrings[3] = NULL;

  LookStrings[0] = LOCALE(MSG_IMAGETEXT, "Image and Text");
  LookStrings[1] = LOCALE(MSG_IMAGEONLY, "Image only");
  LookStrings[2] = LOCALE(MSG_TEXTONLY,  "Text only");
  LookStrings[3] = NULL;

  PrecisionStrings[0] = LOCALE(MSG_EXACT, "Exact");
  PrecisionStrings[1] = LOCALE(MSG_IMAGE, "Image");
  PrecisionStrings[2] = LOCALE(MSG_ICON,  "Icon");
  PrecisionStrings[3] = LOCALE(MSG_GUI,   "GUI");
  PrecisionStrings[4] = NULL;

//  GhostEffectStrings[0] = LOCALE(MSG_DIMMMED,     "Dimmed"); // Temporarily disabled - remember +-1
  GhostEffectStrings[0] = LOCALE(MSG_LIGHT,       "Light Grid");
  GhostEffectStrings[1] = LOCALE(MSG_HEAVY,       "Heavy Grid");
  GhostEffectStrings[2] = LOCALE(MSG_SUPERLIGHT,  "Superlight Grid");
  GhostEffectStrings[3] = NULL;

  prefsgroup =
    VGroup,
      Child, VGroup,
        Child, HGroup,
//        MUIA_Group_SameWidth, TRUE,
/*********************************  General  *********************************/
          Child, HGroup,
            MUIA_Background, MUII_GroupBack,
            MUIA_Frame     , MUIV_Frame_Group,
            MUIA_FrameTitle, LOCALE(MSG_GENERAL, "General"),
            Child, RectangleObject, End,
            Child, VGroup,
              Child, RectangleObject, End,
              Child, objs[Look] = RadioObject,
  //                MUIA_FrameTitle, "Toolbar look",
                MUIA_Radio_Entries, LookStrings,
              End,
              Child, RectangleObject, End,
            End,
  //ghosttype
            Child, RectangleObject, End,
          End,

/*********************************  Image  *********************************/
          Child, imagegroup = HGroup,
            MUIA_Background, MUII_GroupBack,
            MUIA_Frame     , MUIV_Frame_Group,
            MUIA_FrameTitle, LOCALE(MSG_IMAGE, "Image"),
            Child, RectangleObject, End,
            Child, VGroup,
              Child, RectangleObject, End,
              Child, HGroup,
                Child, RectangleObject, End,
                Child, VGroup,
                  Child, Label(LOCALE(MSG_USEIMAGES1, "\33cUse ghosted/selected images")),
//                  Child, MUI_MakeObject(MUIO_Label, LOCALE(MSG_USEIMAGES2, "\33c(if they are available)"), MUIO_Label_Tiny),
                  Child, TextObject,
                    MUIA_Text_Contents, LOCALE(MSG_USEIMAGES2, "\33c(if they are available)"),
                    MUIA_Font, MUIV_Font_Tiny,
                  End,
                End,
                Child, objs[UseImages] = CheckMark(TRUE),
//                Child, RectangleObject, End,
              End,
              Child, ColGroup(2),
//              Child, HGroup,
                Child, Label(LOCALE(MSG_REMAP, "Remap Precision")),
                Child, objs[Precision] = Cycle(PrecisionStrings),
//              End,
//              Child, HGroup,
                Child, Label(LOCALE(MSG_GHOSTEFFECT, "Ghosting effect")),
                Child, objs[GhostEffect] = Cycle(GhostEffectStrings),
//              End,
              End,

              Child, RectangleObject, End,
            End,
            Child, RectangleObject, End,
          End,
        End,

/*********************************  Spacing  *********************************/
        Child, HGroup,
          Child, HGroup,
            MUIA_Background, MUII_GroupBack,
            MUIA_Frame     , MUIV_Frame_Group,
            MUIA_FrameTitle, LOCALE(MSG_SPACING, "Spacing"),
            Child, VGroup,
              Child, RectangleObject, End,
              Child, ColGroup(2),
                Child, Label(LOCALE(MSG_GROUPSPACE, "Group Space")),
                Child, objs[GroupSpace] = SliderObject,
                  MUIA_Slider_Min,   -1,
                  MUIA_Slider_Max,   50,
                End,
                Child, Label(LOCALE(MSG_TOOLSPACE, "Tool Space")),
                Child, objs[ToolSpace] = SliderObject,
                  MUIA_Slider_Min,   -1,
                  MUIA_Slider_Max,   10,
                End,
                Child, VGroup,
                  Child, Label(LOCALE(MSG_INNERSPACE, "\33cInner Space")),
//                  Child, MUI_MakeObject(MUIO_Label,LOCALE(MSG_INNERSPACE_WITH, "\33c(with tooltext)"), MUIO_Label_Tiny),
                  Child, TextObject,
                    MUIA_Text_Contents, LOCALE(MSG_INNERSPACE_WITH, "\33c(with tooltext)"),
                    MUIA_Font, MUIV_Font_Tiny,
                  End,
                End,
                Child, objs[InnerSpace_Text] = SliderObject,
                  MUIA_Slider_Min,   0,
                  MUIA_Slider_Max,   10,
                End,
                Child, VGroup,
                  Child, Label(LOCALE(MSG_INNERSPACE, "\33cInner Space")),
//                  Child, MUI_MakeObject(MUIO_Label,LOCALE(MSG_INNERSPACE_WITHOUT, "\33c(without tooltext)"), MUIO_Label_Tiny),
                  Child, TextObject,
                    MUIA_Text_Contents, LOCALE(MSG_INNERSPACE_WITHOUT, "\33c(without tooltext)"),
                    MUIA_Font, MUIV_Font_Tiny,
                  End,
                End,
                Child, objs[InnerSpace_NoText] = SliderObject,
                  MUIA_Slider_Min,   0,
                  MUIA_Slider_Max,   10,
                  MUIA_Disabled, TRUE,
                End,
  // some kind of relative mode
  // width: fixed/floating
              End,
              Child, RectangleObject, End,
            End,
          End,

  /*********************************  Text  *********************************/
          Child, textgroup = HGroup,
            MUIA_Background, MUII_GroupBack,
            MUIA_Frame     , MUIV_Frame_Group,
            MUIA_FrameTitle, LOCALE(MSG_TEXT, "Text"),
            Child, VGroup,
              Child, RectangleObject, End,
/*              Child, HGroup,
                Child, RectangleObject, End,
                Child, Label(LOCALE(MSG_PLACEMENT, "Placement")),
                Child, data->CY_Placement = Cycle(CY_textplacement),
//                Child, RectangleObject, End,
              End,
*/              Child, ColGroup(2),
//                Child, VGroup,
                  Child, Label(LOCALE(MSG_COLOR, "Text Color")),
//                End,
//                Child, VGroup,
                  Child, objs[ToolPen] = PoppenObject,
                    MUIA_Window_Title, LOCALE(MSG_ADJUST, "Adjust Text Color"),
                    MUIA_Draggable, TRUE,
                    MUIA_ShortHelp, LOCALE(MSG_COLOR_HELP, "Color of the tool texts."),
                  End,
                  Child, Label2(LOCALE(MSG_FONT, "Text Font")),
                  Child, data->FontASL = PopaslObject,
                    MUIA_Popstring_String, objs[ToolFont] = String(0,35),
                    MUIA_Popstring_Button, PopButton(MUII_PopUp),
                    MUIA_Popasl_Type , ASL_FontRequest,
                    ASLFO_TitleText  , LOCALE(MSG_SELECT, "Please select a text font..."),
                  End,
//                End,
              End,
              Child, RectangleObject, End,
            End,
          End,
        End,
// Sløringseffekt: Normal, 3D, ...
  End,
/*
      Child, HGroup,
        Child, HGroup,
          MUIA_Background, MUII_GroupBack,
          MUIA_Frame     , MUIV_Frame_Group,
          MUIA_FrameTitle, LOCALE(MSG_BORDERTYPE, "Border Type"),
          InnerSpacing(12, 12),
          Child, objs[BorderType] = Cycle(BorderTypeStrings),
        End,
        Child, VGroup,
          MUIA_Background, MUII_GroupBack,
          MUIA_Frame     , MUIV_Frame_Group,
          MUIA_FrameTitle, LOCALE(MSG_SELECTIONMODE, "Selection Border"),
          InnerSpacing(12, 12),
          Child, objs[SelectionMode] = Cycle(SelectionModeStrings),
          Child, HGroup,
            Child, Label2(LOCALE(MSG_AUTOACTIVE, "Show Active on Mousehi")),
            Child, objs[AutoActive] = CheckMark(TRUE),
          End,
        End,
      End,
*/



        Child, HGroup,


          Child, HGroup,
            MUIA_Background, MUII_GroupBack,
            MUIA_Frame     , MUIV_Frame_Group,
            MUIA_FrameTitle, LOCALE(MSG_BORDERTYPE, "Border Type"),
            Child, RectangleObject, End,
            Child, VGroup,
              Child, RectangleObject, End,
              Child, objs[BorderType] = Cycle(BorderTypeStrings),
              Child, RectangleObject, End,
            End,
            Child, RectangleObject, End,
          End,

          Child, HGroup,
            MUIA_Background, MUII_GroupBack,
            MUIA_Frame     , MUIV_Frame_Group,
            MUIA_FrameTitle, LOCALE(MSG_SELECTIONMODE, "Selection Border"),
            Child, RectangleObject, End,
            Child, VGroup,
              Child, RectangleObject, End,
              MUIA_Weight, 200,
              Child, objs[SelectionMode] = Cycle(SelectionModeStrings),
              Child, HGroup,
                Child, Label2(LOCALE(MSG_AUTOACTIVE, "Show Active on Mousehit")),
                Child, objs[AutoActive] = CheckMark(TRUE),
              End,            
              Child, RectangleObject, End,
            End,
            Child, RectangleObject, End,
          End,


        End,


      Child, TextObject,
        TextFrame,
        MUIA_Background, MUII_TextBack,
        MUIA_FixHeightTxt, "\n\n",
        MUIA_Text_Contents, ABOUTTEXT,
      End,
    End;

  if(prefsgroup)
  {
    DoMethod(objs[Look], MUIM_Notify, MUIA_Radio_Active, 0, textgroup, 6, MUIM_MultiSet, MUIA_Disabled, FALSE, textgroup, imagegroup, objs[InnerSpace_Text]);
    DoMethod(objs[Look], MUIM_Notify, MUIA_Radio_Active, 1, textgroup, 5, MUIM_MultiSet, MUIA_Disabled, TRUE, textgroup, objs[InnerSpace_Text]);
    DoMethod(objs[Look], MUIM_Notify, MUIA_Radio_Active, 2, textgroup, 5, MUIM_MultiSet, MUIA_Disabled, FALSE, textgroup, objs[InnerSpace_Text]);

    DoMethod(objs[Look], MUIM_Notify, MUIA_Radio_Active, 0, objs[InnerSpace_NoText], 3, MUIM_Set, MUIA_Disabled, TRUE);
    DoMethod(objs[Look], MUIM_Notify, MUIA_Radio_Active, 1, imagegroup, 5, MUIM_MultiSet, MUIA_Disabled, FALSE, imagegroup, objs[InnerSpace_NoText]);
    DoMethod(objs[Look], MUIM_Notify, MUIA_Radio_Active, 2, imagegroup, 5, MUIM_MultiSet, MUIA_Disabled, TRUE, imagegroup, objs[InnerSpace_NoText]);
  }

  return prefsgroup;
}
Ejemplo n.º 21
0
/******************************************************************
 Opens a person window
*******************************************************************/
void person_window_open(struct addressbook_entry *entry)
{
	Object *wnd, *add_button, *rem_button, *email_list, *email_string;
	Object *alias_string, *realname_string, *ok_button, *cancel_button;
	Object *homepage_string, *street_string, *city_string, *country_string, *phone1_string, *phone2_string;
	Object *description_string;
	int num;

	for (num=0; num < MAX_PERSON_OPEN; num++)
		if (!person_open[num]) break;

	wnd = WindowObject,
		(num < MAX_PERSON_OPEN)?MUIA_Window_ID:TAG_IGNORE, MAKE_ID('P','E','R',num),
    MUIA_Window_Title, "SimpleMail - Edit Person",
        
		WindowContents, VGroup,
			Child, VGroup,
				Child, HorizLineTextObject("Electronic mail"),
				Child, HGroup,
					Child, VGroup,
						Child, ColGroup(2),
							Child, MakeLabel("Alias"),
							Child, alias_string = BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								MUIA_String_AdvanceOnCR, TRUE,
								End,
							Child, MakeLabel("Real Name"),
							Child, realname_string = BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								MUIA_String_AdvanceOnCR, TRUE,
								End,
							Child, MakeLabel("PGP Key-ID"),
							Child, BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								MUIA_String_AdvanceOnCR, TRUE,
								End,
							Child, MakeLabel("Homepage"),
							Child, homepage_string = BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								MUIA_String_AdvanceOnCR, TRUE,
								End,
							End,
						Child, HVSpace,
						End,
					Child, VGroup,
						Child, NListviewObject,
							MUIA_CycleChain, 1,
							MUIA_NListview_NList, email_list = NListObject,
								MUIA_NList_DragSortable, TRUE,
								MUIA_NList_ConstructHook, MUIV_NList_ConstructHook_String,
								MUIA_NList_DestructHook, MUIV_NList_DestructHook_String,
								End,
							End,
						Child, HGroup,
							Child, email_string = BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								End,
							Child, HGroup,
								MUIA_Group_Spacing, 0,
								Child, add_button = MakeButton("Add"),
								Child, rem_button = MakeButton("Rem"),
								End,
							End,
						End,
					End,
				End,

			Child, HGroup,
				Child, ColGroup(2),
					Child, HorizLineTextObject("Snail mail"),
					Child, HorizLineTextObject("Miscellanous"),
/*					Child, HorizLineTextObject("Portrait"),*/
	
					Child, ColGroup(2),
						Child, MakeLabel("Street"),
						Child, street_string = BetterStringObject,
							StringFrame,
							MUIA_CycleChain, 1,
							MUIA_String_AdvanceOnCR, TRUE,
							End,
						Child, MakeLabel("City/ZIP"),
						Child, city_string = BetterStringObject,
							StringFrame,
							MUIA_CycleChain, 1,
							MUIA_String_AdvanceOnCR, TRUE,
							End,
						Child, MakeLabel("State/Country"),
						Child, country_string = BetterStringObject,
							StringFrame,
							MUIA_CycleChain, 1,
							MUIA_String_AdvanceOnCR, TRUE,
							End,
						Child, MakeLabel("Phone numbers"),
						Child, phone1_string = BetterStringObject,
							StringFrame,
							MUIA_CycleChain, 1,
							MUIA_String_AdvanceOnCR, TRUE,
							End,
						Child, HSpace(0),
						Child, phone2_string = BetterStringObject,
							StringFrame,
							MUIA_CycleChain, 1,
							MUIA_String_AdvanceOnCR, TRUE,
							End,
						End,

					Child, VGroup,
						Child, ColGroup(2),
							Child, MakeLabel("Description"),
							Child, description_string = BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								MUIA_String_AdvanceOnCR, TRUE,
								End,
							Child, MakeLabel("Date of birth"),
							Child, BetterStringObject,
								StringFrame,
								MUIA_CycleChain, 1,
								MUIA_String_AdvanceOnCR, TRUE,
								End,
							End,
						Child, HGroup,
							Child, VGroup,
								Child, MakeLabel("Notepad"),
								Child, VSpace(0),
								End,
							Child, TextEditorObject,
								InputListFrame,
								MUIA_CycleChain,1,
								End,
							End,
						End,
					End,
				End,

			Child, HorizLineObject,
			Child, HGroup,
				Child, ok_button = MakeButton("_Ok"),
				Child, cancel_button = MakeButton("_Cancel"),
				End,
			End,
		End;
	
	if (wnd)
	{
		struct Person_Data *data = (struct Person_Data*)malloc(sizeof(struct Person_Data));
		if (data)
		{
			data->wnd = wnd;
			data->rem_button = rem_button;
			data->alias_string = alias_string;
			data->email_list = email_list;
			data->email_string = email_string;
			data->realname_string = realname_string;
			data->description_string = description_string;
			data->homepage_string = homepage_string;
			data->street_string = street_string;
			data->city_string = city_string;
			data->country_string = country_string;
			data->phone1_string = phone1_string;
			data->phone2_string = phone2_string;
			data->person = entry;
			data->num = num;

			/* mark the window as opened */
			person_open[num] = 1;

			set(email_string, MUIA_String_AttachedList, email_list);
			set(add_button, MUIA_Weight,0);
			set(rem_button, MUIA_Weight,0);

			DoMethod(wnd, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, App, 7, MUIM_Application_PushMethod, App, 4, MUIM_CallHook, &hook_standard, person_window_close, data);
			DoMethod(cancel_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 7, MUIM_Application_PushMethod, App, 4, MUIM_CallHook, &hook_standard, person_window_close, data);
			DoMethod(ok_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 7, MUIM_Application_PushMethod, App, 4, MUIM_CallHook, &hook_standard, person_window_ok, data);
			DoMethod(add_button, MUIM_Notify, MUIA_Pressed, FALSE, App, 4, MUIM_CallHook, &hook_standard, person_add_email, data);
			DoMethod(rem_button, MUIM_Notify, MUIA_Pressed, FALSE, email_list, 2, MUIM_NList_Remove, MUIV_NList_Remove_Active);
			DoMethod(email_list, MUIM_Notify, MUIA_NList_Active, MUIV_EveryTime, App, 4, MUIM_CallHook, &hook_standard, person_email_list_active, data);
			DoMethod(email_string, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, App, 4, MUIM_CallHook, &hook_standard, person_email_string_contents, data);
			DoMethod(App,OM_ADDMEMBER,wnd);

			/* A person must be changed */
			if (entry && entry->type == ADDRESSBOOK_ENTRY_PERSON)
			{
				int i;
				for (i=0;i<entry->u.person.num_emails;i++)
				{
					DoMethod(email_list, MUIM_NList_InsertSingle, entry->u.person.emails[i], MUIV_NList_Insert_Bottom);
				}
				set(realname_string, MUIA_String_Contents, entry->u.person.realname);
				set(description_string, MUIA_String_Contents, entry->u.person.description);
				set(alias_string, MUIA_String_Contents, entry->u.person.alias);
				set(phone1_string, MUIA_String_Contents, entry->u.person.phone1);
				set(phone2_string, MUIA_String_Contents, entry->u.person.phone2);
				set(street_string, MUIA_String_Contents, entry->u.person.street);
				set(city_string, MUIA_String_Contents, entry->u.person.city);
				set(country_string, MUIA_String_Contents, entry->u.person.country);
				set(homepage_string, MUIA_String_Contents, entry->u.person.homepage);
			}

			person_email_list_active(&data);
			set(wnd,MUIA_Window_ActiveObject,alias_string);
			set(wnd,MUIA_Window_Open,TRUE);

			return;
		}
		MUI_DisposeObject(wnd);
	}
}