示例#1
0
RESULT
LayerManager::AddToLayer( IN HLayer hLayer, IN HLayer hChildLayer )
{
    RESULT rval = S_OK;

    Layer* pLayer       = GetObjectPointer( hLayer );
    Layer* pChildLayer  = GetObjectPointer( hChildLayer );
    if (!pLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::AddToLayer( 0x%x, 0x%x ): invalid destination Layer", (UINT32)hLayer, (UINT32)hChildLayer);
        rval = E_INVALID_ARG;
        goto Exit;
    }
    
    if (!pChildLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::AddToLayer( 0x%x, 0x%x ): invalid child Layer", (UINT32)hLayer, (UINT32)hChildLayer);
        rval = E_INVALID_ARG;
        goto Exit;
    }
    
    CHR(pChildLayer->SetParentLayer( hLayer ));
    CHR(pLayer->AddLayer( hChildLayer ));
    
Exit:
    return rval;
}
示例#2
0
void CAliasTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src,
                            ESerialRecursionMode how) const
{
#if 1
    GetPointedType()->Assign(dst, src, how);
#else
    TConstObjectPtr data = GetObjectPointer(src);
    TTypeInfo type = GetRealDataTypeInfo(data);
    TObjectPtr object = GetObjectPointer(dst);
    type->Assign(object, data, how);
#endif
}
示例#3
0
RESULT
LayerManager::SetEffect( IN HLayer hLayer, HEffect hEffect )
{
    RESULT rval = S_OK;
    
    Layer* pLayer = GetObjectPointer( hLayer );
    if (pLayer)
    {
#ifdef DEBUG    
        string name;
        EffectMan.GetName( hEffect, &name );
        DEBUGMSG(ZONE_LAYER, "LayerManager::SetEffect( %s, %s )", 
                 pLayer->GetName().c_str(), name.c_str());
#endif        
        pLayer->SetEffect( hEffect );
    }
    else 
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::SetEffect( 0x%x, 0x%x ): object not found", (UINT32)hLayer, (UINT32)hEffect);
        rval = E_INVALID_ARG;
    }

Exit:
    return rval;
}
示例#4
0
/***********************************************************************
 *
 * FUNCTION:    RepeatDescRectHandler
 *
 * DESCRIPTION: This routine is the event handler for rectangle gadget
 *		surrounding the repeat description in the "Repeat
 *              Dialog Box".
 *
 *		Instead of drawing a static rectangle the size of the
 *		gadget bounds, I have sized the gadget to be the full area
 *		of the repeat dialog the description field will still fit
 *		should the field have to be slightly resized for any reason.
 *		The bounding rect drawn is calculated from the field's
 *		bounding rect.
 *
 * PARAMETERS:  gadgetP	- pointer to the gadget
 *		cmd	- the event type to be handled
 *		paramp	- any additional data that is passed to the gadget
 *
 * RETURNED:    true if the event was handled and should not be passed
 *              to a higher level handler.
 *
 ***********************************************************************/
static Boolean RepeatDescRectHandler(FormGadgetTypeInCallback *gadgetP, UInt16 cmd, void *paramP) {
  FieldType* fld = NULL;
  RectangleType	r;
  Boolean handled = false;

  switch(cmd) {
  case formGadgetEraseCmd:
  case formGadgetDrawCmd:

    /* Get the repeat description field and calculate a bounding box */
    fld = GetObjectPointer(FrmGetFormPtr(RepeatForm), RepeatDescField);
    FldGetBounds (fld, &r);
    RctInsetRectangle (&r, -4);
    
    if (cmd == formGadgetDrawCmd)
      WinDrawRectangleFrame(simpleFrame, &r);
    else
      WinEraseRectangle(&r, 0);

    handled = true;
    break;

  case formGadgetHandleEventCmd:
    /* do nothing */
    break;

  default:
    break;
  }
  
  return handled;
}
示例#5
0
/***********************************************************************
 *
 * FUNCTION:    RepeatChangeRepeatOn
 *
 * DESCRIPTION: This routine is called when one of the weekly "repeat on"
 *              push button is pushed.  This routine checks
 *              if all the buttons has been turned off,  if so the day
 *              of the week of the appointment's start date is turn on.
 *
 * PARAMETERS:  event - pointer to and event
 *
 * RETURNED:    nothing
 *
 ***********************************************************************/
static void RepeatChangeRepeatOn(EventType* event) {
  UInt16 id = 0;
  UInt16 dayOfWeek = 0;
  FormType* frm = FrmGetFormPtr(RepeatForm);
  Boolean on = false;
  UInt16 i = 0;
  const UInt16 idx = FrmGetObjectIndex(frm, RepeatDayOfWeek1PushButton);

  /* Check if any of the buttons are on. */
  for (; i < daysInWeek; i++) {
    if (FrmGetControlValue(frm, idx + i) != 0) {
      on = true;
      break;
    }
  }

  /* If all the buttons are off, turn on the start date's button. */
  if (!on) {
    dayOfWeek = DayOfWeek (d.frm_date.month,
			   d.frm_date.day,
			   d.frm_date.year /*+ firstYear*/); /* frm_date is DateTimeType */
    dayOfWeek = (dayOfWeek - d.repeat_start_of_week + daysInWeek) % daysInWeek;
    
    id = RepeatDayOfWeek1PushButton + dayOfWeek;
    CtlSetValue(GetObjectPointer(frm, id), true);
  }

  /* Update the display of the repeat description. */
  RepeatDrawDescription(frm);
}
示例#6
0
/***********************************************************************
 *
 * FUNCTION:    ThumbnailViewInit
 *
 * DESCRIPTION: This routine initializes the "Thumbnail View".
 *
 * PARAMETERS:  event  - a pointer to an EventType structure
 *
 * RETURNED:    nothing.
 *
 ***********************************************************************/
static void ThumbnailViewInit (FormPtr frm) {
  ControlPtr ctl;
  UInt16 i;
  Err err;
  DynamicButtonType* btn;

  for (i = Thumb1; i <= Thumb30; ++i) {
    btn = DynBtnInitGadget(i, rectangleFrame, true, true, false, d.sonyClie, 
               d.sonyHRRefNum, false, dynBtnGraphical, 0, &err, frm,
               ThumbnailGadgetEvent);
    if (err != errNone) abort();
  }

  ThumbnailViewLoadRecords(frm);

  /* Set the label of the category trigger. */
  ctl = GetObjectPointer(frm, CategoryPop);
  CategoryGetName(d.dbR, p.category, d.categoryName);
  CategorySetTriggerLabel(ctl, d.categoryName);

  /* Update scroll bar variables */
  ThumbnailViewUpdateScrollers(frm);

  /* Initialize grid coordinates */
  MapIndexToCoordinates(&p.dbI, &d.thumbnailX, &d.thumbnailY);
}
示例#7
0
RESULT 
BehaviorManager::PushBehaviorOnToGameObject( IN HBehavior hBehavior, IN HGameObject hGameObject, IN StateMachineQueue queue )
{
    RESULT rval           = S_OK;
    string gameObjectName = "";
    
    Behavior* pBehavior = GetObjectPointer( hBehavior );
    if (pBehavior)
    {
        GOMan.GetName( hGameObject, &gameObjectName );
        
        RETAILMSG(ZONE_STATEMACHINE | ZONE_VERBOSE, "BehaviorManager::PushBehaviorOnToGameObject( \"%s\", \"%s\", queue: %d )", 
            pBehavior->GetName().c_str(),
            gameObjectName.c_str(),
            queue);

        CHR(pBehavior->BindToGameObject( hGameObject, queue ));
    }
    else 
    {
        rval = E_FAIL;
    }

Exit:
    if (FAILED(rval))
    {
        RETAILMSG(ZONE_ERROR, "ERROR: BehaviorManager::PushBehaviorOnToGameObject( \"%s\", \"%s\" ): Behavior or GO not found", 
            pBehavior ? pBehavior->GetName().c_str() : "NULL",
            gameObjectName.c_str());
    }
    
    return rval;
}
示例#8
0
RESULT
ParticleManager::SetEffect( IN HParticleEmitter hParticleEmitter, HEffect hEffect )
{
    RESULT rval = S_OK;
    
    ParticleEmitter* pParticleEmitter = GetObjectPointer( hParticleEmitter );
    if (pParticleEmitter)
    {
#ifdef DEBUG    
        string name;
        EffectMan.GetName( hEffect, &name );
        DEBUGMSG(ZONE_PARTICLES, "ParticleManager::SetEffect( %s, %s )", 
                 pParticleEmitter->GetName().c_str(), name.c_str());
#endif        
        pParticleEmitter->SetEffect( hEffect );
    }
    else 
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::SetEffect( 0x%x, 0x%x ): object not found", (UINT32)hParticleEmitter, (UINT32)hEffect);
        rval = E_INVALID_ARG;
    }

Exit:
    return rval;
}
示例#9
0
/*
** ToggleXferBar - disable or enable the objects in the transfer bar
*/
static void ToggleXferBar(FormType* frm, Boolean toggle_on) {
  ToggleObject(frm, XferDoneButton, toggle_on);
  ToggleObject(frm, XferDetailsButton, toggle_on);
  ToggleObject(frm, XferField, toggle_on);

  /* Set the insertion point in the field if toggling on */
  if(!toggle_on)
    FldFreeMemory(GetObjectPointer(frm, XferField));
}
示例#10
0
bool CPointerTypeInfo::Equals(TConstObjectPtr object1, TConstObjectPtr object2,
                              ESerialRecursionMode how) const
{
    TConstObjectPtr data1 = GetObjectPointer(object1);
    TConstObjectPtr data2 = GetObjectPointer(object2);
    if ( how != eRecursive ) {
        return how == eShallow ? (data1 == data2) : (data1 == 0 || data2 == 0);
    }
    else if ( data1 == 0 ) {
        return data2 == 0;
    }
    else {
        if ( data2 == 0 )
            return false;
        TTypeInfo type1 = GetRealDataTypeInfo(data1);
        TTypeInfo type2 = GetRealDataTypeInfo(data2);
        return type1 == type2 && type1->Equals(data1, data2, how);
    }
}
示例#11
0
RESULT
ParticleManager::Pause( IN HParticleEmitter handle )
{
    RESULT rval = S_OK;
    
    CHR(Pause(GetObjectPointer( handle )));

Exit:
    return rval;
}
示例#12
0
bool
ParticleManager::IsPaused( IN HParticleEmitter handle )
{
    ParticleEmitter*     pParticleEmitter;
    
    pParticleEmitter = GetObjectPointer( handle );
    if (pParticleEmitter)
    {
        return pParticleEmitter->IsPaused();
    }
    
    return false;
}
示例#13
0
/***********************************************************************
 *
 * FUNCTION:    RepeatSetDateTrigger
 *
 * DESCRIPTION: This routine sets the label of the trigger that displays
 *              the end date of a repeating appointment.
 *
 * PARAMETERS:  endDate	- date or -1 if no end date
 *
 * RETURNED:    nothing
 *
 * NOTES:
 *      This routine assumes that the memory allocated for the label of
 *      the due date trigger is large enough to hold the lagest posible
 *      label. This label's memory is reserved by initializing the label
 *      in the resource file.
 *
 ***********************************************************************/
static void RepeatSetDateTrigger (DateType endDate) {
  FormType* frm = FrmGetFormPtr(RepeatForm);
  ListType* lst = GetObjectPointer(frm, RepeatEndOnList);
  ControlType* ctl = GetObjectPointer(frm, RepeatEndOnTrigger);
  Char* label = (Char*)CtlGetLabel(ctl); /* OK to cast; we call CtlSetLabel */

  ASSERT(lst);
  ASSERT(ctl);
  ASSERT(label);

  if (DateToInt(endDate) == apptNoEndDate) {
    StrCopy(label, LstGetSelectionText(lst, repeatNoEndDateItem));
    LstSetSelection(lst, noEndDateItem);
  } else {
    /* Format the end date into a string. */
    DateToDOWDMFormat(endDate.month, endDate.day, endDate.year + firstYear,
		      PrefGetPreference(prefDateFormat), label);
    
    LstSetSelection(lst, repeatChooseDateItem);
  }
  
  CtlSetLabel(ctl, label);
}
示例#14
0
bool
LayerManager::GetShadow( IN HLayer hLayer )
{
    bool rval = false;

    Layer* pLayer = GetObjectPointer(hLayer);
    if (!pLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::IsShadowEnabled( 0x%x ): invalid Layer", (UINT32)hLayer);
        return rval;
    }
    
    return pLayer->GetShadow();
}
示例#15
0
AABB
LayerManager::GetBounds( IN HLayer hLayer )
{
    AABB rval;

    Layer* pLayer = GetObjectPointer(hLayer);
    if (!pLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::GetBounds( 0x%x ): invalid Layer", (UINT32)hLayer);
        return rval;
    }

    return pLayer->GetBounds();
}
示例#16
0
vec3
ParticleManager::GetRotation( IN HParticleEmitter hParticleEmitter )
{
    vec3 rval(0,0,0);

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::GetRotation( 0x%x ): invalid ParticleEmitter", (UINT32)hParticleEmitter);
        return rval;
    }

    return pParticleEmitter->GetRotation();
}
示例#17
0
float
LayerManager::GetOpacity( IN HLayer hLayer )
{
    float rval = 0.0f;

    Layer* pLayer = GetObjectPointer(hLayer);
    if (!pLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::GetOpacity( 0x%x ): invalid Layer", (UINT32)hLayer);
        return rval;
    }

    return pLayer->GetOpacity();
}
示例#18
0
vec3
LayerManager::GetRotation( IN HLayer hLayer )
{
    vec3 rval(0,0,0);

    Layer* pLayer = GetObjectPointer(hLayer);
    if (!pLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::GetRotation( 0x%x ): invalid Layer", (UINT32)hLayer);
        return rval;
    }

    return pLayer->GetRotation();
}
示例#19
0
bool
ParticleManager::GetShadow( IN HParticleEmitter hParticleEmitter )
{
    bool rval = false;

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::IsShadowEnabled( 0x%x ): invalid ParticleEmitter", (UINT32)hParticleEmitter);
        return rval;
    }
    
    return pParticleEmitter->GetShadow();
}
示例#20
0
AABB
ParticleManager::GetBounds( IN HParticleEmitter hParticleEmitter )
{
    AABB rval;

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::GetBounds( 0x%x ): invalid ParticleEmitter", (UINT32)hParticleEmitter);
        return rval;
    }

    return pParticleEmitter->GetBounds();
}
示例#21
0
float
ParticleManager::GetOpacity( IN HParticleEmitter hParticleEmitter )
{
    float rval = 0.0f;

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::GetOpacity( 0x%x ): invalid ParticleEmitter", (UINT32)hParticleEmitter);
        return rval;
    }

    return pParticleEmitter->GetOpacity();
}
示例#22
0
HEffect
LayerManager::GetEffect( IN HLayer hLayer )
{
    HEffect rval;

    Layer* pLayer = GetObjectPointer(hLayer);
    if (!pLayer)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: LayerManager::GetEffect( 0x%x ): invalid Layer", (UINT32)hLayer);
        return rval;
    }

    return pLayer->GetEffect();
}
示例#23
0
UINT64
ParticleManager::GetDurationMS( IN HParticleEmitter hParticleEmitter )
{
    ParticleEmitter*     pParticleEmitter;
    UINT64          duration = 0;
    
    pParticleEmitter = GetObjectPointer( hParticleEmitter );
    if (pParticleEmitter)
    {
        duration = pParticleEmitter->GetDurationMS();
    }

Exit:
    return duration;
}
示例#24
0
/***********************************************************************
 *
 * FUNCTION:    ThumbnailViewUpdateScrollers
 *
 * DESCRIPTION: This routine draws or erases the thumbnail view scroll arrow
 *              buttons.
 *
 * PARAMETERS:  frm          -  pointer to the to do thumbnail form
 *
 * RETURNED:    nothing
 *
 ***********************************************************************/
void ThumbnailViewUpdateScrollers(FormPtr frm) {
  UInt16 pos, maxValue;

  if (d.records_in_cat > recordsPerPage) {
    pos = d.top_row_pos_in_cat / recordsPerRow;
    maxValue = (d.records_in_cat - recordsPerPage) / recordsPerRow;
    if ((d.records_in_cat - recordsPerPage) % recordsPerRow)
      maxValue++;
  } else {
    pos = 0;
    maxValue = 0;
  }

  SclSetScrollBar(GetObjectPointer(frm, ScrollBar), pos, 0, maxValue,
          recordsPerPage / recordsPerRow);
}
示例#25
0
void CPointerTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src,
                              ESerialRecursionMode how) const
{
    TConstObjectPtr data = GetObjectPointer(src);
    if ( how != eRecursive ) {
        SetObjectPointer(dst, how == eShallow ? (const_cast<void*>(data)) : 0);
    }
    else if ( data == 0) {
        SetObjectPointer(dst, 0);
    }
    else {
        TTypeInfo type = GetRealDataTypeInfo(data);
        TObjectPtr object = type->Create();
        type->Assign(object, data, how);
        SetObjectPointer(dst, object);
    }
}
示例#26
0
RESULT
ParticleManager::SetRotation( IN HParticleEmitter hParticleEmitter, const vec3& rotation )
{
    RESULT rval = S_OK;

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::SetRotation( 0x%x ): invalid ParticleEmitter", (UINT32)hParticleEmitter);
        rval = E_INVALID_ARG;
        goto Exit;
    }

    CHR(pParticleEmitter->SetRotation( rotation ));
    
Exit:
    return rval;
}
示例#27
0
/***********************************************************************
 *
 * FUNCTION:    ThumbnailViewNextCategory
 *
 * DESCRIPTION: This routine display the next category,  if the last
 *              catagory isn't being displayed
 *
 * PARAMETERS:  nothing
 *
 * RETURNED:    nothing
 *
 *              The following global variables are modified:
 *          p.category
 *          d.categoryName
 *
 ***********************************************************************/
void ThumbnailViewNextCategory(void) {
  UInt16 category = CategoryGetNext(d.dbR, p.category);

  if (category != p.category) {
    FormPtr frm = FrmGetActiveForm();
    ControlPtr ctl = GetObjectPointer(frm, CategoryPop);

    ChangeCategory(category);

    /* Set the label of the category trigger. */
    CategoryGetName(d.dbR, p.category, d.categoryName);
    CategorySetTriggerLabel(ctl, d.categoryName);

    /* Display the new category. */
    SetTopVisibleRecord(0);
    ThumbnailViewLoadGadgets(frm);
  }
}
示例#28
0
RESULT
ParticleManager::ReleaseOnNextFrame( IN HParticleEmitter handle )
{
    RESULT           rval = S_OK;
    ParticleEmitter* pParticleEmitter;

    pParticleEmitter = GetObjectPointer( handle );
    if (!pParticleEmitter)
    {
        rval = E_BAD_HANDLE;
        goto Exit;
    }
    
    CHR(ReleaseOnNextFrame( pParticleEmitter ));

Exit:
    return rval;
}
示例#29
0
RESULT
ParticleManager::SetShadow( IN HParticleEmitter hParticleEmitter, bool shadowEnabled )
{
    RESULT rval = S_OK;

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::SetShadowEnabled( 0x%x, %d ): invalid ParticleEmitter", (UINT32)hParticleEmitter, shadowEnabled);
        rval = E_INVALID_ARG;
        goto Exit;
    }

    CHR(pParticleEmitter->SetShadow( shadowEnabled ));
    
Exit:
    return rval;
}
示例#30
0
RESULT
ParticleManager::SetOpacity( IN HParticleEmitter hParticleEmitter, float opacity )
{
    RESULT rval = S_OK;

    ParticleEmitter* pParticleEmitter = GetObjectPointer(hParticleEmitter);
    if (!pParticleEmitter)
    {
        RETAILMSG(ZONE_ERROR, "ERROR: ParticleManager::SetOpacity( 0x%x, %2.2f ): invalid ParticleEmitter", (UINT32)hParticleEmitter, opacity);
        rval = E_INVALID_ARG;
        goto Exit;
    }

    CHR(pParticleEmitter->SetOpacity( opacity ));
    
Exit:
    return rval;
}