示例#1
0
PropertyRow::PropertyRow(const char* name, const char* value)
	: BRow(),
	fName(name), fValue(value)
{
	SetField(new BStringField(name), kNameColumn);
	SetField(new BStringField(value), kValueColumn);
}
示例#2
0
  void Push(lua_State *L, GeoPoint value) {
    if (value.IsValid()) {
      lua_newtable(L);

      lua_newtable(L);
      SetField(L, -2, "__tostring", l_GeoPoint_tostring);
      lua_setmetatable(L, -2);

      SetField(L, -2, "longitude", value.longitude);
      SetField(L, -2, "latitude", value.latitude);
    } else
      lua_pushnil(L);
  }
示例#3
0
// modify size fields (if present); clear orientation field (if present)
void ExifBlock::ModifySizeFields(CSize img_size, bool clearOrientation)
{
    if (exif_buffer.empty() || exif_buffer.size() < offsetIfd0Entries)
        return;

    MemPointer mem(&exif_buffer.front(), exif_buffer.size());
    mem.SetByteOrder(bigEndianByteOrder);

    mem += offsetIfd0Entries;

    for (uint32 i= 0; i < ifd0Entries; ++i)
    {
        uint16 tag= mem.GetUInt16();
        if (tag == EXIF_IMG_WIDTH || tag == EXIF_IMG_HEIGHT)
        {
            SetField(mem, tag == EXIF_IMG_WIDTH ? img_size.cx : img_size.cy);
//			ModifySize(img_size, tag, mem);
        }
        else if (tag == EXIF_ORIENTATION)
        {
            SetField(mem, 1);	// 'normal' orientation
        }
        else if (tag == EXIF_SUB_IFD)
        {
            uint16 fmt= mem.GetUInt16();
            uint32 components= mem.GetUInt32();
            uint32 offset= mem.GetUInt32();

            // read sub IFD
            ptrdiff_t temp= mem.GetPos();

            mem.SetPos(ifd0Start + offset);

            uint16 entries= mem.GetUInt16();	// no of entries in sub IFD
            for (uint32 i= 0; i < entries; ++i)
            {
                uint16 tag= mem.GetUInt16();
                if (tag == EXIF_IMG_WIDTH || tag == EXIF_IMG_HEIGHT)
                    SetField(mem, tag == EXIF_IMG_WIDTH ? img_size.cx : img_size.cy);
//					ModifySize(img_size, tag, mem);
                else
                    mem += 2 + 4 + 4;
            }

            mem.SetPos(temp);
        }
        else
            mem += 2 + 4 + 4;
    }
}
示例#4
0
ResDataRow::ResDataRow(ResourceData *data)
  :	fResData(data)
{
	if (data) {
		SetField(new BStringField(fResData->GetIDString()), 0);
		SetField(new TypeCodeField(fResData->GetType(), fResData), 1);
		SetField(new BStringField(fResData->GetName()), 2);
		BField *field = gResRoster.MakeFieldForType(fResData->GetType(),
													fResData->GetData(),
													fResData->GetLength());
		if (field)
			SetField(field, 3);
		SetField(new BSizeField(fResData->GetLength()), 4);
	}
}
示例#5
0
status_t
TeamRow::_SetTo(TeamInfo* info)
{
	fTeamInfo = *info;

	app_info appInfo;
	status_t status = be_roster->GetRunningAppInfo(fTeamInfo.TeamID(),
		&appInfo);
	if (status != B_OK) {
		// Not an application known to be_roster

		if (fTeamInfo.TeamID() == B_SYSTEM_TEAM) {
			// Get icon and name from kernel image
			system_info	systemInfo;
			get_system_info(&systemInfo);

			BPath kernelPath;
			find_directory(B_BEOS_SYSTEM_DIRECTORY, &kernelPath);
			kernelPath.Append(systemInfo.kernel_name);

			get_ref_for_path(kernelPath.Path(), &appInfo.ref);

		} else
			BPrivate::get_app_ref(fTeamInfo.TeamID(), &appInfo.ref);
	}

	BBitmap* icon = new BBitmap(BRect(0, 0, B_MINI_ICON - 1, B_MINI_ICON - 1),
		B_RGBA32);

	status = BNodeInfo::GetTrackerIcon(&appInfo.ref, icon, B_MINI_ICON);
	if (status != B_OK) {
			BMimeType genericAppType(B_APP_MIME_TYPE);
			status = genericAppType.GetIcon(icon, B_MINI_ICON);
	}

	if (status != B_OK) {
		delete icon;
		icon = NULL;
	}

	BString tmp;
	tmp << fTeamInfo.TeamID();

	SetField(new BBitmapStringField(icon, fTeamInfo.Arguments()), kNameColumn);
	SetField(new BStringField(tmp), kIDColumn);

	return status;
}
示例#6
0
 static inline void
 SetField(lua_State *L, const char *package, const char *name, V &&value)
 {
   lua_getglobal(L, package);
   SetField(L, -2, name, value);
   lua_pop(L, 1);
 }
示例#7
0
void
Lua::InitLegacy(lua_State *L)
{
  lua_getglobal(L, "xcsoar");
  SetField(L, -2, "fire_legacy_event", l_fire_legacy_event);
  lua_pop(L, 1);
}
示例#8
0
void
HEventRow::SetPath(const char* _path)
{
	fPath = _path;
	BPath path(_path);
	SetField(new BStringField(_path ? path.Leaf() : "<none>"), kSoundColumn);
}
示例#9
0
void emMinesFileModel::OpenField(int x, int y, int z, bool saveFile)
{
	int x1,y1,z1,x2,y2,z2,f;

	f=GetField(x,y,z);
	if ((f&2)!=0) return;
	f|=2;
	f&=~4;
	SetField(x,y,z,f);
	if (GetSurroundings(x,y,z)==0) {
		z1=z-1; if (z1<0) z1=0;
		z2=z+2; if (z2>SizeZ) z2=SizeZ;
		y1=y-1; if (y1<0) y1=0;
		y2=y+2; if (y2>SizeY) y2=SizeY;
		x1=x-1; if (x1<0) x1=0;
		x2=x+2; if (x2>SizeX) x2=SizeX;
		for (z=z1; z<z2; z++) {
			for (y=y1; y<y2; y++) {
				for (x=x1; x<x2; x++) {
					OpenField(x,y,z,false);
				}
			}
		}
	}
	if (saveFile) Save(true);
}
示例#10
0
void SOMReader::Fill(const QColor &color) {
	for(unsigned int y = 0; y < m_iHeight; y++) {
		for(unsigned int x = 0; x < m_iWidth; x++) {
			SetField(QPoint(x, y), color);
		}
	}
}
示例#11
0
ShortcutsSpec::ShortcutsSpec(BMessage* from)
	:
	BRow(),
	fCommand(NULL),
	fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE),
	fLastBitmapName(NULL),
	fBitmapValid(false),
	fCursorPtsValid(false)
{
	const char* temp;
	if (from->FindString("command", &temp) != B_NO_ERROR) {
		printf(CLASS);
		printf(" Error, no command string in archive BMessage!\n");
		temp = "";
	}

	SetCommand(temp);

	if (from->FindInt32("key", (int32*) &fKey) != B_NO_ERROR) {
		printf(CLASS);
		printf(" Error, no key int32 in archive BMessage!\n");
	}

	for (int i = 0; i < NUM_META_COLUMNS; i++)
		if (from->FindInt32("mcidx", i, (int32*)&fMetaCellStateIndex[i])
			!= B_NO_ERROR) {
			printf(CLASS);
			printf(" Error, no modifiers int32 in archive BMessage!\n");
		}

	for (int i = 0; i <= STRING_COLUMN_INDEX; i++)
		SetField(new BStringField(GetCellText(i)), i);
}
示例#12
0
文件: xmlutil.cpp 项目: cw2018/xtpui
bool CXmlUtil::SetFieldBool(const XMLDOMDocumentPtr& doc,
                            const XMLDOMElementPtr& ele,
                            const wchar_t* filename,
                            BOOL value)
{
    return SetField(doc, ele, filename, value ? L"true" : L"false");
}
示例#13
0
void Mesg::SetFields(const Mesg& mesg)
{
   if (mesg.GetNum() != GetNum())
      return;
   
   for (int i=0; i < (int)mesg.fields.size(); i++)
      SetField(mesg.fields[i]);
}
示例#14
0
void
PackageRow::UpdateRating()
{
    if (fPackage.Get() == NULL)
        return;
    RatingSummary summary = fPackage->CalculateRatingSummary();
    SetField(new RatingField(summary.averageRating), kRatingColumn);
}
HEventRow::HEventRow(const char* name, const char* path)
	:
	BRow(),
	fName(name)
{
	SetField(new BStringField(name), kEventColumn);
	SetPath(path);
}
示例#16
0
void
PackageRow::UpdateSize()
{
	if (fPackage.Get() == NULL)
		return;

	SetField(new SizeField(fPackage->Size()), kSizeColumn);
}
示例#17
0
void
PackageRow::UpdateState()
{
    if (fPackage.Get() == NULL)
        return;

    SetField(new BStringField(package_state_to_string(fPackage)),
             kStatusColumn);
}
示例#18
0
void _OwqRow::SetRef(const entry_ref& ref)
{
	delete mRef;
	mRef = new entry_ref(ref);
	
	BString		filename("<drop query or folder here>");
	if( mRef ) {
		BPath	path(mRef);
		if( path.InitCheck() == B_OK ) {
			filename = path.Path();
			if ( mName.Length() < 1 || (mName.Compare(DEFAULT_ROW_NAME) == 0) ) {
				mName = path.Leaf();
				SetField(new BStringField( mName.String() ), 1);
			}
		}
	}
	SetField( new BStringField( filename.String() ), 2 );
}
示例#19
0
void
PackageRow::UpdateSummary()
{
	if (fPackage.Get() == NULL)
		return;

	SetField(new BStringField(fPackage->ShortDescription()),
		kDescriptionColumn);
}
示例#20
0
void
PackageRow::UpdateTitle()
{
	if (fPackage.Get() == NULL)
		return;

	SetField(new SharedBitmapStringField(fPackage->Icon(),
			SharedBitmap::SIZE_16, fPackage->Title()), kTitleColumn);
}
示例#21
0
文件: xmlutil.cpp 项目: cw2018/xtpui
bool CXmlUtil::SetFieldInt(const XMLDOMDocumentPtr& doc,
                           const XMLDOMElementPtr& ele,
                           const wchar_t* filename,
                           INT value)
{
    wchar_t szNum[35];
    _itow_s(value, szNum, 35, 10);
    return SetField(doc, ele, filename, szNum);
}
示例#22
0
PartitionListRow::PartitionListRow(BPartition* partition)
	:
	Inherited(),
	fPartitionID(partition->ID()),
	fParentID(partition->Parent() ? partition->Parent()->ID() : -1),
	fOffset(partition->Offset()),
	fSize(partition->Size())
{
	BPath path;
	partition->GetPath(&path);

	BBitmap* icon = NULL;
	if (partition->IsDevice()) {
		icon_size size = B_MINI_ICON;
		icon = new BBitmap(BRect(0, 0, size - 1, size - 1), B_RGBA32);
		if (partition->GetIcon(icon, size) != B_OK) {
			delete icon;
			icon = NULL;
		}
	}

	SetField(new BBitmapStringField(icon, path.Path()), kDeviceColumn);

	if (partition->ContainsFileSystem()) {
		SetField(new BStringField(partition->ContentType()), kFilesystemColumn);
		SetField(new BStringField(partition->ContentName()), kVolumeNameColumn);
	} else if (partition->CountChildren() > 0) {
		SetField(new BStringField(kUnavailableString), kFilesystemColumn);
		SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
	} else {
		SetField(new BStringField(partition->Type()), kFilesystemColumn);
		SetField(new BStringField(kUnavailableString), kVolumeNameColumn);
	}

	if (partition->IsMounted() && partition->GetMountPoint(&path) == B_OK) {
		SetField(new BStringField(path.Path()),  kMountedAtColumn);
	} else {
		SetField(new BStringField(kUnavailableString), kMountedAtColumn);
	}

	char size[1024];
	SetField(new BStringField(string_for_size(partition->Size(), size,
		sizeof(size))), kSizeColumn);
}
示例#23
0
文件: stage.cpp 项目: ponyuzu/-
/******************************************************************************
* 関数名:Stage1
* 
* 引数  :
* 戻り値:
* 説明  :
******************************************************************************/
void Stage1( void )
{

	//field///////////////////////////////////////////////////////////////////////
	SetField( D3DXVECTOR3( 0.0f , 0.0f , 0 ) );
	SetField( D3DXVECTOR3( 0.0f , 0.0f , 400 ) );
	SetField( D3DXVECTOR3( 0.0f , 0.0f , 900 ) );
	SetField( D3DXVECTOR3( 0.0f , 0.0f , 1300 ) );
	SetField( D3DXVECTOR3( 0.0f , 0.0f , 1700 ) );
	SetField( D3DXVECTOR3( 0.0f , 0.0f , 2200 ) );
	SetField( D3DXVECTOR3( 0.0f , 0.0f ,  2800 ) );
	SetField(D3DXVECTOR3( 0.0f , 0.0f ,  3500 ));


	//Box/////////////////////////////////////////////////////////////////////////
	SetBox( D3DXVECTOR3( 50.0f ,20 , 0.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( -50.0f , 20 , 100.0f ) , BOX_SPRING );

	SetBox( D3DXVECTOR3( - 50.0f ,20 , 900.0f ) , BOX_NOMAL );

	SetBox( D3DXVECTOR3( 50.0f ,20 , 1340.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( 50.0f ,20 , 1380.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( 10.0f ,20 , 1380.0f ) , BOX_NOMAL );

	SetBox( D3DXVECTOR3( 50.0f ,20 , 2800.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( 10.0f ,20 , 2800.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( 50.0f ,20 , 2840.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( 10.0f ,20 , 2840.0f ) , BOX_NOMAL );
	SetBox( D3DXVECTOR3( 30.0f ,60 , 2820.0f ) , BOX_NOMAL );


	//Obstacl/////////////////////////////////////////////////////////////////////
	SetObstacl( D3DXVECTOR3( 0.0f ,20 , 50.0f ) , OBSTACL_NOMAL );

	SetObstacl( D3DXVECTOR3( -50.0f , 20 , 2500.0f ) , OBSTACL_NOMAL );

	SetObstacl( D3DXVECTOR3( 0.0f , -20 , 3100.0f ) , OBSTACL_NOMAL );
	SetObstacl( D3DXVECTOR3( 0.0f , -20 , 3200.0f ) , OBSTACL_NOMAL );
	SetObstacl( D3DXVECTOR3( 0.0f , -20 , 3300.0f ) , OBSTACL_NOMAL );

	//Enemy///////////////////////////////////////////////////////////////////////
	SetEnemy( D3DXVECTOR3( 150.0f , 0.0f ,  1200.0f ) );
	SetEnemy( D3DXVECTOR3( 150.0f , 0.0f ,  1500.0f ) );
	SetEnemy( D3DXVECTOR3( 0.0f , 0.0f ,  1700.0f ) );


	//Acorn///////////////////////////////////////////////////////////////////////
	SetAcorn( D3DXVECTOR3( 0.0f ,0, - 80.0f ) );


	//goal/////////////////////////////////////////////////////////////////////
	SetGoal( D3DXVECTOR3( 0.0f , 50.0f , 3500 ) );
}
示例#24
0
status_t _OwqRow::SetPreferences(const BMessage* prefs)
{
	delete mRef;
	mRef = 0;
	entry_ref	ref;
	if( prefs ) {
		bool		b;
		const char*	str;
		if( prefs->FindBool( "on", &b ) == B_OK ) mOn = b;
		if( prefs->FindString( "name", &str ) == B_OK ) mName = str;
		prefs->FindRef( "ref", &ref );
		if( prefs->FindBool( "skip", &b ) == B_OK ) mSkip = b;
	}

	SetField( new BStringField( (mOn) ? "Yes" : "No" ), 0 );
	SetField( new BStringField( mName.String() ), 1 );
	SetRef( ref );
	return B_OK;
}
示例#25
0
bool
SdfPropertySpec::SetDefaultValue(const VtValue &defaultValue)
{
    if (defaultValue.IsEmpty()) {
        ClearDefaultValue();
        return true;
    }

    if (defaultValue.IsHolding<SdfValueBlock>()) {
        return SetField(SdfFieldKeys->Default, defaultValue);
    }

    TfType valueType = GetValueType();
    if (valueType.IsUnknown()) {
        TF_CODING_ERROR("Can't set value on attribute <%s> with "
                        "unknown type \"%s\"",
                        GetPath().GetText(),
                        GetTypeName().GetAsToken().GetText());
        return false;
    }

    if (ARCH_UNLIKELY(valueType.GetTypeid() == typeid(void))) {
        // valueType may be provided by a plugin that has not been loaded.
        // In that case, we cannot get the type info, which is required to cast.
        // So we load the plugin in that case.
        if (PlugPluginPtr p = 
                PlugRegistry::GetInstance().GetPluginForType(valueType)) {
            p->Load();
        }
    }

    VtValue value = VtValue::CastToTypeid(defaultValue, valueType.GetTypeid());
    if (value.IsEmpty()) {
        TF_CODING_ERROR("Can't set value on <%s> to %s: "
                        "expected a value of type \"%s\"",
                        GetPath().GetText(),
                        TfStringify(defaultValue).c_str(),
                        valueType.GetTypeName().c_str());
        return false;
    }
    return SetField(SdfFieldKeys->Default, value);
}
示例#26
0
void
ShortcutsSpec::SetCommand(const char* command)
{
	delete[] fCommand;
		// out with the old (if any)...
	fCommandLen = strlen(command) + 1;
	fCommandNul = fCommandLen - 1;
	fCommand = new char[fCommandLen];
	strcpy(fCommand, command);
	SetField(new BStringField(command), STRING_COLUMN_INDEX);
}
示例#27
0
文件: xmlutil.cpp 项目: cw2018/xtpui
bool CXmlUtil::SetFieldFloat(const XMLDOMDocumentPtr& doc,
                             const XMLDOMElementPtr& ele,
                             const wchar_t* filename,
                             double value,
                             const wchar_t* unitName,
                             int decimal)
{
    std::wstring str (x3::RoundStr(value, decimal));
    str += unitName;
    return SetField(doc, ele, filename, str.c_str());
}
示例#28
0
void emMinesFileModel::SetMark(int x, int y, int z, bool saveFile)
{
	int f;

	f=GetField(x,y,z);
	if ((f&6)==0) {
		f|=4;
		SetField(x,y,z,f);
		if (saveFile) Save(true);
	}
}
示例#29
0
void emMinesFileModel::RemoveMark(int x, int y, int z, bool saveFile)
{
	int f;

	f=GetField(x,y,z);
	if ((f&4)!=0) {
		f&=~4;
		SetField(x,y,z,f);
		if (saveFile) Save(true);
	}
}
示例#30
0
	CQuery* CQueryParser::Parse(const char *strQuery,const char *field,CAnalyzer *pAnalyzer)
	{
		CQuery *q = NULL;
		InitTokenStream(strQuery,pAnalyzer);
		InitTermPool();
		SetField(field);

		m_stream.GetNextToken(m_currentToken);
		q =  Query();
		return q;
	}