Beispiel #1
0
void
CTool::SetValue(
	int32 value)
{
	D_OPERATION(("CTool::SetValue(%ld)\n", value));

	if (value != m_value)
	{
		if (Mode() == TRIGGER_MODE)
		{
			// trigger tools don't change their value
			return;
		}

		if ((Mode() == RADIO_MODE) && (Flags() & FORCE_SELECTION)
		 && (Value() == B_CONTROL_ON))
		{
			// radio mode with the force-selection flag set does not
			// allow 'turning off' the tool directly
			return;
		}

		m_value = value;

		if ((Mode() == RADIO_MODE) && (Value() == B_CONTROL_ON))
		{
			// turn off other tools in radio group
			CTool *tool;
			tool = PreviousTool();
			while (tool)
			{
				if (tool->m_value == B_CONTROL_ON)
				{
					tool->m_value = B_CONTROL_OFF;
					tool->ValueChanged();
				}
				tool = tool->PreviousTool();
			}
			tool = NextTool();
			while (tool)
			{
				if (tool->m_value == B_CONTROL_ON)
				{
					tool->m_value = B_CONTROL_OFF;
					tool->ValueChanged();
				}
				tool = tool->NextTool();
			}
		}
		ValueChanged();
	}	
}
Beispiel #2
0
void
BMenuField::DoLayout()
{
	// Bail out, if we shan't do layout.
	if (!(Flags() & B_SUPPORTS_LAYOUT))
		return;

	CALLED();

	// If the user set a layout, we let the base class version call its
	// hook.
	if (GetLayout()) {
		BView::DoLayout();
		return;
	}

	_ValidateLayoutData();

	// validate current size
	BSize size(Bounds().Size());
	if (size.width < fLayoutData->min.width)
		size.width = fLayoutData->min.width;
	if (size.height < fLayoutData->min.height)
		size.height = fLayoutData->min.height;

	// divider
	float divider = 0;
	if (fLayoutData->label_layout_item && fLayoutData->menu_bar_layout_item) {
		// We have layout items. They define the divider location.
		divider = fLayoutData->menu_bar_layout_item->Frame().left
			- fLayoutData->label_layout_item->Frame().left;
	} else {
		if (fLayoutData->label_width > 0)
			divider = fLayoutData->label_width + 5;
	}

	// menu bar
	BRect dirty(fMenuBar->Frame());
	BRect menuBarFrame(divider + kVMargin, kVMargin, size.width - kVMargin,
		size.height - kVMargin);

	// place the menu bar and set the divider
	BLayoutUtils::AlignInFrame(fMenuBar, menuBarFrame);

	fDivider = divider;

	// invalidate dirty region
	dirty = dirty | fMenuBar->Frame();
	dirty.InsetBy(-kVMargin, -kVMargin);

	Invalidate(dirty);
}
  void
  VirtualKey::VK_JIS_TEMPORARY::firekeytoinputdetail(const Params_KeyboardEventCallBack& params,
                                                     InputSourceDetail inputsourcedetail)
  {
    inputsourcedetail = normalize(inputsourcedetail);
    currentinputsourcedetail_ = normalize(currentinputsourcedetail_);

    // ------------------------------------------------------------
    if (inputsourcedetail == currentinputsourcedetail_) return;
    if (inputsourcedetail == InputSourceDetail::NONE) return;

    currentinputsourcedetail_ = inputsourcedetail;

    // ------------------------------------------------------------
    if (inputsourcedetail == InputSourceDetail::ENGLISH) {
      fireKeyInfo_.flags = Flags(0);
      fireKeyInfo_.key = KeyCode::JIS_EISUU;

    } else if (inputsourcedetail == InputSourceDetail::JAPANESE_HIRAGANA) {
      fireKeyInfo_.flags = Flags(0);
      fireKeyInfo_.key = KeyCode::JIS_KANA;

    } else if (inputsourcedetail == InputSourceDetail::JAPANESE_KATAKANA) {
      fireKeyInfo_.flags = ModifierFlag::SHIFT_L;
      fireKeyInfo_.key = KeyCode::JIS_KANA;

    } else if (inputsourcedetail == InputSourceDetail::AINU) {
      fireKeyInfo_.flags = ModifierFlag::OPTION_L;
      fireKeyInfo_.key = KeyCode::JIS_KANA;

    } else {
      return;
    }

    fireKeyInfo_.keyboardType = params.keyboardType;
    fireKeyInfo_.active = true;

    fire_timer_.setTimeoutMS(KEYEVENT_DELAY_MS);
  }
Beispiel #4
0
_BMCMenuBar_::_BMCMenuBar_(BMessage* data)
	:
	BMenuBar(data),
	fMenuField(NULL),
	fFixedSize(true),
	fShowPopUpMarker(true)
{
	SetFlags(Flags() | B_FRAME_EVENTS);

	bool resizeToFit;
	if (data->FindBool("_rsize_to_fit", &resizeToFit) == B_OK)
		fFixedSize = !resizeToFit;
}
Beispiel #5
0
void
BButton::MakeDefault(bool flag)
{
	BButton* oldDefault = NULL;
	BWindow* window = Window();

	if (window != NULL)
		oldDefault = window->DefaultButton();

	if (flag) {
		if (_Flag(FLAG_DEFAULT) && oldDefault == this)
			return;

		if (_SetFlag(FLAG_DEFAULT, true)) {
			if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
				InvalidateLayout();
			else {
				ResizeBy(6.0f, 6.0f);
				MoveBy(-3.0f, -3.0f);
			}
		}

		if (window && oldDefault != this)
			window->SetDefaultButton(this);
	} else {
		if (!_SetFlag(FLAG_DEFAULT, false))
			return;

		if ((Flags() & B_SUPPORTS_LAYOUT) != 0)
			InvalidateLayout();
		else {
			ResizeBy(-6.0f, -6.0f);
			MoveBy(3.0f, 3.0f);
		}

		if (window && oldDefault == this)
			window->SetDefaultButton(NULL);
	}
}
Beispiel #6
0
WorkspacesView::WorkspacesView(BMessage* archive)
	:
	BView(archive),
	fParentWhichDrawsOnChildren(NULL),
	fCurrentFrame(Frame())
{
	// Just in case we are instantiated from an older archive...
	SetFlags(Flags() | B_FRAME_EVENTS);
	// Make sure the auto-raise feature didn't leave any artifacts - this is
	// not a good idea to keep enabled for a replicant.
	if (EventMask() != 0)
		SetEventMask(0);
}
Beispiel #7
0
int DBObjData::_Write(FILE *file) {
    DBInt id, userFlags;
    DBObjRecord *docRec;

    userFlags = Flags() & DBDataFlagUserModeFlags;
    Flags(DBDataFlagUserModeFlags, DBClear);
    if (DBObject::Write(file) == DBFault) return (DBFault);
    Flags(userFlags, DBSet);
    if (DocsPTR->Write(file) == DBFault) return (DBFault);
    for (id = 0; id < DocsPTR->ItemNum(); ++id) {
        if (DocsPTR->WriteItem(file, id) == DBFault) return (DBFault);
        docRec = DocsPTR->Item(id);
        if (((DBVarString *) docRec->Data())->Write(file) == DBFault) return (DBFault);
    }
    if (ArraysPTR->Write(file) == DBFault) return (DBFault);
    for (id = 0; id < ArraysPTR->ItemNum(); ++id)
        if (ArraysPTR->WriteItem(file, id) == DBFault) return (DBFault);
    TablesPTR->Write(file);
    for (id = 0; id < TablesPTR->ItemNum(); ++id)
        if (TablesPTR->WriteItem(file, id) == DBFault) return (DBFault);
    return (BuildFields());
}
Beispiel #8
0
void
BTextControl::_ValidateLayoutData()
{
	CALLED();

	if (fLayoutData->valid)
		return;

	// cache font height
	font_height& fh = fLayoutData->font_info;
	GetFontHeight(&fh);

	if (Label() != NULL) {
		fLayoutData->label_width = ceilf(StringWidth(Label()));
		fLayoutData->label_height = ceilf(fh.ascent) + ceilf(fh.descent);
	} else {
		fLayoutData->label_width = 0;
		fLayoutData->label_height = 0;
	}

	// compute the minimal divider
	float divider = 0;
	if (fLayoutData->label_width > 0)
		divider = fLayoutData->label_width + 5;

	// If we shan't do real layout, we let the current divider take influence.
	if (!(Flags() & B_SUPPORTS_LAYOUT))
		divider = max_c(divider, fDivider);

	// get the minimal (== preferred) text view size
	fLayoutData->text_view_min = fText->MinSize();

	TRACE("text view min width: %.2f\n", fLayoutData->text_view_min.width);

	// compute our minimal (== preferred) size
	BSize min(fLayoutData->text_view_min);
	min.width += 2 * kFrameMargin;
	min.height += 2 * kFrameMargin;

	if (divider > 0)
		min.width += divider;
	if (fLayoutData->label_height > min.height)
		min.height = fLayoutData->label_height;

	fLayoutData->min = min;

	fLayoutData->valid = true;
	ResetLayoutInvalidation();

	TRACE("width: %.2f, height: %.2f\n", min.width, min.height);
}
Beispiel #9
0
void
BBox::DoLayout()
{
	// Bail out, if we shan't do layout.
	if (!(Flags() & B_SUPPORTS_LAYOUT))
		return;

	bool layouted = GetLayout() ? true : false;

	// If the user set a layout, let the base class version call its
	// hook. In case when we have BView as a label, remove it from child list
	// so it won't be layouted with the rest of views and add it again
	// after that.
	if (layouted) {
		if (fLabelView)
			RemoveChild(fLabelView);

		BView::DoLayout();

		if (fLabelView)
			AddChild(fLabelView, ChildAt(0));
		else
			return;
	}

	_ValidateLayoutData();

	// Even if the user set a layout, restore label view to it's
	// desired position.

	// layout the label view
	if (fLabelView) {
		fLabelView->MoveTo(fLayoutData->label_box.LeftTop());
		fLabelView->ResizeTo(fLayoutData->label_box.Size());
	}

	// If we have layout return here and do not layout the child
	if (layouted)
		return;

	// layout the child
	if (BView* child = _Child()) {
		BRect frame(Bounds());
		frame.left += fLayoutData->insets.left;
		frame.top += fLayoutData->insets.top;
		frame.right -= fLayoutData->insets.right;
		frame.bottom -= fLayoutData->insets.bottom;

		BLayoutUtils::AlignInFrame(child, frame);
	}
}
void
ShowImageWindow::_ToggleFullScreen()
{
	BRect frame;
	fFullScreen = !fFullScreen;
	if (fFullScreen) {
		BScreen screen;
		fWindowFrame = Frame();
		frame = screen.Frame();
		frame.top -= fBar->Bounds().Height() + 1;
		frame.right += B_V_SCROLL_BAR_WIDTH;
		frame.bottom += B_H_SCROLL_BAR_HEIGHT;

		SetFlags(Flags() | B_NOT_RESIZABLE | B_NOT_MOVABLE);

		Activate();
			// make the window frontmost
	} else {
		frame = fWindowFrame;

		SetFlags(Flags() & ~(B_NOT_RESIZABLE | B_NOT_MOVABLE));
	}

	fToolBar->SetActionVisible(MSG_FULL_SCREEN, fFullScreen);
	_SetToolBarVisible(!fFullScreen && fShowToolBar);
	_SetToolBarBorder(!fFullScreen);

	MoveTo(frame.left, frame.top);
	ResizeTo(frame.Width(), frame.Height());

	fImageView->SetHideIdlingCursor(fFullScreen);
	fImageView->SetShowCaption(fFullScreen && fShowCaption);

	Layout(false);
		// We need to manually relayout here, as the views are layouted
		// asynchronously, and FitToBounds() would still have the wrong size
	fImageView->FitToBounds();
}
Beispiel #11
0
    void print_flags(Flags flag, const char * (&names)[N], std::string& str)
    {
        if (flag == 0)
        {
            str += "None";
            return;
        }

        for (int i = 0; i < N; ++i)
        {
            if ((flag & (Flags(1) << i)) && names[i] != NULL)
                str.append(" ").append(names[i]);
        }
    }
Beispiel #12
0
void
BScrollView::SetBorder(border_style border)
{
	if (fBorder == border)
		return;

	float offset = BorderSize(fBorder) - BorderSize(border);
	float resize = 2 * offset;

	float horizontalGap = 0, verticalGap = 0;
	float change = 0;
	if (border == B_NO_BORDER || fBorder == B_NO_BORDER) {
		if (fHorizontalScrollBar != NULL)
			verticalGap = border != B_NO_BORDER ? 1 : -1;
		if (fVerticalScrollBar != NULL)
			horizontalGap = border != B_NO_BORDER ? 1 : -1;

		change = border != B_NO_BORDER ? -1 : 1;
		if (fHorizontalScrollBar == NULL || fVerticalScrollBar == NULL)
			change *= 2;
	}


	fBorder = border;

	int32 savedResizingMode = 0;
	if (fTarget != NULL) {
		savedResizingMode = fTarget->ResizingMode();
		fTarget->SetResizingMode(B_FOLLOW_NONE);
	}

	MoveBy(offset, offset);
	ResizeBy(-resize - horizontalGap, -resize - verticalGap);

	if (fTarget != NULL) {
		fTarget->MoveBy(-offset, -offset);
		fTarget->SetResizingMode(savedResizingMode);
	}

	if (fHorizontalScrollBar != NULL) {
		fHorizontalScrollBar->MoveBy(-offset - verticalGap, offset + verticalGap);
		fHorizontalScrollBar->ResizeBy(resize + horizontalGap - change, 0);
	}
	if (fVerticalScrollBar != NULL) {
		fVerticalScrollBar->MoveBy(offset + horizontalGap, -offset - horizontalGap);
		fVerticalScrollBar->ResizeBy(0, resize + verticalGap - change);
	}

	SetFlags(ModifyFlags(Flags(), border));
}
Beispiel #13
0
void
BStatusBar::_InitObject()
{
	fMax = 100.0;
	fCurrent = 0.0;

	fBarHeight = -1.0;
	fTextDivider = Bounds().Width();

	fBarColor = kDefaultBarColor;
	fCustomBarHeight = false;

	SetFlags(Flags() | B_FRAME_EVENTS);
}
Beispiel #14
0
void
BStatusBar::_InitObject()
{
    fMax = 100.0;
    fCurrent = 0.0;

    fBarHeight = -1.0;
    fTextDivider = Bounds().Width();

    fCustomBarHeight = false;
    fInternalFlags = 0;

    SetFlags(Flags() | B_FRAME_EVENTS);
}
Beispiel #15
0
BToolbar::BToolbar(BRect frame, orientation ont)
	:
	BGroupView(ont),
	fOrientation(ont)
{
	float inset = ceilf(be_control_look->DefaultItemSpacing() / 2);
	GroupLayout()->SetInsets(inset, 0, inset, 0);
	GroupLayout()->SetSpacing(1);

	SetFlags(Flags() | B_FRAME_EVENTS | B_PULSE_NEEDED);

	MoveTo(frame.LeftTop());
	ResizeTo(frame.Width(), frame.Height());
	SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
}
Beispiel #16
0
TabContainerView::TabContainerView(Controller* controller)
	:
	BGroupView(B_HORIZONTAL, 0.0),
	fLastMouseEventTab(NULL),
	fMouseDown(false),
	fClickCount(0),
	fSelectedTab(NULL),
	fController(controller),
	fFirstVisibleTabIndex(0)
{
	SetFlags(Flags() | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE);
	SetViewColor(B_TRANSPARENT_COLOR);
	GroupLayout()->SetInsets(kLeftTabInset, 0, 0, 1);
	GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue(), 0.0f);
}
void QgsVectorLayerLabelProvider::init()
{
  mPlacement = mSettings.placement;
  mLinePlacementFlags = mSettings.placementFlags;
  mFlags = Flags();
  if ( mSettings.drawLabels ) mFlags |= DrawLabels;
  if ( mSettings.displayAll ) mFlags |= DrawAllLabels;
  if ( mSettings.mergeLines ) mFlags |= MergeConnectedLines;
  if ( mSettings.centroidInside ) mFlags |= CentroidMustBeInside;
  if ( mSettings.fitInPolygonOnly ) mFlags |= FitInPolygonOnly;
  if ( mSettings.labelPerPart ) mFlags |= LabelPerFeaturePart;
  mPriority = 1 - mSettings.priority / 10.0; // convert 0..10 --> 1..0
  mObstacleType = mSettings.obstacleType;
  mUpsidedownLabels = mSettings.upsidedownLabels;
}
Beispiel #18
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
BmToolbarButton::BmToolbarButton( const char *label, float width, float height, 
											 BMessage *message, BHandler *handler, 
											 const char* tipText, bool needsLatch,
											 const char* resourceName)
	:	inherited( minimax( int(width), int(height), -1 ,-1), 
					  &BmDummyPicture, &BmDummyPicture, message, handler)
	,	mHighlighted( false)
	,	mNeedsLatch( needsLatch)
	,	mUpdateVariationsFunc( NULL)
	,	mLabel( label)
	,	mResourceName( resourceName ? resourceName : label)
{
	SetFlags(Flags() & ~B_NAVIGABLE);
	TheBubbleHelper->SetHelp( this, tipText);
}
Beispiel #19
0
void
BControl::InitData(BMessage* data)
{
	fLabel = NULL;
	SetLabel(B_EMPTY_STRING);
	fValue = B_CONTROL_OFF;
	fEnabled = true;
	fFocusChanging = false;
	fTracking = false;
	fWantsNav = Flags() & B_NAVIGABLE;
	fIcon = NULL;

	if (data && data->HasString("_fname"))
		SetFont(be_plain_font, B_FONT_FAMILY_AND_STYLE);
}
Beispiel #20
0
BStringView::BStringView(BMessage* archive)
	:
	BView(archive),
	fText(NULL),
	fTruncation(B_NO_TRUNCATION),
	fPreferredSize(0, -1)
{
	fAlign = (alignment)archive->GetInt32("_align", B_ALIGN_LEFT);
	fTruncation = (uint32)archive->GetInt32("_truncation", B_NO_TRUNCATION);

	const char* text = archive->GetString("_text", NULL);

	SetText(text);
	SetFlags(Flags() | B_FULL_UPDATE_ON_RESIZE);
}
Beispiel #21
0
status_t
BlockGroup::SetExtentTree(off_t rootAddress)
{
	status_t status = fCurrentExtentTree->SetRoot(rootAddress, NULL);
	if (status != B_OK)
		return status;

	if (fItem != NULL) {
		// re-allocate BlockGroup;
		uint64 flags = Flags();
		return Initialize(flags);
	}

	return B_OK;
}
Beispiel #22
0
WriterImplBase::~WriterImplBase()
{
	delete fHeapWriter;
	delete fCompressionAlgorithm;
	delete fCompressionParameters;
	delete fDecompressionAlgorithm;
	delete fDecompressionParameters;

	if (fOwnsFile)
		delete fFile;

	if (!fFinished && fFileName != NULL
		&& (Flags() & B_HPKG_WRITER_UPDATE_PACKAGE) == 0) {
		unlink(fFileName);
	}
}
Beispiel #23
0
void
PressDownKeys::clear(void) {
  IOLOG_DEVEL("PressDownKeys::clear list_.size = %d\n", static_cast<int>(list_.size()));

  Item* p = static_cast<Item*>(list_.safe_front());
  for (;;) {
    if (!p) break;

    Params_KeyboardEventCallBack params(EventType::UP, Flags(0), p->key, p->keyboardType, false);

    EventOutputQueue::push(params);
    IOLOG_DEVEL("PressDownKeys::clear key:%d, keyboardType:%d\n", params.key.get(), params.keyboardType.get());

    p = static_cast<Item*>(list_.erase_and_delete(p));
  }
}
Beispiel #24
0
void
BAbstractSpinner::_ValidateLayoutData()
{
	if (fLayoutData->valid)
		return;

	font_height fontHeight = fLayoutData->font_info;
	GetFontHeight(&fontHeight);

	if (Label() != NULL) {
		fLayoutData->label_width = StringWidth(Label());
		fLayoutData->label_height = ceilf(fontHeight.ascent
			+ fontHeight.descent + fontHeight.leading);
	} else {
		fLayoutData->label_width = 0;
		fLayoutData->label_height = 0;
	}

	float divider = 0;
	if (fLayoutData->label_width > 0) {
		divider = ceilf(fLayoutData->label_width
			+ be_control_look->DefaultLabelSpacing());
	}

	if ((Flags() & B_SUPPORTS_LAYOUT) == 0)
		divider = std::max(divider, fDivider);

	float minTextWidth = fTextView->StringWidth("99999");

	float textViewHeight = fTextView->LineHeight(0) + kFrameMargin * 2;
	float textViewWidth = minTextWidth + textViewHeight * 2;

	fLayoutData->text_view_width = textViewWidth;
	fLayoutData->text_view_height = textViewHeight;

	BSize min(textViewWidth, textViewHeight);
	if (divider > 0.0f)
		min.width += divider;

	if (fLayoutData->label_height > min.height)
		min.height = fLayoutData->label_height;

	fLayoutData->min = min;
	fLayoutData->valid = true;

	ResetLayoutInvalidation();
}
Beispiel #25
0
bool test(accelerator_view &rv)
{
    int data[] = {0, 0, 0, 0};
    vector<int> Flags(data, data + sizeof(data) / sizeof(int));
    extent<1> eflags(sizeof(data) / sizeof(int));
    array<int, 1> aFlag(eflags, Flags.begin(), rv);

    const int size = 100;

    vector<int> A(size);
    vector<c> G(size);
    vector<c> G2(size);

    for(int i = 0; i < size; i++)
    {
        A[i] = INIT_VALUE;
        G[i].i = G[i].d = G[i].ui = G[i].f = i;
        G2[i].i = G2[i].d = G2[i].ui = G2[i].f = i;
    }

    extent<1> e(size);
    extent<2> eG(10, 10);

    array<int, 1> aA(e, A.begin(), rv);
    array<c, 2> aG(eG, G.begin(), rv);
    array<c, 2> aG2(eG, G2.begin(), rv);

    parallel_for_each(aA.get_extent(), [&](index<1>idx) __GPU
    {
        c *p = NULL;

        if (aFlag[0] == 0)
            p = &aG[0][0];
        else
            p = &aG2[0][0];

        double di = 0;
        for (int i = 0; i < 100; i++)
        {
            if (!Equal((*p).i, (int)i) || !Equal((*p).d, di) || !Equal((*p).ui, (unsigned __int32)i) || !Equal((*p).f, (float)i))
            {
                aA[idx] = 1;
            }
            p++;
            di++;
        }
    });
Beispiel #26
0
int has_flag( dbref player, dbref it, char *flagname ) {
    FLAGENT *fp;

    FLAG fv;

    fp = find_flag( it, flagname );
    if( fp == NULL ) {	/* find_flag() uppercases the string */
        if( !strcmp( flagname, "PLAYER" ) ) {
            return isPlayer( it );
        }
        if( !strcmp( flagname, "THING" ) ) {
            return isThing( it );
        }
        if( !strcmp( flagname, "ROOM" ) ) {
            return isRoom( it );
        }
        if( !strcmp( flagname, "EXIT" ) ) {
            return isExit( it );
        }
        return 0;
    }
    if( fp->flagflag & FLAG_WORD3 ) {
        fv = Flags3( it );
    } else if( fp->flagflag & FLAG_WORD2 ) {
        fv = Flags2( it );
    } else {
        fv = Flags( it );
    }

    if( fv & fp->flagvalue ) {
        if( ( fp->listperm & CA_WIZARD ) && !Wizard( player ) ) {
            return 0;
        }
        if( ( fp->listperm & CA_GOD ) && !God( player ) ) {
            return 0;
        }
        /*
         * don't show CONNECT on dark wizards to mortals
         */
        if( isPlayer( it ) && isConnFlag( fp ) &&
                Can_Hide( it ) && Hidden( it ) && !See_Hidden( player ) ) {
            return 0;
        }
        return 1;
    }
    return 0;
}
Beispiel #27
0
char *unparse_object( dbref player, dbref target, int obey_myopic ) {
    char *buf, *fp, *bp;

    int exam;

    buf = alloc_lbuf( "unparse_object" );
    if( target == NOTHING ) {
        strcpy( buf, "*NOTHING*" );
    } else if( target == HOME ) {
        strcpy( buf, "*HOME*" );
    } else if( target == AMBIGUOUS ) {
        strcpy( buf, "*VARIABLE*" );
    } else if( isGarbage( target ) ) {
        fp = unparse_flags( player, target );
        bp = buf;
        safe_sprintf( buf, &bp, "*GARBAGE*(#%d%s)", target, fp );
        free_sbuf( fp );
    } else if( !Good_obj( target ) ) {
        sprintf( buf, "*ILLEGAL*(#%d)", target );
    } else {
        if( obey_myopic ) {
            exam = MyopicExam( player, target );
        } else {
            exam = Examinable( player, target );
        }
        if( exam ||
                ( Flags( target ) & ( CHOWN_OK | JUMP_OK | LINK_OK |
                                      DESTROY_OK ) ) || ( Flags2( target ) & ABODE ) ) {

            /*
             * show everything
             */
            fp = unparse_flags( player, target );
            bp = buf;
            safe_sprintf( buf, &bp, "%s(#%d%s)", Name( target ), target, fp );
            free_sbuf( fp );
        } else {
            /*
             * show only the name.
             */
            strcpy( buf, Name( target ) );
        }
    }
    return buf;
}
Beispiel #28
0
EXPORT_C TBool CHuiLayout::PrepareDrawL() 
    {
    if (Flags() & EHuiVisualFlagDrawOnlyAsExternalContent)
    	{
   	    // This is used only as external content visual. Return now if we are not currently drawing
   	    // external content.
    	if (!Display() || !Display()->RosterImpl().IsDrawingExternalContent())
    		{
			return ETrue;
    		}
    	}

    // The layout itself is invisible. Only its children can be seen.
    TInt count = Count();
    for(TInt i = 0; i < count; ++i)
        {
        CHuiVisual* visual = iHuiLayoutPrivateData->iChildren[i];
        //Ignore inactive child visuals
        if ( visual->Flags()& EHuiVisualFlagInactive )
        	{
        	continue; 
        	}
        TBool successfullyPrepared = ETrue;
        TRAPD(err, successfullyPrepared = visual->PrepareDrawL());
        if (err != KErrNone)
            {
            // Handle the error by calling the visual owner
            // errorhandling callback
            visual->Owner().VisualPrepareDrawFailed(*visual, err);
            return EFalse;
            }
        if (!successfullyPrepared) 
	        {
	        // we can stop preparing the rest of the children
	        // if one prepare failed (we won't be drawing anything 
	        // anyway)
	        
	        // also if the prepare failed but there was not a leave,
	        // we assume it was already handled 
	        return EFalse;
	        }
        }
    return ETrue;
    }
Beispiel #29
0
dbref create_guest(char *name, char *password)
{
	dbref player;
	char *buff;

	if(!Wizard(mudconf.guest_nuker) || !Good_obj(mudconf.guest_nuker))
		mudconf.guest_nuker = 1;

	buff = alloc_lbuf("create_guest");

	/*
	 * Make the player. 
	 */

	player = create_player(name, password, mudconf.guest_nuker, 0, 1);

	if(player == NOTHING) {
		log_text("GUEST: failed in create_player\n");
		return NOTHING;
	}
	/*
	 * Turn the player into a guest. 
	 */

	s_Guest(player);
	move_object(player, mudconf.start_room);
	s_Flags(player, Flags(player) & ~WIZARD);
	s_Pennies(player, Pennies(mudconf.guest_char));
	s_Zone(player, Zone(mudconf.guest_char));
	s_Parent(player, Parent(mudconf.guest_char));

	/*
	 * Make sure the guest is locked. 
	 */
	do_lock(player, player, A_LOCK, tprintf("#%d", player), "me");
	do_lock(player, player, A_LENTER, tprintf("#%d", player), "me");

	/*
	 * Copy all attributes. 
	 */
	atr_cpy(GOD, player, mudconf.guest_char);
	free_lbuf(buff);
	return player;
}
void EventInputQueue::push_UpdateEventFlagsCallback(OSObject* target,
                                                    unsigned flags,
                                                    OSObject* sender,
                                                    void* refcon) {
  GlobalLock::ScopedLock lk;
  if (!lk) return;

  Params_UpdateEventFlagsCallback::log(true, Flags(flags));

  // ------------------------------------------------------------
  // update device priority by calling ListHookedKeyboard::instance().get(kbd).
  IOHIKeyboard* device = OSDynamicCast(IOHIKeyboard, sender);
  if (!device) return;

  ListHookedKeyboard::Item* item = static_cast<ListHookedKeyboard::Item*>(ListHookedKeyboard::instance().get(device));
  if (!item) return;

  // Don't push_back for UpdateEventFlagsCallback.
}