BOOL CxDlgPreferencesBackgroundRefresh::OnInitDialog() { CDialog::OnInitDialog(); int nContext = theApp.GetOneWindowType(); switch (nContext) { case TYPEDOC_DOM: if (m_strAllObject.LoadString (IDS_ALL_DOMOBJECT)) m_strAllObject = _T("All DOM Objects"); break; case TYPEDOC_MONITOR: if (m_strAllObject.LoadString (IDS_ALL_IPMOBJECT)) m_strAllObject = _T("All Monitor Objects"); break; default: if (m_strAllObject.LoadString (IDS_I_ALLOBJECT)) m_strAllObject = _T("All Objects"); break; } m_cEditFrequency.LimitText (4); m_cSpin1.SetRange (1, 9999); InitUnit (); FillObjectType(); FillUnit(); m_cComboObjectType.SetCurSel (0); m_cComboUnit.SetCurSel (0); ShowCharacteristics (0); SetDefaultMessageOption (); PushHelpId (IDD_REFRESHSET); if (nContext == TYPEDOC_MONITOR) m_cComboObjectType.EnableWindow (FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
static void HOOKCALL IDCMPhookFunc( REG( a0, struct Hook *hook ), REG( a2, Object *obj ), REG( a1, struct IntuiMessage *msg ) ) { switch(msg->Code) { case 0x42: { /* ** TAB - Next page ** SHIFT + TAB - Prev page */ ULONG pos = 0; struct TagItem tags[] = { {CLICKTAB_Current, 0}, {TAG_END, NULL} }; GetAttr( CLICKTAB_Current, Window_Objs[ACTID_TABS], &pos ); if ( msg->Qualifier & ( IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT )) pos--; else pos++; pos %= 2; tags[0].ti_Data = pos; MySetGadgetAttrs(Window_Objs[ACTID_TABS], CLICKTAB_Current, pos, TAG_END ); MySetGadgetAttrs(Window_Objs[ACTID_PAGE], PAGE_Current, pos, TAG_END ); RethinkLayout((struct Gadget *) Window_Objs[LAYOUT_PAGE], Window, NULL, TRUE); break; } case 0x4C: { /* ** UP - Move entry up. ** SHIFT + UP - Move page up. ** CTRL + UP - Move to the top. **/ ULONG mode = 0; if(msg->Qualifier & ( IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT )) MySetGadgetAttrs(Window_Objs[ACTID_MODE], LISTBROWSER_Position, LBP_PAGEUP, TAG_END ); else if(msg->Qualifier & IEQUALIFIER_CONTROL ) MySetGadgetAttrs(Window_Objs[ACTID_MODE], LISTBROWSER_Position, LBP_TOP, TAG_END ); else MySetGadgetAttrs(Window_Objs[ACTID_MODE], LISTBROWSER_Position, LBP_LINEUP, TAG_END ); GetAttr( LISTBROWSER_Selected, Window_Objs[ACTID_MODE], &mode); FillUnit(); NewMode(mode); GUINewMode(); break; } case 0x4D: { /* ** DOWN - Move entry down. ** SHIFT + DOWN - Move page down. ** CTRL + DOWN - Move to the end. **/ ULONG mode = 0; if(msg->Qualifier & ( IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT )) MySetGadgetAttrs(Window_Objs[ACTID_MODE], LISTBROWSER_Position, LBP_PAGEDOWN, TAG_END ); else if(msg->Qualifier & IEQUALIFIER_CONTROL ) MySetGadgetAttrs(Window_Objs[ACTID_MODE], LISTBROWSER_Position, LBP_BOTTOM, TAG_END ); else MySetGadgetAttrs(Window_Objs[ACTID_MODE], LISTBROWSER_Position, LBP_LINEDOWN, TAG_END ); GetAttr( LISTBROWSER_Selected, Window_Objs[ACTID_MODE], &mode); FillUnit(); NewMode(mode); GUINewMode(); break; } case 0x4f: { /* ** LEFT - Prev unit */ LONG pos = 0; int i; char **u = Units; for(i=0; *u; i++, u++); GetAttr( CHOOSER_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos ); pos = (pos - 1) % i; if(pos < 0) pos += i; MySetGadgetAttrs(Window_Objs[ACTID_UNIT], CHOOSER_Active, pos, TAG_END ); GetAttr( CHOOSER_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos); FillUnit(); NewUnit(pos); GUINewUnit(); break; } case 0x4e: { /* ** RIGHT - Prev unit */ LONG pos = 0; int i; char **u = Units; for(i=0; *u; i++, u++); GetAttr( CHOOSER_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos ); pos = (pos + 1) % i;; MySetGadgetAttrs(Window_Objs[ACTID_UNIT], CHOOSER_Active, pos, TAG_END ); GetAttr( CHOOSER_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos); FillUnit(); NewUnit(pos); GUINewUnit(); break; } } }
void EventLoop(void) { ULONG signal = NULL, rc; WORD code; BOOL running = TRUE; GetAttr( WINDOW_SigMask, WO_Window, &signal ); if(signal) { do { if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) { running=FALSE; } while (( rc = CA_HandleInput( WO_Window, &code)) != WMHI_LASTMSG) { switch(rc & WMHI_CLASSMASK) { case WMHI_CLOSEWINDOW: running=FALSE; break; case WMHI_GADGETUP: case WMHI_MENUPICK: { if((rc & WMHI_CLASSMASK) == WMHI_MENUPICK) { struct MenuItem *mi; mi = ItemAddress(Menu, rc & WMHI_MENUMASK); if(mi) { rc = (ULONG) GTMENUITEM_USERDATA(mi); } } switch( rc & WMHI_GADGETMASK) { #if 0 case ACTID_OPEN: { if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) { char *file = NULL; GetAttr( FRQ_Path, openreq, (ULONG *) &file); NewSettings(file); GUINewSettings(); } break; } case ACTID_SAVEAS: { FillUnit(); if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) { char *file = NULL; GetAttr( FRQ_Path, savereq, (ULONG *) &file); SaveSettings(file, UnitList); if(SaveIcons) { WriteIcon(file); } } break; } #endif case ACTID_ABOUT: Req( (char *) msgButtonOK, (char *) msgTextCopyright, "",(char *) msgTextProgramName, "1996-2003 Martin Blom" ); break; case ACTID_SAVE: FillUnit(); SaveSettings(ENVFILE, UnitList); SaveSettings(ENVARCFILE, UnitList); running=FALSE; break; case ACTID_USE: FillUnit(); SaveSettings(ENVFILE, UnitList); running=FALSE; break; case ACTID_QUIT: running=FALSE; break; case ACTID_DEFAULT: SetAttrs( WO_Window, WA_BusyPointer, TRUE, TAG_DONE); NewSettings(NULL); // This is VERY slow!! SetAttrs( WO_Window, WA_BusyPointer, FALSE, TAG_DONE); GUINewSettings(); break; case ACTID_LASTSAVED: NewSettings(ENVARCFILE); GUINewSettings(); break; case ACTID_RESTORE: NewSettings(args.from); GUINewSettings(); break; case ACTID_ICONS: { struct MenuItem *item; item = FindMenuItem(ACTID_ICONS); if(item) { if(item->Flags & CHECKED) SaveIcons = TRUE; else SaveIcons = FALSE; } break; } #if 0 case ACTID_HELP: { APTR lock = BGUI_LockWindow(Window); if(!BGUI_Help( Window, HELPFILE, "AHI", NULL)) { Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE); } BGUI_UnlockWindow(lock); break; } case ACTID_GUIDE: { APTR lock = BGUI_LockWindow(Window); if(!BGUI_Help( Window, HELPFILE, NULL, NULL)) { Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE); } BGUI_UnlockWindow(lock); break; } case ACTID_HELPINDEX: { APTR lock = BGUI_LockWindow(Window); if(!BGUI_Help( Window, HELPFILE, "Concept Index", 0)) { Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE); } BGUI_UnlockWindow(lock); break; } #endif case ACTID_UNIT: { FillUnit(); NewUnit(code); GUINewUnit(); break; } case ACTID_MODE: { FillUnit(); NewMode(code); GUINewMode(); break; } case ACTID_DEBUG: case ACTID_SURROUND: case ACTID_ECHO: case ACTID_CPULIMIT: case ACTID_CLIPMV: { ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90; ULONG clip = FALSE; GetAttr( CHOOSER_Active, Window_Objs[ACTID_DEBUG], &debug); GetAttr( CHOOSER_Active, Window_Objs[ACTID_SURROUND], &surround); GetAttr( CHOOSER_Active, Window_Objs[ACTID_ECHO], &echo); GetAttr( CHOOSER_Active, Window_Objs[ACTID_CLIPMV], &clip); GetAttr( INTEGER_Number, Window_Objs[ACTID_CPULIMIT], &cpu); globalprefs.ahigp_DebugLevel = debug; globalprefs.ahigp_DisableSurround = surround; globalprefs.ahigp_DisableEcho = (echo == 2); globalprefs.ahigp_FastEcho = (echo == 1); globalprefs.ahigp_MaxCPU = (cpu << 16) / 100; globalprefs.ahigp_ClipMasterVolume= clip; break; } } /* switch(GADGETMASK) */ } } /* switch(CLASSMASK) */ } /* HandleInput */ } while(running); } }
static void HOOKCALL IDCMPhookFunc( REG( a0, struct Hook *hook ), REG( a2, Object *obj ), REG( a1, struct IntuiMessage *msg) ) { switch(msg->Code) { case 0x42: { /* ** TAB - Next page ** SHIFT + TAB - Prev page */ ULONG pos = 0; GetAttr( MX_Active, Window_Objs[ACTID_TABS], &pos ); if ( msg->Qualifier & ( IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT )) pos--; else pos++; SetGadgetAttrs(( struct Gadget * ) Window_Objs[ACTID_TABS], window, NULL, MX_Active, pos, TAG_END ); break; } case 0x4C: { /* ** UP - Move entry up. ** SHIFT + UP - Move page up. ** CTRL + UP - Move to the top. **/ ULONG mode = 0; if(msg->Qualifier & ( IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT )) SetGadgetAttrs((struct Gadget *) Window_Objs[ACTID_MODE], window, NULL, LISTV_Select, LISTV_Select_Page_Up, TAG_END ); else if(msg->Qualifier & IEQUALIFIER_CONTROL ) SetGadgetAttrs((struct Gadget *) Window_Objs[ACTID_MODE], window, NULL, LISTV_Select, LISTV_Select_First, TAG_END ); else SetGadgetAttrs((struct Gadget *) Window_Objs[ACTID_MODE], window, NULL, LISTV_Select, LISTV_Select_Previous, TAG_END ); GetAttr( LISTV_LastClickedNum, Window_Objs[ACTID_MODE], &mode); FillUnit(); NewMode(mode); GUINewMode(); break; } case 0x4D: { /* ** DOWN - Move entry down. ** SHIFT + DOWN - Move page down. ** CTRL + DOWN - Move to the end. **/ ULONG mode = 0; if(msg->Qualifier & ( IEQUALIFIER_LSHIFT | IEQUALIFIER_RSHIFT )) SetGadgetAttrs((struct Gadget *) Window_Objs[ACTID_MODE], window, NULL, LISTV_Select, LISTV_Select_Page_Down, TAG_END ); else if(msg->Qualifier & IEQUALIFIER_CONTROL ) SetGadgetAttrs((struct Gadget *) Window_Objs[ACTID_MODE], window, NULL, LISTV_Select, LISTV_Select_Last, TAG_END ); else SetGadgetAttrs((struct Gadget *) Window_Objs[ACTID_MODE], window, NULL, LISTV_Select, LISTV_Select_Next, TAG_END ); GetAttr( LISTV_LastClickedNum, Window_Objs[ACTID_MODE], &mode); FillUnit(); NewMode(mode); GUINewMode(); break; } case 0x4f: { /* ** LEFT - Prev unit */ LONG pos = 0; int i; char **u = Units; for(i=0; *u; i++, u++); GetAttr( CYC_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos ); pos = (pos - 1) % i; if(pos < 0) pos += i; SetGadgetAttrs(( struct Gadget * ) Window_Objs[ACTID_UNIT], window, NULL, CYC_Active, pos, TAG_END ); GetAttr( CYC_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos); FillUnit(); NewUnit(pos); GUINewUnit(); break; } case 0x4e: { /* ** RIGHT - Prev unit */ LONG pos = 0; int i; char **u = Units; for(i=0; *u; i++, u++); GetAttr( CYC_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos ); pos = (pos + 1) % i;; SetGadgetAttrs(( struct Gadget * ) Window_Objs[ACTID_UNIT], window, NULL, CYC_Active, pos, TAG_END ); GetAttr( CYC_Active, Window_Objs[ACTID_UNIT], (ULONG *) &pos); FillUnit(); NewUnit(pos); GUINewUnit(); break; } } }
void EventLoop(void) { ULONG signal = NULL, rc; BOOL running = TRUE; GetAttr( WINDOW_SigMask, WO_Window, &signal ); if(signal) { do { if(Wait(signal | SIGBREAKF_CTRL_C) & SIGBREAKF_CTRL_C ) { running=FALSE; } while (( rc = HandleEvent( WO_Window )) != WMHI_NOMORE ) { switch(rc) { case WMHI_CLOSEWINDOW: running=FALSE; break; case ACTID_OPEN: { if(DoMethod( openreq, FRM_DOREQUEST ) == FRQ_OK) { char *file = NULL; GetAttr( FRQ_Path, openreq, (ULONG *) &file); NewSettings(file); GUINewSettings(); } break; } case ACTID_SAVEAS: { FillUnit(); if(DoMethod( savereq, FRM_DOREQUEST ) == FRQ_OK) { char *file = NULL; GetAttr( FRQ_Path, savereq, (ULONG *) &file); SaveSettings(file, UnitList); if(SaveIcons) { WriteIcon(file); } } break; } case ACTID_ABOUT: Req( (char *) msgButtonOK, (char *) msgTextCopyright, ISEQ_C, msgTextProgramName, "1996-2003 Martin Blom" ); break; case ACTID_SAVE: FillUnit(); SaveSettings(ENVFILE, UnitList); SaveSettings(ENVARCFILE, UnitList); running=FALSE; break; case ACTID_USE: FillUnit(); SaveSettings(ENVFILE, UnitList); running=FALSE; break; case ACTID_QUIT: running=FALSE; break; case ACTID_DEFAULT: NewSettings(NULL); GUINewSettings(); break; case ACTID_LASTSAVED: NewSettings(ENVARCFILE); GUINewSettings(); break; case ACTID_RESTORE: NewSettings(args.from); GUINewSettings(); break; case ACTID_ICONS: { struct MenuItem *item; item = FindMenuItem(ACTID_ICONS); if(item) { if(item->Flags & CHECKED) SaveIcons = TRUE; else SaveIcons = FALSE; } break; } case ACTID_HELP: { APTR lock = BGUI_LockWindow(window); if(!BGUI_Help( window, HELPFILE, "AHI", NULL)) { Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE); } BGUI_UnlockWindow(lock); break; } case ACTID_GUIDE: { APTR lock = BGUI_LockWindow(window); if(!BGUI_Help( window, HELPFILE, NULL, NULL)) { Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE); } BGUI_UnlockWindow(lock); break; } case ACTID_HELPINDEX: { APTR lock = BGUI_LockWindow(window); if(!BGUI_Help( window, HELPFILE, "Concept Index", 0)) { Req( (char *) msgButtonOK, (char *) msgTextNoFind, HELPFILE); } BGUI_UnlockWindow(lock); break; } case ACTID_UNIT: { ULONG unit; FillUnit(); GetAttr( CYC_Active, Window_Objs[rc], &unit); NewUnit(unit); GUINewUnit(); break; } case ACTID_MODE: { ULONG mode; FillUnit(); GetAttr( LISTV_LastClickedNum, Window_Objs[rc], &mode); NewMode(mode); GUINewMode(); break; } case ACTID_DEBUG: case ACTID_SURROUND: case ACTID_ECHO: case ACTID_CPULIMIT: case ACTID_CLIPMV: { ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90; ULONG clip = FALSE; GetAttr( CYC_Active, Window_Objs[ACTID_DEBUG], &debug); GetAttr( CYC_Active, Window_Objs[ACTID_SURROUND], &surround); GetAttr( CYC_Active, Window_Objs[ACTID_ECHO], &echo); GetAttr( CYC_Active, Window_Objs[ACTID_CLIPMV], &clip); GetAttr( SLIDER_Level, Window_Objs[ACTID_CPULIMIT], &cpu); globalprefs.ahigp_DebugLevel = debug; globalprefs.ahigp_DisableSurround = surround; globalprefs.ahigp_DisableEcho = (echo == 2); globalprefs.ahigp_FastEcho = (echo == 1); globalprefs.ahigp_MaxCPU = (cpu << 16) / 100; globalprefs.ahigp_ClipMasterVolume= clip; break; } } } } while(running); } }
void EventLoop(void) { ULONG sigs = 0UL; while (1) { ULONG rc = DoMethod(MUIApp, MUIM_Application_NewInput, &sigs); switch(rc) { case MUIV_Application_ReturnID_Quit: return; case ACTID_OPEN: { struct FileRequester *request; request = MUI_AllocAslRequestTags(ASL_FileRequest, ASLFR_Window, xget(MUIWindow, MUIA_Window_Window), ASLFR_TitleText, msgTextProgramName, ASLFR_RejectIcons, TRUE, ASLFR_InitialDrawer, "SYS:Prefs/Presets", TAG_DONE ); if( request != NULL ) { DoMethod(MUIApp, MUIA_Application_Sleep, TRUE); if (MUI_AslRequest(request, NULL)) { char *file; DoMethod(MUIApp, MUIA_Application_Sleep, FALSE); file = AllocVec(strlen(request->fr_Drawer)+128,0); if( file != NULL ) { CopyMem(request->fr_Drawer, file, strlen(request->fr_Drawer)+1); AddPart(file, request->fr_File, 128); NewSettings(file); GUINewSettings(); FreeVec(file); } } else { DoMethod(MUIApp, MUIA_Application_Sleep, FALSE); } MUI_FreeAslRequest(request); } break; } case ACTID_SAVEAS: { struct FileRequester *request; request = MUI_AllocAslRequestTags(ASL_FileRequest, ASLFR_Window, xget(MUIWindow, MUIA_Window_Window), ASLFR_TitleText, msgTextProgramName, ASLFR_RejectIcons, TRUE, ASLFR_DoSaveMode, TRUE, ASLFR_InitialDrawer, "SYS:Prefs/Presets", TAG_DONE); if(request != NULL ) { DoMethod(MUIApp, MUIA_Application_Sleep, TRUE); FillUnit(); if (MUI_AslRequest(request, NULL)) { char *file; DoMethod(MUIApp, MUIA_Application_Sleep, FALSE); file = AllocVec(strlen(request->fr_Drawer)+128,0); if( file != NULL ) { CopyMem(request->fr_Drawer, file, strlen(request->fr_Drawer)+1); AddPart(file, request->fr_File, 128); SaveSettings(file, UnitList); if(SaveIcons) { WriteIcon(file); } FreeVec(file); } } else { DoMethod(MUIApp, MUIA_Application_Sleep, FALSE); } MUI_FreeAslRequest(request); } break; } case ACTID_ABOUT: { char* args[] = { "\033c", (char*)msgTextProgramName, "1996-2004 Stéphane Barbaray/Martin Blom" }; MUI_RequestA(MUIApp, MUIWindow, 0, (char *) msgTextProgramName, (char*)msgButtonOK, (char*)msgTextCopyright, args ); break; } case ACTID_SAVE: FillUnit(); SaveSettings(ENVFILE, UnitList); SaveSettings(ENVARCFILE, UnitList); return; case ACTID_USE: FillUnit(); SaveSettings(ENVFILE, UnitList); return; case ACTID_QUIT: return; case ACTID_DEFAULT: NewSettings(NULL); GUINewSettings(); break; case ACTID_LASTSAVED: NewSettings(ENVARCFILE); GUINewSettings(); break; case ACTID_RESTORE: NewSettings(args.from); GUINewSettings(); break; case ACTID_ICONS: { APTR item = (APTR)DoMethod(MUIMenu,MUIM_FindUData,ACTID_ICONS); if(item) { if(xget(item, MUIA_Menuitem_Checked)) { SaveIcons = TRUE; } else { SaveIcons = FALSE; } } break; } case ACTID_HELP: DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"AHI",0); break; case ACTID_GUIDE: DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"MAIN",0); break; case ACTID_HELPINDEX: DoMethod(MUIApp,MUIM_Application_ShowHelp,NULL,NULL,"Concept Index",0); break; case ACTID_UNIT: FillUnit(); NewUnit(xget(MUIUnit,MUIA_Cycle_Active)); GUINewUnit(); break; case ACTID_MODE: FillUnit(); NewMode(xget(MUIList, MUIA_List_Active)); GUINewMode(); break; case ACTID_PLAY: { int unit_id; struct UnitNode* unit; FillUnit(); unit_id = xget( MUIUnit, MUIA_Cycle_Active ); unit = (struct UnitNode *) GetNode( unit_id, UnitList ); PlaySound( &unit->prefs ); break; } case ACTID_DEBUG: case ACTID_SURROUND: case ACTID_ECHO: case ACTID_CPULIMIT: case ACTID_CLIPMV: case ACTID_ACTIME: case ACTID_SCALEMODE: { ULONG debug = AHI_DEBUG_NONE, surround = FALSE, echo = 0, cpu = 90; ULONG clip = FALSE, actime = 0, scalemode = AHI_SCALE_FIXED_0_DB; get(MUIDebug, MUIA_Cycle_Active, &debug); get(MUISurround, MUIA_Cycle_Active, &surround); get(MUIEcho, MUIA_Cycle_Active, &echo); get(MUIClipvol, MUIA_Cycle_Active, &clip); get(MUICpu, MUIA_Numeric_Value, &cpu); get(MUIACTime, MUIA_Numeric_Value, &actime); get(MUIScalemode, MUIA_Cycle_Active, &scalemode); globalprefs.ahigp_DebugLevel = debug; globalprefs.ahigp_DisableSurround = surround; globalprefs.ahigp_DisableEcho = (echo == 2); globalprefs.ahigp_FastEcho = (echo == 1); globalprefs.ahigp_MaxCPU = ((cpu << 16) + 50) / 100; globalprefs.ahigp_ClipMasterVolume = clip; globalprefs.ahigp_AntiClickTime = ((actime << 16) + 500) / 1000; globalprefs.ahigp_ScaleMode = scalemode; break; } } if (sigs) { sigs = Wait(sigs | SIGBREAKF_CTRL_C); if (sigs & SIGBREAKF_CTRL_C) return; } } }