pascal ComponentResult VP8_Encoder_DITLItem(VP8EncoderGlobals storage, DialogRef d, short itemOffset, short itemNum) { ControlRef onePassControlRef; ControlRef twoPassControlRef; GetDialogItemAsControl(d, itemOffset + kItemOnePass, &onePassControlRef); GetDialogItemAsControl(d, itemOffset + kItemTwoPass, &twoPassControlRef); switch (itemNum - itemOffset) { case kItemOnePass: SetControl32BitValue(onePassControlRef, 1); SetControl32BitValue(twoPassControlRef, 0); break; case kItemTwoPass: SetControl32BitValue(onePassControlRef, 0); SetControl32BitValue(twoPassControlRef, 1); break; case kItemAdvanced: runAdvancedWindow(storage); break; } return noErr; }
// --------------------------------------------------------------------------- // // ----------- void bToolShape::edit_init(WindowRef wd){ ControlRef c; ControlID cid={kShapeEditSign,kShapeCenterID}; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_ctr); cid.id=kShapeOpenFicheID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_opn); cid.id=kShapeCMMeasID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_cm); }
void tool_wind_fix_enable(void) { int n,nsel,type,index,seg_type,group_idx; bool has_fc_seg; // add-sub-tesselate vertex buttons has_fc_seg=FALSE; nsel=select_count(); for (n=0;n!=nsel;n++) { select_get(0,&type,&index); if (type==segment_piece) { seg_type=map.segments[index].type; if ((seg_type==sg_floor) || (seg_type==sg_ceiling)) { has_fc_seg=TRUE; break; } } } if (!has_fc_seg) { HiliteControl(tool_ctrl[16],255); HiliteControl(tool_ctrl[17],255); HiliteControl(tool_ctrl[18],255); } else { HiliteControl(tool_ctrl[16],0); HiliteControl(tool_ctrl[17],0); HiliteControl(tool_ctrl[18],0); } // group combo group_idx=-1; if (select_count()==1) { select_get(0,&type,&index); if ((type==segment_piece) || (type==primitive_piece)) group_idx=map.segments[index].group_idx; } if (group_idx==-1) { SetControl32BitValue(group_combo,1); } else { SetControl32BitValue(group_combo,(3+group_idx)); } }
static pascal OSStatus AspectRatioTextEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; HIViewRef ctl, slider; HIViewID cid; float w, h, v; int iw, ih; err = GetEventParameter(inEvent, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &ctl); if (err == noErr) { cid.signature = 'grap'; cid.id = iNibGAspectRatio; HIViewFindByID(HIViewGetSuperview(ctl), cid, &slider); GetGameDisplay(&iw, &ih); w = (float) iw; h = (float) ih; v = (float) SNES_WIDTH / (float) SNES_HEIGHT * h; macAspectRatio = (int) (((4.0f / 3.0f) * h - v) / (w - v) * 10000.0f); SetControl32BitValue(slider, macAspectRatio); result = noErr; } return (result); }
static pascal OSStatus InputRateTextEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData) { OSStatus err, result = eventNotHandledErr; HIViewRef ctl, slider; HIViewID cid; SInt32 value; char num[10]; err = GetEventParameter(inEvent, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &ctl); if (err == noErr) { cid.signature = 'snd_'; cid.id = iNibSInputRate; HIViewFindByID(HIViewGetSuperview(ctl), cid, &slider); value = GetControl32BitValue(slider); value /= 50; value *= 50; if (value > 33000) value = 33000; if (value < 31000) value = 31000; SetControl32BitValue(slider, value); sprintf(num, "%ld", value); SetEditTextCStr(ctl, num, true); result = noErr; } return (result); }
static pascal void LittleArrowsActionProc (HIViewRef arrows, HIViewPartCode partCode) { HIViewRef ctl; HIViewID cid = { 'msc2', iNibMTurboSkipText }; char num[8]; if (partCode == kControlUpButtonPart) SetControl32BitValue(arrows, GetControl32BitValue(arrows) + 1); else if (partCode == kControlDownButtonPart) SetControl32BitValue(arrows, GetControl32BitValue(arrows) - 1); HIViewFindByID(HIViewGetSuperview(arrows), cid, &ctl); sprintf(num, "%ld", GetControl32BitValue(arrows)); SetStaticTextCStr(ctl, num, true); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // kChangeDiskStreaming::HandlePropertyChange // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void AUDiskStreamingCheckbox::HandlePropertyChange(UInt32 streaming) { // only set the control value if it is different from the current value UInt32 value = GetControl32BitValue(mControl); if (streaming != value) SetControl32BitValue(mControl, streaming); }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // AURenderQualityPopup::HandlePropertyChange // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void AURenderQualityPopup::HandlePropertyChange(UInt32 quality) { int item; switch (quality) { case kRenderQuality_Max: item = 1; break; case kRenderQuality_High: item = 2; break; case kRenderQuality_Medium: item = 3; break; case kRenderQuality_Low: item = 4; break; case kRenderQuality_Min: item = 5; break; } // only set the control value if it is different from the current value UInt32 value = GetControl32BitValue(mControl); if (item != (int)value) SetControl32BitValue(mControl, item); }
// --------------------------------------------------------------------------- // // ----------- void bToolJustification::edit_init(WindowRef wd){ ControlRef c; ControlID cid={kJustificationEditSign,kJustificationButtonsID}; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_jmd); }
void wxSlider::SetValue(int value) { wxString valuestring ; valuestring.Printf( wxT("%d") , value ) ; if ( m_macValueStatic ) m_macValueStatic->SetLabel( valuestring ) ; SetControl32BitValue( (ControlHandle) m_macControl , value ) ; }
void tool_wind_fill_group_combo(void) { int n,group_idx; char str[256]; CFStringRef cf_str; HMHelpContentRec tag; // old settings group_idx=GetControl32BitValue(group_combo); // delete old control and menu DisposeControl(group_combo); DeleteMenu(160); DisposeMenu(group_menu); // recreate the menu CreateNewMenu(group_combo_menu_id,0,&group_menu); cf_str=CFStringCreateWithCString(kCFAllocatorDefault,"No Group",kCFStringEncodingMacRoman); AppendMenuItemTextWithCFString(group_menu,cf_str,0,FOUR_CHAR_CODE('gp01'),NULL); CFRelease(cf_str); AppendMenuItemTextWithCFString(group_menu,NULL,kMenuItemAttrSeparator,0,NULL); for (n=0;n<map.ngroup;n++) { sprintf(str,"%s (%d)",map.groups[n].name,group_count(n)); cf_str=CFStringCreateWithCString(kCFAllocatorDefault,str,kCFStringEncodingMacRoman); AppendMenuItemTextWithCFString(group_menu,cf_str,0,FOUR_CHAR_CODE('gp03'),NULL); CFRelease(cf_str); } InsertMenu(group_menu,kInsertHierarchicalMenu); // recreate the contorl CreatePopupButtonControl(toolwind,&group_box,NULL,group_combo_menu_id,FALSE,0,0,0,&group_combo); Draw1Control(group_combo); // build the help tag.version=kMacHelpVersion; tag.tagSide=kHMDefaultSide; SetRect(&tag.absHotRect,0,0,0,0); tag.content[kHMMinimumContentIndex].contentType=kHMCFStringContent; tag.content[kHMMinimumContentIndex].u.tagCFString=CFStringCreateWithCString(NULL,"Segment Groups",kCFStringEncodingMacRoman); tag.content[kHMMaximumContentIndex].contentType=kHMNoContent; HMSetControlHelpContent(group_combo,&tag); // reset the control SetControl32BitValue(group_combo,group_idx); }
pascal ComponentResult VP8_Encoder_DITLInstall(VP8EncoderGlobals storage, DialogRef d, short itemOffset) { ControlRef cRef; unsigned long onePassRadio = (*storage).settings[1] == 1; unsigned long twoPassRadio = (*storage).settings[1] == 2; GetDialogItemAsControl(d, kItemOnePass + itemOffset, &cRef); SetControl32BitValue(cRef, onePassRadio); GetDialogItemAsControl(d, kItemTwoPass + itemOffset, &cRef); SetControl32BitValue(cRef, twoPassRadio); return noErr; }
void AUCarbonViewControl::SetValueFract(double value) { #if !__LP64__ SInt32 minimum = GetControl32BitMinimum(mControl); SInt32 maximum = GetControl32BitMaximum(mControl); SInt32 cval = SInt32(value * (maximum - minimum) + minimum + 0.5); SetControl32BitValue(mControl, cval); // printf("set: value=%lf, min=%ld, max=%ld, ctl value=%ld\n", value, minimum, maximum, cval); #endif }
static void ScrollBar32BitActionProc(ControlRef theControl, ControlPartCode partCode) { // this is Mac OS 8 or 9 style so the controls can now handle 32 bits value (hence a max of 2147483647) SInt32 oldValue = GetControl32BitValue(theControl); switch (partCode) { case kControlUpButtonPart: SetControl32BitValue(theControl, oldValue - 1); break; case kControlDownButtonPart: SetControl32BitValue(theControl, oldValue + 1); break; case kControlPageUpPart: SetControl32BitValue(theControl, oldValue - 10); break; case kControlPageDownPart: SetControl32BitValue(theControl, oldValue + 10); break; } SInt32 newValue = GetControl32BitValue(theControl); // let's display the value in the edit text control associated with this control theControl = (ControlRef)GetControlReference(theControl); Str255 theStr; NumToString(newValue, theStr); SetControlData(theControl, kControlEntireControl, kControlEditTextTextTag, theStr[0], &theStr[1]); }
/* * update vumeterWindow to reflect actual volume and bandwith information */ void CARBON_GUI::updateVumeters() { ControlID cid= { CARBON_GUI_APP_SIGNATURE , 0 }; ControlRef control; SInt32 val; OSStatus err; /* volume */ cid.id=VUMETER_VOL; err=GetControlByID(vumeterWindow,&cid,&control); if(err!=noErr) msg->error("Can't get vbar control (%d)!!",err); val=GetControl32BitValue(control); if(val!=vumeter) { char vdescr[256]; SetControl32BitValue(control,vumeter); cid.id=VUMETER_VOL_DESCR; err=GetControlByID(vumeterWindow,&cid,&control); if(err!=noErr) msg->error("Can't get volume descr control (%d)!!",err); sprintf(vdescr,"%d",vumeter); err=SetControlData(control,0,kControlStaticTextTextTag,strlen(vdescr),vdescr); } /* bitrate */ cid.id=VUMETER_BITRATE; err=GetControlByID(vumeterWindow,&cid,&control); if(err!=noErr) msg->error("Can't get vbar control (%d)!!",err); val=GetControl32BitValue(control); if(val!=vuband) { char bpsdescr[256]; SetControl32BitValue(control,vuband); cid.id=VUMETER_BITRATE_DESCR; err=GetControlByID(vumeterWindow,&cid,&control); if(err!=noErr) msg->error("Can't get bps descr control (%d)!!",err); if(vuband<1000) sprintf(bpsdescr,"%d B/s",vuband); else if(vuband>1000 && vuband <1000000) sprintf(bpsdescr,"%d KB/s",vuband/1000); else sprintf(bpsdescr,"%d MB/s",vuband/1000000); err=SetControlData(control,0,kControlStaticTextTextTag,strlen(bpsdescr),bpsdescr); } }
void AUVPresets::HandlePropertyChange(AUPreset &preset) { #if !__LP64__ // check to see if the preset is in our menu int numPresets = CFArrayGetCount(mPresets); if (preset.presetNumber < 0) { SetControl32BitValue (mControl, 0); //controls are one-based } else { for (SInt32 i = 0; i < numPresets; ++i) { AUPreset* currPreset = (AUPreset*) CFArrayGetValueAtIndex (mPresets, i); if (preset.presetNumber == currPreset->presetNumber) { SetControl32BitValue (mControl, ++i); //controls are one-based break; } } } if (preset.presetName) CFRelease (preset.presetName); #endif }
// --------------------------------------------------------------------------- // // ----------- void bToolPrintArea::pop_kind_action(WindowRef wd){ ControlRef c; ControlID cid={kPrintAreaSignature,0}; int k; put_area(wd); cid.id=kPrintAreaPopKindID; GetControlByID(wd,&cid,&c); k=GetControl32BitValue(c); switch(k){ case kPrintAreaPopKindMenuGeo: set_as_geo(wd); cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); HideControl(c); break; case kPrintAreaPopKindMenuPix: set_as_pix(wd); cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); HideControl(c); break; case kPrintAreaPopKindMenuCustom: set_as_ppsz(wd); cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); HideControl(c); break; case kPrintAreaPopKindMenuStandard: cid.id=kPrintAreaFrameCustomSizeID; GetControlByID(wd,&cid,&c); HideControl(c); cid.id=kPrintAreaFrameStandardSizeID; GetControlByID(wd,&cid,&c); ShowControl(c); cid.id=kPrintAreaPopSizeID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_pprkind); break; } _sizekind=k; }
void wxSpinButton::MacHandleValueChanged( int inc ) { wxEventType scrollEvent = wxEVT_NULL; int oldValue = m_value ; m_value = oldValue + inc; if (m_value < m_min) { if ( m_windowStyle & wxSP_WRAP ) m_value = m_max; else m_value = m_min; } if (m_value > m_max) { if ( m_windowStyle & wxSP_WRAP ) m_value = m_min; else m_value = m_max; } if ( m_value - oldValue == -1 ) scrollEvent = wxEVT_SCROLL_LINEDOWN ; else if ( m_value - oldValue == 1 ) scrollEvent = wxEVT_SCROLL_LINEUP ; else scrollEvent = wxEVT_SCROLL_THUMBTRACK ; wxSpinEvent event(scrollEvent, m_windowId); event.SetPosition(m_value); event.SetEventObject( this ); if ((GetEventHandler()->ProcessEvent( event )) && !event.IsAllowed() ) { m_value = oldValue ; } SetControl32BitValue( (ControlHandle) m_macControl , m_value ) ; /* always send a thumbtrack event */ if (scrollEvent != wxEVT_SCROLL_THUMBTRACK) { scrollEvent = wxEVT_SCROLL_THUMBTRACK; wxSpinEvent event2( scrollEvent, GetId()); event2.SetPosition( m_value ); event2.SetEventObject( this ); GetEventHandler()->ProcessEvent( event2 ); } }
pascal void TimerProc(EventLoopTimerRef inTimer, void *inUserData) { float ratio=BASS_FX_TempoGetRateRatio(chan); if (!ratio) return; SetControl32BitValue(GetControl(15),(DWORD)BASS_ChannelBytes2Seconds(chan,BASS_ChannelGetPosition(chan,BASS_POS_BYTE))); // update position { // show the approximate position in MM:SS format char c[50]; DWORD totalsec=GetControl32BitMaximum(GetControl(15))/ratio; DWORD posec=GetControl32BitValue(GetControl(15))/ratio; sprintf(c,"Playing position: %02u:%02u / %02u:%02u",posec/60,posec%60,totalsec/60,totalsec%60); SetStaticText(14,c); } }
// Tell a control to update its value & maximum. OSStatus ControlUpdateValues( ControlRef scrollBar, SInt32 value, SInt32 max ) { require( IsValidControlHandle( scrollBar ), BadControl ); SetControl32BitValue( scrollBar, value ); SetControl32BitMaximum( scrollBar, max ); return noErr; BadControl: return paramErr; }
pascal void actionFunctionScroll(ControlRef controlRef,ControlPartCode controlPartCode) { SInt32 scrollDistance, controlValue, oldControlValue, controlMax; if(controlPartCode != kControlNoPart) { if(controlPartCode != kControlIndicatorPart) { switch(controlPartCode) { case kControlUpButtonPart: case kControlDownButtonPart: scrollDistance = 10; break; case kControlPageUpPart: case kControlPageDownPart: scrollDistance = 100; break; default: scrollDistance = 0; break; } if (scrollDistance) { if((controlPartCode == kControlDownButtonPart) || (controlPartCode == kControlPageDownPart)) scrollDistance = -scrollDistance; controlValue = GetControl32BitValue(controlRef); if(((controlValue == GetControl32BitMaximum(controlRef)) && scrollDistance < 0) || ((controlValue == GetControl32BitMinimum(controlRef)) && scrollDistance > 0)) return; oldControlValue = controlValue; controlMax = GetControl32BitMaximum(controlRef); controlValue = oldControlValue - scrollDistance; if(controlValue < 0) controlValue = 0; else if(controlValue > controlMax) controlValue = controlMax; SetControl32BitValue(controlRef,controlValue); } } } }
/***************************************************** * * LittleArrowsControlAction(theControl, partCode) * * Purpose: called to handle the little arrows control increment and decrement. * * Inputs: theControl - the littleArrows control * partCode - part which was clicked * * Returns: none */ static void LittleArrowsControlAction(ControlRef theControl, ControlPartCode partCode) { // Grabbing the increment set up by Interface Builder or CreateLittleArrowsControl. // Defaulting to 1 if not found. SInt32 increment; OSStatus status = GetControlData(theControl, kControlEntireControl, kControlLittleArrowsIncrementValueTag, sizeof(increment), &increment, NULL); if (status != noErr) increment = 1; SInt32 value = GetControl32BitValue(theControl); switch (partCode) { case kControlUpButtonPart: SetControl32BitValue(theControl, value + increment); break; case kControlDownButtonPart: SetControl32BitValue(theControl, value - increment); break; } } // LittleArrowsControlAction
// Resets the state of the controls in a window based on the state of the TextView OSStatus UpdateControlsFromTextViewWindow( WindowRef window ) { OSStatus status; HIViewRef textView; ControlRef control; SInt32 newValue; UInt32 unsignedValue; status = GetTextViewFromWindow(window, textView); require_noerr( status, CantGetTextView ); // Font panel checkbox status = GetControlByID(window, &kFontPanelCheckboxControl, &control); require_noerr( status, CantGetControl ); newValue = TextViewIsFontPanelSupportEnabled(textView) ? kControlCheckBoxCheckedValue : kControlCheckBoxUncheckedValue; SetControl32BitValue(control, newValue); // Spelling checkbox status = GetControlByID(window, &kSpellCheckboxControl, &control); require_noerr( status, CantGetControl ); newValue = TextViewIsSpellingSupportEnabled(textView) ? kControlCheckBoxCheckedValue : kControlCheckBoxUncheckedValue; SetControl32BitValue(control, newValue); // Autoscroll radio button status = GetControlByID(window, &kAutoScrollRadioButtonControl, &control); require_noerr( status, CantGetControl ); status = TextViewGetObjectControlData( textView, kTXNAutoScrollBehaviorTag, kUnsigned, newValue, unsignedValue ); require_noerr( status, CantGetValue ); newValue += 1; // Autoscroll constants are zero-based, radio button state is one-based SetControl32BitValue(control, newValue); CantGetValue: CantGetControl: CantGetTextView: return status; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // AURenderQualityPopup::HandleEvent // //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bool AURenderQualityPopup::HandleEvent(EventRef event) { UInt32 eventClass = GetEventClass(event); // the class of the event HICommand command; bool result = false; GetEventParameter (event, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &command); switch(eventClass) { case kEventClassCommand: if (command.commandID == kChangeRenderQualityCmd) SetControl32BitValue(mControl, command.menu.menuItemIndex); HandleControlChange(); break; } return result; }
bool setPlayerWinVolSlider(int iPosition) { ControlRef cRef; ControlID cID; OSStatus iErr; cID.signature = FOUR_CHAR_CODE('volu'); cID.id = 6; if (noErr != (iErr = GetControlByID(g_refPlayerWin, &cID, &cRef))) { fprintf(stderr, "setPlayerWinVolSlider() - GetControlByID() failed, returning %lu!\n", (unsigned long) iErr); return false; } SetControl32BitValue(cRef, (UInt32) iPosition); return true; }
static void RunDialogTheMacOS8or9Way(DialogRef theDialog) { SInt16 itemHit; ControlRef theControl; ControlRef theTextControl; BringToFront(GetDialogWindow(theDialog)); do { ModalDialog(MyMacOS8or9DialogFilter, &itemHit); switch (itemHit) { case 2: { // we still enable or disable the user pane depending on whether the box is checked or not GetDialogItemAsControl(theDialog, itemHit, &theControl); SInt32 enable = GetControl32BitValue(theControl); SetControl32BitValue(theControl, 1 - enable); GetDialogItemAsControl(theDialog, 13, &theControl); if (!enable) ActivateControl(theControl); else DeactivateControl(theControl); } break; case 9: case 10: { // we got a click in an edit text control, if didn't have the focus, let's set it GetDialogItemAsControl(theDialog, itemHit, &theTextControl); ControlRef currentFocus; GetKeyboardFocus(GetDialogWindow(theDialog), ¤tFocus); if (currentFocus != theTextControl) SetKeyboardFocus(GetDialogWindow(theDialog), theTextControl, kControlFocusNextPart); } break; } } while (!(itemHit == ok)); DisposeDialog(theDialog); }
static void AutofireReadAllSettings (int player, HIViewRef parent) { HIViewRef ctl; HIViewID cid; char num[10]; AutofireReadSetting(player * 1, autofireRec[player - 1].buttonMask, parent); AutofireReadSetting(player * 11, autofireRec[player - 1].toggleMask, parent); AutofireReadSetting(player * 111, autofireRec[player - 1].tcMask, parent); AutofireReadSetting(player * 1111, autofireRec[player - 1].invertMask, parent); cid.id = player; cid.signature = 'Num_'; HIViewFindByID(parent, cid, &ctl); sprintf(num, "%ld", autofireRec[player - 1].frequency); SetStaticTextCStr(ctl, num, false); cid.signature = 'Slid'; HIViewFindByID(parent, cid, &ctl); SetControl32BitValue(ctl, autofireRec[player - 1].frequency); }
void wxScrollBar::SetScrollbar(int position, int thumbSize, int range, int pageSize, bool refresh) { m_pageSize = pageSize; m_viewSize = thumbSize; m_objectSize = range; int range1 = wxMax((m_objectSize - m_viewSize), 0) ; SetControl32BitMaximum( (ControlHandle) m_macControl , range1 ) ; SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ; SetControl32BitValue( (ControlHandle) m_macControl , position ) ; if ( UMAGetAppearanceVersion() >= 0x0110 ) { if ( SetControlViewSize != (void*) kUnresolvedCFragSymbolAddress ) { SetControlViewSize( (ControlHandle) m_macControl , m_viewSize ) ; } } if ( refresh ) MacRedrawControl() ; }
// --------------------------------------------------------------------------- // // ----------- void bToolGeomWithJoin::edit_init(WindowRef wd){ ControlRef c; ControlID cid; bGenericType* tp=NULL; char val[32]; val[1]=0; /* A GERER PAR UN MAP EVENT*/ for(int i=_tp_use.count()+1;i<=_gapp->typesMgr()->count();i++){ tp=NULL; _tp_use.add(&tp); } for(int i=_tp_use.count();i>_gapp->typesMgr()->count();i--){ _tp_use.rmv(i); } /* A GERER PAR UN MAP EVENT*/ cid.signature=kToolGeomWithJoinSign; cid.id=kToolGeomWithJoinUseNeaID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_use_nea); cid.id=kToolGeomWithJoinKeyNeaID; GetControlByID(wd,&cid,&c); val[0]=_k_nea; SetTextControlValue(c,val); cid.id=kToolGeomWithJoinUseDirID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_use_dir); cid.id=kToolGeomWithJoinKeyDirID; GetControlByID(wd,&cid,&c); val[0]=_k_dir; SetTextControlValue(c,val); cid.id=kToolGeomWithJoinUseAngID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_use_ang); cid.id=kToolGeomWithJoinKeyAngID; GetControlByID(wd,&cid,&c); val[0]=_k_ang; SetTextControlValue(c,val); cid.id=kToolGeomWithJoinUseEndID; GetControlByID(wd,&cid,&c); SetControl32BitValue(c,_use_end); cid.id=kToolGeomWithJoinKeyEndID; GetControlByID(wd,&cid,&c); val[0]=_k_end; SetTextControlValue(c,val); if(!_jnea){ cid.id=kToolGeomWithJoinUseNeaID; GetControlByID(wd,&cid,&c); DisableControl(c); cid.id=kToolGeomWithJoinKeyNeaID; GetControlByID(wd,&cid,&c); DisableControl(c); } if(!_jdir){ cid.id=kToolGeomWithJoinUseDirID; GetControlByID(wd,&cid,&c); DisableControl(c); cid.id=kToolGeomWithJoinKeyDirID; GetControlByID(wd,&cid,&c); DisableControl(c); } if(!_jang){ cid.id=kToolGeomWithJoinUseAngID; GetControlByID(wd,&cid,&c); DisableControl(c); cid.id=kToolGeomWithJoinKeyAngID; GetControlByID(wd,&cid,&c); DisableControl(c); } if(!_jend){ cid.id=kToolGeomWithJoinUseEndID; GetControlByID(wd,&cid,&c); DisableControl(c); cid.id=kToolGeomWithJoinKeyEndID; GetControlByID(wd,&cid,&c); DisableControl(c); } cid.id=kToolGeomWithJoinTypesID; GetControlByID(wd,&cid,&c); DataBrowserInit(c,dtb_proc,NULL,(long)this); populate_types(wd); SetDataBrowserPropertyFlags(c,kToolGeomWithJoinTypesCheckProperty,kDataBrowserPropertyIsEditable); }
void MusicBoxDialog(void) { OSStatus err; IBNibRef nibRef; if (!cartOpen) return; err = CreateNibReference(kMacS9XCFString, &nibRef); if (err == noErr) { CFURLRef iconURL; FSRef iconFSRef; IconRef actIcon; WindowRef tWindowRef; actIcon = nil; if (musicboxmode == kMBXSoundEmulation) iconURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("musicbox_ledoff"), CFSTR("icns"), nil); else iconURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("musicbox_ledon" ), CFSTR("icns"), nil); if (iconURL) { if (CFURLGetFSRef(iconURL, &iconFSRef)) err = RegisterIconRefFromFSRef('~9X~', 'micn', &iconFSRef, &actIcon); CFRelease(iconURL); } err = CreateWindowFromNib(nibRef, CFSTR("MusicBox"), &tWindowRef); if (err == noErr) { EventHandlerRef mboxRef, paneRef; EventHandlerUPP mboxUPP, paneUPP; EventLoopTimerRef timeRef; EventLoopTimerUPP timeUPP; EventTypeSpec mboxEvents[] = { { kEventClassCommand, kEventCommandProcess }, { kEventClassCommand, kEventCommandUpdateStatus } }, paneEvents[] = { { kEventClassControl, kEventControlDraw } }; CFStringRef sref; CGDataProviderRef prov; CGImageRef ipng; CFURLRef iurl; HIViewRef ctl, root, paneView, imageView, contentView; HIViewID cid; HIRect bounds; Rect windowRect, barRect; char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; mboxPause = false; mbxFinished = false; showIndicator = false; so.stereo_switch = ~0; for (int i = 0; i < MAC_MAX_PLAYERS; i++) controlPad[i] = 0; switch (drawingMethod) { case kDrawingOpenGL: Settings.OpenGLEnable = true; break; case kDrawingDirect: case kDrawingBlitGL: Settings.OpenGLEnable = false; } // 107's enhanced SPC player root = HIViewGetRoot(tWindowRef); cid.id = 0; if (musicboxmode == kMBXSoundEmulation) { cid.signature = 'HEAD'; HIViewFindByID(root, cid, &ctl); EnableControl(ctl); StoredAPU = new SAPU; StoredAPURegisters = new SAPURegisters; StoredSoundData = new SSoundData; StoredIAPURAM = new uint8 [0x10000]; SPCPlayFreeze(); } else MusicBoxForceFreeze(); cid.signature = 'Kart'; HIViewFindByID(root, cid, &ctl); SetStaticTextTrunc(ctl, truncEnd, false); _splitpath(Memory.ROMFilename, drive, dir, fname, ext); sref = CFStringCreateWithCString(kCFAllocatorDefault, fname, MAC_PATH_ENCODING); if (sref) { SetStaticTextCFString(ctl, sref, false); CFRelease(sref); } ipng = nil; iurl = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("musicbox_indicator"), CFSTR("png"), nil); if (iurl) { prov = CGDataProviderCreateWithURL(iurl); if (prov) { ipng = CGImageCreateWithPNGDataProvider(prov, nil, false, kCGRenderingIntentDefault); CGDataProviderRelease(prov); } CFRelease(iurl); } imageView = nil; if (ipng) { HIViewFindByID(root, kHIViewWindowContentID, &contentView); err = HIImageViewCreate(ipng, &imageView); if (err == noErr) { bounds = CGRectMake(30, 64, CGImageGetWidth(ipng), CGImageGetHeight(ipng)); HIViewSetFrame(imageView, &bounds); HIImageViewSetOpaque(imageView, false); HIViewSetVisible(imageView, true); HIViewAddSubview(contentView, imageView); cid.signature = 'iMaG'; SetControlID(imageView, &cid); } CGImageRelease(ipng); } cid.signature = 'Pane'; HIViewFindByID(root, cid, &paneView); HIViewGetBounds(paneView, &bounds); mbxViewWidth = bounds.size.width; mbxViewHeight = bounds.size.height; mbxMarginY = (mbxViewHeight - mbxBarHeight) / 2.0; mbxMarginX = (mbxViewWidth - ((mbxBarWidth * 8.0 + mbxBarSpace * 7.0) * 2.0 + mbxLRSpace)) / 2.0; if (imageView) { HIViewSetZOrder(imageView, kHIViewZOrderBelow, paneView); HIViewAddSubview(imageView, paneView); } cid.signature = 'Tr_i'; HIViewFindByID(root, cid, &ctl); HIViewGetFrame(ctl, &bounds); GetWindowBounds(tWindowRef, kWindowTitleBarRgn, &barRect); mbxClosedHeight = (short) (bounds.origin.y + bounds.size.height + 7.0) + (barRect.bottom - barRect.top); GetWindowBounds(tWindowRef, kWindowStructureRgn, &windowRect); mbxOpenedHeight = windowRect.bottom - windowRect.top; windowRect.bottom = windowRect.top + mbxClosedHeight; SetWindowBounds(tWindowRef, kWindowStructureRgn, &windowRect); paneUPP = NewEventHandlerUPP(IndicatorEventHandler); err = InstallControlEventHandler(paneView, paneUPP, GetEventTypeCount(paneEvents), paneEvents, (void *) paneView, &paneRef); mboxUPP = NewEventHandlerUPP(MusicBoxEventHandler); err = InstallWindowEventHandler(tWindowRef, mboxUPP, GetEventTypeCount(mboxEvents), mboxEvents, (void *) tWindowRef, &mboxRef); timeUPP = NewEventLoopTimerUPP(MusicBoxTimerHandler); err = InstallEventLoopTimer(GetCurrentEventLoop(), kEventDurationNoWait, kEventDurationSecond * 2.0 / (double) Memory.ROMFramesPerSecond, timeUPP, (void *) paneView, &timeRef); MusicBoxInitIndicator(); stopNow = false; MacStartSound(); pthread_create(&mbxThread, nil, SoundTask, nil); MoveWindowPosition(tWindowRef, kWindowMusicBox, true); GetWindowBounds(tWindowRef, kWindowStructureRgn, &windowRect); if (windowRect.bottom - windowRect.top > mbxClosedHeight) { showIndicator = true; SetControl32BitValue(ctl, 1); // Tr_i } ShowWindow(tWindowRef); err = RunAppModalLoopForWindow(tWindowRef); HideWindow(tWindowRef); SaveWindowPosition(tWindowRef, kWindowMusicBox); stopNow = true; pthread_join(mbxThread, nil); MacStopSound(); err = RemoveEventLoopTimer(timeRef); DisposeEventLoopTimerUPP(timeUPP); err = RemoveEventHandler(mboxRef); DisposeEventHandlerUPP(mboxUPP); err = RemoveEventHandler(paneRef); DisposeEventHandlerUPP(paneUPP); ReleaseWindow(tWindowRef); so.stereo_switch = ~0; mbxFinished = true; if (musicboxmode == kMBXSoundEmulation) { SPCPlayDefrost(); delete StoredAPU; delete StoredAPURegisters; delete StoredSoundData; delete [] StoredIAPURAM; } else MusicBoxForceDefrost(); Settings.OpenGLEnable = false; } if (actIcon) err = UnregisterIconRef('~9X~', 'micn'); DisposeNibReference(nibRef); } }