void ami_menu_update_checked(struct gui_window_2 *gwin) { struct Menu *menustrip; GetAttr(WINDOW_MenuStrip, gwin->objects[OID_MAIN], (ULONG *)&menustrip); if(!menustrip) return; #if defined(WITH_JS) || defined(WITH_MOZJS) if(nsoption_bool(enable_javascript) == true) { if((ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED; } else { if(ItemAddress(menustrip, AMI_MENU_JS)->Flags & CHECKED) ItemAddress(menustrip, AMI_MENU_JS)->Flags ^= CHECKED; } #endif if(nsoption_bool(foreground_images) == true) { if((ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^= CHECKED; } else { if(ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags & CHECKED) ItemAddress(menustrip, AMI_MENU_FOREIMG)->Flags ^= CHECKED; } if(nsoption_bool(background_images) == true) { if((ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED) == 0) ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^= CHECKED; } else { if(ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags & CHECKED) ItemAddress(menustrip, AMI_MENU_BACKIMG)->Flags ^= CHECKED; } ResetMenuStrip(gwin->win, menustrip); }
static int vsid_menu_update(void) { int i, j; int value; int result; for (i = 0; toggle_list[i].name != NULL; i++) { value = 0; resources_get_value(toggle_list[i].name, (void *)&value); toggle_menu_item(vsid_menu, toggle_list[i].idm, value); } for (i = 0; value_list[i].name != NULL; i++) { value = -1; result = resources_get_value(value_list[i].name, (void *)&value); if (result == 0) { unsigned int checked = 0; toggle_menu_item(vsid_menu, value_list[i].default_idm, 0); for (j = 0; value_list[i].vals[j].idm != 0; j++) { if (value == value_list[i].vals[j].value && !checked) { toggle_menu_item(vsid_menu, value_list[i].vals[j].idm, 1); checked = 1; } else { toggle_menu_item(vsid_menu, value_list[i].vals[j].idm, 0); } } if (checked == 0 && value_list[i].default_idm > 0) { toggle_menu_item(vsid_menu, value_list[i].default_idm, 1); } } } ResetMenuStrip(vsid_window, vsid_menu); return 0; }
BOOL BuildGUI(char *screenname) { Object **ar = Window_Objs; struct Screen *screen; BOOL OptionFrame = FALSE; LONG indicatorwidth = 100; Object *l1, *l2, *l3, *l4, *l5, *l6, *l7; UpdateStrings(); if (ButtonBase == NULL) { /* force it open */ Printf((char *) msgTextNoOpen, "button.gadget", __classactversion); Printf("\n"); return FALSE; } /* Dynamic */ unitlist = ChooserLabelsA( (STRPTR *) Units); modelist = BrowserNodesA( (STRPTR *) Modes); infolist = BrowserNodes2(infotexts, infoargs); /* Static */ pagelist = ClickTabs( (char *) msgPageMode, (char *) msgPageAdvanced, NULL); debuglist = ChooserLabels( (char *) msgDebugNone, (char *) msgDebugLow, (char *) msgDebugHigh, (char *) msgDebugFull, NULL); echolist = ChooserLabels( (char *) msgEchoEnabled, (char *) msgEchoFast, (char *) msgEchoDisabled, NULL); surroundlist = ChooserLabels( (char *) msgSurroundEnabled, (char *) msgSurroundDisabled, NULL); clipMVlist = ChooserLabels( (char *) msgMVNoClip, (char *) msgMVClip, NULL); screen = LockPubScreen(screenname); vi = GetVisualInfoA(screen, NULL); Menu = CreateMenusA(NewMenus, NULL); if(vi == NULL || Menu == NULL) { Printf((char *) msgTextNoWindow); Printf("\n"); return FALSE; } if(!LayoutMenus(Menu, vi, GTMN_NewLookMenus, TRUE, TAG_DONE)) { Printf((char *) msgTextNoWindow); Printf("\n"); return FALSE; } indicatorwidth = max(indicatorwidth, 16 * screen->RastPort.Font->tf_XSize); if(screen->Height > 240) { OptionFrame = TRUE; } ar[ACTID_PAGE] = PageObject, PAGE_Current, 0, /* PAGE 1 */ PAGE_Add, HLayoutObject, LAYOUT_VertAlignment, LALIGN_CENTER, LAYOUT_AddChild, VLayoutObject, LAYOUT_AddChild, ar[ACTID_UNIT] = PopUpObject, CHOOSER_Labels, unitlist, CHOOSER_Active, state.UnitSelected, ChooserEnd, CHILD_WeightedHeight, 0, LAYOUT_AddChild, ar[ACTID_MODE] = ListBrowserObject, LISTBROWSER_Labels, modelist, LISTBROWSER_MakeVisible,state.ModeSelected, LISTBROWSER_Selected, state.ModeSelected, LISTBROWSER_ShowSelected,TRUE, ListBrowserEnd, LAYOUT_AddChild, ar[SHOWID_MODE] = ListBrowserObject, LISTBROWSER_Labels, infolist, LISTBROWSER_ColumnInfo, (ULONG)&ci, LISTBROWSER_AutoFit, TRUE, LISTBROWSER_VertSeparators, FALSE, GA_ReadOnly, TRUE, ListBrowserEnd, CHILD_MaxHeight, screen->RastPort.Font->tf_YSize * 6 + 6, // UHH!! LayoutEnd, LAYOUT_AddChild, HLayoutObject, (OptionFrame ? LAYOUT_SpaceOuter : TAG_IGNORE), TRUE, (OptionFrame ? LAYOUT_RightSpacing : TAG_IGNORE), 0, (OptionFrame ? LAYOUT_BevelStyle : TAG_IGNORE), BVS_GROUP, (OptionFrame ? LAYOUT_Label : TAG_IGNORE), (char *) msgOptions, LAYOUT_AddChild, VLayoutObject, LAYOUT_AddChild, l1 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_FREQ] = SliderObject, SLIDER_Min, 0, SLIDER_Max, state.Frequencies, SLIDER_Level, state.FreqSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptFrequency, LabelEnd, LAYOUT_AddChild, ar[SHOWID_FREQ] = ButtonObject, GA_Text, getFreq(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LAYOUT_AddChild, l2 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_CHANNELS] = SliderObject, SLIDER_Min, 1, SLIDER_Max, state.Channels, SLIDER_Level, state.ChannelsSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptChannels, LabelEnd, LAYOUT_AddChild, ar[SHOWID_CHANNELS] = ButtonObject, GA_Text, getChannels(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LAYOUT_AddChild, l3 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_OUTVOL] = SliderObject, SLIDER_Min, 0, SLIDER_Max, state.OutVols, SLIDER_Level, state.OutVolSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptVolume, LabelEnd, LAYOUT_AddChild, ar[SHOWID_OUTVOL] = ButtonObject, GA_Text, getOutVol(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LAYOUT_AddChild, l4 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_MONVOL] = SliderObject, SLIDER_Min, 0, SLIDER_Max, state.MonVols, SLIDER_Level, state.MonVolSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptMonitor, LabelEnd, LAYOUT_AddChild, ar[SHOWID_MONVOL] = ButtonObject, GA_Text, getMonVol(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LAYOUT_AddChild, l5 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_GAIN] = SliderObject, SLIDER_Min, 0, SLIDER_Max, state.Gains, SLIDER_Level, state.GainSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptGain, LabelEnd, LAYOUT_AddChild, ar[SHOWID_GAIN] = ButtonObject, GA_Text, getGain(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LAYOUT_AddChild, l6 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_INPUT] = SliderObject, SLIDER_Min, 0, SLIDER_Max, state.Inputs, SLIDER_Level, state.InputSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptInput, LabelEnd, LAYOUT_AddChild, ar[SHOWID_INPUT] = ButtonObject, GA_Text, getInput(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LAYOUT_AddChild, l7 = HLayoutObject, LAYOUT_AddChild, ar[ACTID_OUTPUT] = SliderObject, SLIDER_Min, 0, SLIDER_Max, state.Outputs, SLIDER_Level, state.OutputSelected, SLIDER_Orientation, SORIENT_HORIZ, GA_UserData, &GadgetHook, SliderEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgOptOutput, LabelEnd, LAYOUT_AddChild, ar[SHOWID_OUTPUT] = ButtonObject, GA_Text, getOutput(), GA_ReadOnly, TRUE, BUTTON_BevelStyle, BVS_NONE, BUTTON_Transparent, TRUE, BUTTON_Justification, BCJ_LEFT, ButtonEnd, CHILD_MinWidth, indicatorwidth, CHILD_MaxWidth, indicatorwidth, LayoutEnd, LayoutEnd, LayoutEnd, CHILD_WeightedHeight, 0, LayoutEnd, /* PAGE 2 */ PAGE_Add, HLayoutObject, LAYOUT_VertAlignment, LALIGN_CENTER, LAYOUT_HorizAlignment, LALIGN_CENTER, LAYOUT_AddChild, VLayoutObject, LAYOUT_SpaceOuter, TRUE, LAYOUT_BevelStyle, BVS_GROUP, LAYOUT_Label, (char *) msgGlobalOptions, LAYOUT_VertAlignment, LALIGN_BOTTOM, LAYOUT_AddChild, ar[ACTID_DEBUG] = PopUpObject, CHOOSER_Labels, debuglist, CHOOSER_Active, globalprefs.ahigp_DebugLevel, ChooserEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgGlobOptDebugLevel, LabelEnd, LAYOUT_AddChild, ar[ACTID_ECHO] = PopUpObject, CHOOSER_Labels, echolist, CHOOSER_Active, (globalprefs.ahigp_DisableEcho ? 2 : 0) | (globalprefs.ahigp_FastEcho ? 1 : 0), ChooserEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgGlobOptEcho, LabelEnd, LAYOUT_AddChild, ar[ACTID_SURROUND] = PopUpObject, CHOOSER_Labels, surroundlist, CHOOSER_Active, globalprefs.ahigp_DisableSurround, ChooserEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgGlobOptSurround, LabelEnd, LAYOUT_AddChild, ar[ACTID_CLIPMV] = PopUpObject, CHOOSER_Labels, clipMVlist, CHOOSER_Active, globalprefs.ahigp_ClipMasterVolume, ChooserEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgGlobOptMasterVol, LabelEnd, LAYOUT_AddChild, ar[ACTID_CPULIMIT] = IntegerObject, INTEGER_MaxChars, 3, INTEGER_MinVisible, 3, INTEGER_Minimum, 0, INTEGER_Maximum, 100, INTEGER_Number, (globalprefs.ahigp_MaxCPU * 100 + 32768) >> 16, INTEGER_Arrows, TRUE, IntegerEnd, CHILD_Label, LabelObject, LABEL_Text, (char *) msgGlobOptCPULimit, LabelEnd, LayoutEnd, CHILD_WeightedHeight, 0, CHILD_WeightedWidth, 0, LayoutEnd, PageEnd; if(ar[ACTID_PAGE] != NULL) { SetAttrs( l1, LAYOUT_AlignLabels, l2, TAG_DONE); SetAttrs( l2, LAYOUT_AlignLabels, l3, TAG_DONE); SetAttrs( l3, LAYOUT_AlignLabels, l4, TAG_DONE); SetAttrs( l4, LAYOUT_AlignLabels, l5, TAG_DONE); SetAttrs( l5, LAYOUT_AlignLabels, l6, TAG_DONE); SetAttrs( l6, LAYOUT_AlignLabels, l7, TAG_DONE); SetAttrs( l7, LAYOUT_AlignLabels, l1, TAG_DONE); } WO_Window = WindowObject, WA_PubScreen, screen, WA_Title, (char *) msgTextProgramName, WA_CloseGadget, TRUE, WA_DepthGadget, TRUE, WA_DragBar, TRUE, WA_Activate, TRUE, WA_SizeGadget, TRUE, WA_SizeBBottom, TRUE, WA_NewLookMenus, TRUE, WA_InnerWidth, 800, WA_InnerHeight, 400, WINDOW_MenuStrip, Menu, WINDOW_Position, WPOS_CENTERSCREEN, WINDOW_GadgetUserData, WGUD_HOOK, WINDOW_IDCMPHook, &IDCMPhook, WINDOW_IDCMPHookBits, IDCMP_RAWKEY, WINDOW_Layout, VLayoutObject, LAYOUT_SpaceOuter, TRUE, LAYOUT_DeferLayout, TRUE, /* TABS */ LAYOUT_AddChild, ar[LAYOUT_PAGE] = VLayoutObject, LAYOUT_AddChild, ar[ACTID_TABS] = ClickTabObject, CLICKTAB_Labels, pagelist, CLICKTAB_Current, 0L, ICA_TARGET, ar[ACTID_PAGE], ICA_MAP, MapTab2Page, ClickTabEnd, LAYOUT_AddChild, ar[ACTID_PAGE], LayoutEnd, /* BUTTONS */ LAYOUT_AddChild, HLayoutObject, LAYOUT_EvenSize, TRUE, LAYOUT_AddChild, ar[ACTID_SAVE] = ButtonObject, GA_Text, (char *) msgButtonSave, ButtonEnd, CHILD_WeightedHeight, 0, LAYOUT_AddChild, ar[ACTID_USE] = ButtonObject, GA_Text, (char *) msgButtonUse, ButtonEnd, CHILD_WeightedHeight, 0, LAYOUT_AddChild, ar[ACTID_QUIT] = ButtonObject, GA_Text, (char *) msgButtonCancel, ButtonEnd, CHILD_WeightedHeight, 0, LayoutEnd, CHILD_WeightedHeight, 0, LayoutEnd, WindowEnd; if(WO_Window) { int i; for(i = 0; i < ACTID_COUNT; i++) { if(Window_Objs[i] != NULL) { SetAttrs(Window_Objs[i], GA_ID, i, GA_RelVerify, TRUE, TAG_END); } } Window = (struct Window *) CA_OpenWindow(WO_Window); } if(screen) { UnlockPubScreen(NULL, screen); } if(Window == NULL) { Printf((char *) msgTextNoWindow); Printf("\n"); return FALSE; } openreq = GetFileObject, GETFILE_RejectIcons, TRUE, GETFILE_Drawer, "SYS:Prefs/Presets", EndObject; savereq = GetFileObject, GETFILE_RejectIcons, TRUE, GETFILE_Drawer, "SYS:Prefs/Presets", GETFILE_DoSaveMode, TRUE, EndObject; if((openreq == NULL) || (savereq == NULL)) { Printf((char *) msgTextNoFileRequester); Printf("\n"); return FALSE; } // Update the checkmark for "Create Icons?" { struct Menu *menu; struct MenuItem *item; menu = Menu; ClearMenuStrip(Window); item = FindMenuItem(ACTID_ICONS); if(item) { if(SaveIcons) item->Flags |= CHECKED; else item->Flags &= ~CHECKED; } ResetMenuStrip(Window, menu); } GUINewUnit(); return TRUE; }
BOOL BuildGUI(char *screenname) { Object **ar = Window_Objs; struct Screen *screen; BOOL OptionFrame = FALSE; LONG indicatorwidth = 100; UpdateStrings(); // Kludge for Piccaso 96/BGUI. if(FindTask("Picasso96")) { PopUpMenus = FALSE; } BGUIBase = (void *)OpenLibrary("bgui.library", 41); if(BGUIBase == NULL) { Printf((char *) msgTextNoOpen, (ULONG) "bgui.library", 41); Printf("\n"); return FALSE; } screen = LockPubScreen(screenname); indicatorwidth = max(indicatorwidth, 16 * screen->RastPort.Font->tf_XSize); if(screen->Height > 240) { OptionFrame = TRUE; } WO_Window = WindowObject, WINDOW_PubScreen, screen, WINDOW_Title, (char *) msgTextProgramName, WINDOW_CloseGadget, FALSE, WINDOW_MenuStrip, Menus, WINDOW_AutoAspect, TRUE, WINDOW_AutoKeyLabel, TRUE, WINDOW_ScaleWidth, 60, WINDOW_ScaleHeight, 20, WINDOW_HelpFile, HELPFILE, WINDOW_HelpNode, "AHI", WINDOW_IDCMPHook, &IDCMPhook, WINDOW_IDCMPHookBits, IDCMP_RAWKEY, WINDOW_MasterGroup, VGroupObject, NormalOffset, /* TABS */ StartMember, ar[ACTID_TABS] = MxObject, MX_Labels, PageNames, MX_TabsObject, TRUE, GA_ID, ACTID_TABS, EndObject, FixMinHeight, EndMember, StartMember, ar[ACTID_PAGE] = PageObject, NormalSpacing, PAGE_NoBufferRP, TRUE, /* PAGE 1 */ PageMember, HGroupObject, NormalOffset, NormalSpacing, TabAboveFrame, StartMember, vgroup = VGroupObject, NormalSpacing, StartMember, ar[ACTID_UNIT] = CycleObject, CYC_Labels, Units, CYC_Active, state.UnitSelected, CYC_PopActive, PopUpMenus, CYC_Popup, PopUpMenus, GA_ID, ACTID_UNIT, EndObject, FixMinHeight, EndMember, StartMember, ar[ACTID_MODE] = ListviewObject, // LISTV_EntryArray, Modes, // LISTV_Select, state.ModeSelected, PGA_NewLook, TRUE, GA_ID, ACTID_MODE, EndObject, EndMember, StartMember, HGroupObject, ButtonFrame, FRM_Flags, FRF_RECESSED, StartMember, InfoObject, INFO_TextFormat, (char *) msgProperties, INFO_FixTextWidth,TRUE, INFO_MinLines, 6, EndObject, FixMinWidth, EndMember, StartMember, ar[SHOWID_MODE] = InfoObject, INFO_MinLines, 6, EndObject, EndMember, EndObject, FixMinHeight, EndMember, EndObject /* vgroup */, EndMember, StartMember, VGroupObject, NormalSpacing, VarSpace(1), StartMember, VGroupObject, (OptionFrame ? GROUP_HorizOffset : TAG_IGNORE), GRSPACE_NORMAL, (OptionFrame ? GROUP_VertOffset : TAG_IGNORE), GRSPACE_NORMAL, (OptionFrame ? GROUP_Spacing : TAG_IGNORE), GRSPACE_NORMAL, (OptionFrame ? FRM_Type : TAG_IGNORE), FRTYPE_RIDGE, (OptionFrame ? FRM_Flags : TAG_IGNORE), FRF_RECESSED, (OptionFrame ? FRM_Title : TAG_IGNORE), (char *) msgOptions, StartMember, HGroupObject, StartMember, ar[ACTID_FREQ] = SliderObject, LAB_Label, (char *) msgOptFrequency, SLIDER_Min, 0, SLIDER_Max, state.Frequencies -1 , SLIDER_Level, state.FreqSelected, PGA_NewLook, TRUE, GA_ID, ACTID_FREQ, EndObject, EndMember, StartMember, ar[SHOWID_FREQ] = InfoObject, INFO_TextFormat, getFreq(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, StartMember, HGroupObject, StartMember, ar[ACTID_CHANNELS] = SliderObject, LAB_Label, (char *) msgOptChannels, SLIDER_Min, 1, SLIDER_Max, state.Channels, SLIDER_Level, state.ChannelsSelected, PGA_NewLook, TRUE, GA_ID, ACTID_CHANNELS, EndObject, EndMember, StartMember, ar[SHOWID_CHANNELS] = InfoObject, INFO_TextFormat, getChannels(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, StartMember, HGroupObject, StartMember, ar[ACTID_OUTVOL] = SliderObject, LAB_Label, (char *) msgOptVolume, SLIDER_Min, 0, SLIDER_Max, state.OutVols-1 , SLIDER_Level, state.OutVolSelected, PGA_NewLook, TRUE, GA_ID, ACTID_OUTVOL, EndObject, EndMember, StartMember, ar[SHOWID_OUTVOL] = InfoObject, INFO_TextFormat, getOutVol(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, StartMember, HGroupObject, StartMember, ar[ACTID_MONVOL] = SliderObject, LAB_Label, (char *) msgOptMonitor, SLIDER_Min, 0, SLIDER_Max, state.MonVols-1 , SLIDER_Level, state.MonVolSelected, PGA_NewLook, TRUE, GA_ID, ACTID_MONVOL, EndObject, EndMember, StartMember, ar[SHOWID_MONVOL] = InfoObject, INFO_TextFormat, getMonVol(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, StartMember, HGroupObject, StartMember, ar[ACTID_GAIN] = SliderObject, LAB_Label, (char *) msgOptGain, SLIDER_Min, 0, SLIDER_Max, state.Gains-1 , SLIDER_Level, state.GainSelected, PGA_NewLook, TRUE, GA_ID, ACTID_GAIN, EndObject, EndMember, StartMember, ar[SHOWID_GAIN] = InfoObject, INFO_TextFormat, getGain(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, StartMember, HGroupObject, StartMember, ar[ACTID_INPUT] = SliderObject, LAB_Label, (char *) msgOptInput, SLIDER_Min, 0, SLIDER_Max, state.Inputs-1 , SLIDER_Level, state.InputSelected, PGA_NewLook, TRUE, GA_ID, ACTID_INPUT, EndObject, EndMember, StartMember, ar[SHOWID_INPUT] = InfoObject, INFO_TextFormat, getInput(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, StartMember, HGroupObject, StartMember, ar[ACTID_OUTPUT] = SliderObject, LAB_Label, (char *) msgOptOutput, SLIDER_Min, 0, SLIDER_Max, state.Outputs-1 , SLIDER_Level, state.OutputSelected, PGA_NewLook, TRUE, GA_ID, ACTID_OUTPUT, EndObject, EndMember, StartMember, ar[SHOWID_OUTPUT] = InfoObject, INFO_TextFormat, getOutput(), INFO_VertOffset, 0, EndObject, FixWidth(indicatorwidth), EndMember, EndObject, FixMinHeight, EndMember, EndObject /* vgroup "Options" */, FixMinHeight, EndMember, VarSpace(1), EndObject /* vgroup */, EndMember, EndObject, /* (EndMember) page */ /* PAGE 2 */ PageMember, HGroupObject, NormalSpacing, TabAboveFrame, VarSpace(1), StartMember, VGroupObject, NormalSpacing, VarSpace(1), StartMember, VGroupObject, NormalOffset, NormalSpacing, RidgeFrame, FRM_Flags, FRF_RECESSED, FrameTitle((char *) msgGlobalOptions), StartMember, HGroupObject, NormalSpacing, StartMember, VGroupObject, NormalSpacing, StartMember, ar[ACTID_DEBUG] = CycleObject, LAB_Label, (char *) msgGlobOptDebugLevel, LAB_Place, PLACE_LEFT, CYC_Labels, DebugLabels, CYC_Active, globalprefs.ahigp_DebugLevel, CYC_PopActive, PopUpMenus, CYC_Popup, PopUpMenus, GA_ID, ACTID_DEBUG, EndObject, FixMinHeight, EndMember, StartMember, ar[ACTID_ECHO] = CycleObject, LAB_Label, (char *) msgGlobOptEcho, LAB_Place, PLACE_LEFT, CYC_Labels, EchoLabels, CYC_Active, (globalprefs.ahigp_DisableEcho ? 2 : 0) | (globalprefs.ahigp_FastEcho ? 1 : 0), CYC_PopActive, PopUpMenus, CYC_Popup, PopUpMenus, GA_ID, ACTID_ECHO, EndObject, FixMinHeight, EndMember, StartMember, ar[ACTID_SURROUND] = CycleObject, LAB_Label, (char *) msgGlobOptSurround, LAB_Place, PLACE_LEFT, CYC_Labels, SurroundLabels, CYC_Active, globalprefs.ahigp_DisableSurround, GA_ID, ACTID_SURROUND, EndObject, FixMinHeight, EndMember, StartMember, ar[ACTID_CLIPMV] = CycleObject, LAB_Label, (char *) msgGlobOptMasterVol, LAB_Place, PLACE_LEFT, CYC_Labels, ClipMVLabels, CYC_Active, globalprefs.ahigp_ClipMasterVolume, GA_ID, ACTID_CLIPMV, EndObject, FixMinHeight, EndMember, StartMember, ar[ACTID_CPULIMIT] = SliderObject, LAB_Label, (char *) msgGlobOptCPULimit, SLIDER_Min, 0, SLIDER_Max, 100, SLIDER_Level, (globalprefs.ahigp_MaxCPU * 100 + 32768) >> 16, PGA_NewLook, TRUE, GA_ID, ACTID_CPULIMIT, EndObject, EndMember, EndObject /* vgroup */, EndMember, StartMember, VGroupObject, NormalSpacing, VarSpace(1), StartMember, ar[SHOWID_CPULIMIT] = IndicatorObject,\ INDIC_Min, 0, INDIC_Max, 100, INDIC_Level, (globalprefs.ahigp_MaxCPU * 100 + 32768) / 65536, INDIC_Justification, IDJ_LEFT, INDIC_FormatString, "%ld%%", EndObject, FixMinWidth, FixMinHeight, EndMember, EndObject /* vgroup */, EndMember, EndObject /* hgroup */, EndMember, EndObject, FixMinWidth, FixMinHeight, EndMember, VarSpace(1), EndObject /* vgroup */ , FixMinWidth, EndMember, VarSpace(1), EndObject, /* (EndMember) page */ EndObject /* page */, EndMember, /* BUTTONS */ StartMember, HGroupObject, NormalSpacing, NormalVOffset, StartMember, ar[ACTID_SAVE] = ButtonObject, ButtonFrame, LAB_Label, (char *) msgButtonSave, GA_ID, ACTID_SAVE, EndObject, EndMember, StartMember, ar[ACTID_USE] = ButtonObject, ButtonFrame, LAB_Label, (char *) msgButtonUse, GA_ID, ACTID_USE, EndObject, EndMember, StartMember, ar[ACTID_QUIT] = ButtonObject, ButtonFrame, LAB_Label, (char *) msgButtonCancel, GA_ID, ACTID_QUIT, EndObject, EndMember, EndObject, FixMinHeight, EndMember, EndObject, EndObject; if(WO_Window) { AddMap( ar[ACTID_TABS], ar[ACTID_PAGE], pagemap ); DoMethod( ar[ACTID_FREQ], BASE_ADDHOOK, &GadgetHook ); DoMethod( ar[ACTID_CHANNELS], BASE_ADDHOOK, &GadgetHook ); DoMethod( ar[ACTID_OUTVOL], BASE_ADDHOOK, &GadgetHook ); DoMethod( ar[ACTID_MONVOL], BASE_ADDHOOK, &GadgetHook ); DoMethod( ar[ACTID_GAIN], BASE_ADDHOOK, &GadgetHook ); DoMethod( ar[ACTID_INPUT], BASE_ADDHOOK, &GadgetHook ); DoMethod( ar[ACTID_OUTPUT], BASE_ADDHOOK, &GadgetHook ); AddMap( ar[ACTID_CPULIMIT], ar[SHOWID_CPULIMIT], cpumap); window = WindowOpen(WO_Window); } if(screen) { UnlockPubScreen(NULL, screen); } if(window == NULL) { Printf((char *) msgTextNoWindow); Printf("\n"); return FALSE; } openreq = FileReqObject, ASLFR_Window, window, ASLFR_SleepWindow, TRUE, ASLFR_RejectIcons, TRUE, ASLFR_InitialDrawer, "SYS:Prefs/Presets", EndObject; savereq = FileReqObject, ASLFR_Window, window, ASLFR_SleepWindow, TRUE, ASLFR_RejectIcons, TRUE, ASLFR_InitialDrawer, "SYS:Prefs/Presets", ASLFR_DoSaveMode, TRUE, EndObject; if((openreq == NULL) || (savereq == NULL)) { Printf((char *) msgTextNoFileRequester); Printf("\n"); return FALSE; } // Update the checkmark for "Create Icons?" { struct Menu *menu = NULL; struct MenuItem *item; GetAttr( WINDOW_MenuStrip, WO_Window, (ULONG *) &menu); ClearMenuStrip(window); item = FindMenuItem(ACTID_ICONS); if(item) { if(SaveIcons) item->Flags |= CHECKED; else item->Flags &= ~CHECKED; } ResetMenuStrip(window, menu); } GUINewUnit(); return TRUE; }
// Fix menus for a window void display_fix_menu(struct Window *window,long type,APTR spec) { struct Menu *menu,*menustrip; struct MenuItem *item; // Get menu strip if (!window || !(menustrip=window->MenuStrip)) return; // Clear menu strip ClearMenuStrip(window); // Create icons if ((item=find_menu_item(menustrip,MENU_CREATE_ICONS))) { if (GUI->flags&GUIF_SAVE_ICONS) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Clock item if ((item=find_menu_item(menustrip,MENU_CLOCK))) { if (GUI->flags&GUIF_CLOCK) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Filter if ((item=find_menu_item(menustrip,MENU_FILTER))) { if (GUI->flags&GUIF_FILE_FILTER) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Def public screen if ((item=find_menu_item(menustrip,MENU_DEFPUBSCR))) { if (GUI->flags&GUIF_DEFPUBSCR) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Backdrop item if ((item=find_menu_item(menustrip,MENU_BACKDROP))) { if (environment->env->env_flags&ENVF_BACKDROP) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Main backdrop window? if (type==WINDOW_BACKDROP) { // Show as name if ((item=find_menu_item(menustrip,MENU_LISTER_VIEW_NAME))) { if (GUI->flags&(GUIF_VIEW_ICONS|GUIF_ICON_ACTION)) item->Flags&=~CHECKED; else item->Flags|=CHECKED; } // Show as icon if ((item=find_menu_item(menustrip,MENU_LISTER_VIEW_ICON))) { if (GUI->flags&GUIF_VIEW_ICONS) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Icon action? if ((item=find_menu_item(menustrip,MENU_LISTER_ICON_ACTION))) { if (GUI->flags&GUIF_ICON_ACTION) item->Flags|=CHECKED; else item->Flags&=~CHECKED; } // Show all if ((item=find_menu_item(menustrip,MENU_LISTER_SHOW_ALL))) { item->Flags&=~CHECKED; if (GUI->flags&(GUIF_VIEW_ICONS|GUIF_ICON_ACTION)) { if (GUI->flags&GUIF_SHOW_ALL) item->Flags|=CHECKED; } } } // Go through all menus for (menu=menustrip;menu;menu=menu->NextMenu) { struct MenuItem *item; // Go through items for (item=menu->FirstItem;item;item=item->NextItem) { struct MenuItem *sub; // Check disable menu_check_disable(item,type); // Go through sub items for (sub=item->SubItem;sub;sub=sub->NextItem) { // Check disable menu_check_disable(sub,type); } } } // Reset menu strip ResetMenuStrip(window,menustrip); }
// Fix menu ghosting for a lister void lister_fix_menus(Lister *lister,BOOL sel_only) { struct MenuItem *item; struct Menu *menu; BOOL busy=0,icon=0,action=0,sel=0; short a; // Get menu pointer if (!lister_valid_window(lister) || !(menu=lister->window->MenuStrip)) return; // Clear menu strip ClearMenuStrip(lister->window); // Get flags if (lister->flags&LISTERF_LOCK) busy=1; if (lister->flags&LISTERF_VIEW_ICONS) icon=1; if (lister->flags&LISTERF_ICON_ACTION) action=1; // In icon mode? if (icon) { BackdropObject *icon; // Lock icon list lock_listlock(&lister->backdrop_info->objects,FALSE); // Go through list for (icon=(BackdropObject *)lister->backdrop_info->objects.list.lh_Head; icon->node.ln_Succ; icon=(BackdropObject *)icon->node.ln_Succ) { // Something selected? if (icon->state) { // Set flag and break sel=1; break; } } // Unlock icon list unlock_listlock(&lister->backdrop_info->objects); } /* // Text mode else { // Anything selected? if (lister->cur_buffer->buf_SelectedFiles[0]>0 || lister->cur_buffer->buf_SelectedDirs[0]>0) sel=1; } */ // Not just doing things dependant on selected icon? if (!sel_only) { // Show as name (set) if ((item=find_menu_item(menu,MENU_LISTER_VIEW_NAME))) { set_item(item,!icon); } // Show as icon (set) if ((item=find_menu_item(menu,MENU_LISTER_VIEW_ICON))) { set_item(item,icon && !action); } // Icon action (set) if ((item=find_menu_item(menu,MENU_LISTER_ICON_ACTION))) { set_item(item,icon && action); } // Show all if ((item=find_menu_item(menu,MENU_LISTER_SHOW_ALL))) { set_item(item,icon && lister->flags&LISTERF_SHOW_ALL); } // Close (disabled when busy) if ((item=find_menu_item(menu,MENU_LISTER_CLOSE))) { off_item(item,busy); } // Lister states (disabled when busy, or in icon - not action - mode) for (a=MENU_LISTER_SOURCE;a<=MENU_LISTER_OFF;a++) { // Find item if ((item=find_menu_item(menu,a))) { off_item(item,busy || (icon && !action)); } } // Edit (disabled when busy or in icon mode) if ((item=find_menu_item(menu,MENU_EDIT_LISTER))) { off_item(item,busy || icon); } // New drawer (disabled when busy) if ((item=find_menu_item(menu,MENU_ICON_MAKEDIR))) { off_item(item,busy); } // Snapshot (disabled when busy) if ((item=find_menu_item(menu,MENU_ICON_SNAPSHOT))) { off_item(item,busy); } // Select all (disabled when busy) if ((item=find_menu_item(menu,MENU_ICON_SELECT_ALL))) { off_item(item,busy); } // Clean up (disabled when busy or not in icon mode) if ((item=find_menu_item(menu,MENU_ICON_CLEANUP))) { off_item(item,busy || !icon); } // Open parent (disabled when there's no parent) if ((item=find_menu_item(menu,MENU_OPEN_PARENT))) { BOOL dis=0; // Does path end in a colon? if (lister->cur_buffer->buf_Path[strlen(lister->cur_buffer->buf_Path)-1]==':') dis=1; // Do disable off_item(item,dis); } } // Open icon (disabled when busy or nothing selected) if ((item=find_menu_item(menu,MENU_ICON_OPEN))) { off_item(item,busy || !sel); } // Information (disabled when busy or nothing selected) if ((item=find_menu_item(menu,MENU_ICON_INFO))) { off_item(item,busy || !sel); } // Snapshot icon (disabled when nothing selected) if ((item=find_menu_item(menu,MENU_ICON_SNAPSHOT_ICON))) { off_item(item,!sel); } // Unsnapshot (disabled when busy or nothing selected) if ((item=find_menu_item(menu,MENU_ICON_UNSNAPSHOT))) { off_item(item,busy || !sel); } // Leave out (disabled when busy or nothing selected in icon mode) if ((item=find_menu_item(menu,MENU_ICON_LEAVE_OUT))) { off_item(item,busy || (!sel && icon)); } // Rename (disabled when busy or nothing selected in icon mode) if ((item=find_menu_item(menu,MENU_ICON_RENAME))) { off_item(item,busy || (!sel && icon)); } // Delete (disabled when busy or nothing selected in icon mode) if ((item=find_menu_item(menu,MENU_ICON_DELETE))) { off_item(item,busy || (!sel && icon)); } // Reset menu strip ResetMenuStrip(lister->window,menu); }