Exemplo n.º 1
0
void DataSource::ZeroCrossing(Getdatafun getdataY, Getdatafun getdataX, bool ascending, bool descending, 
							  Vector<double> &zeros, Vector<int64> &ids) {
	zeros.Clear();
	ids.Clear();
	
	double y_prev, x_prev;
	int i0;
	for (i0 = 0; i0 < GetCount(); ++i0) {
		y_prev = Membercall(getdataY)(i0);
		x_prev = Membercall(getdataX)(i0);
		if (!IsNull(x_prev) && !IsNull(y_prev))
			break;
	}
	for (int i = i0; i < GetCount(); ++i) {
		double y = Membercall(getdataY)(i);
		double x = Membercall(getdataX)(i);
		if (IsNull(x) || IsNull(y))
			continue;
		
		if (((y >= 0 && y_prev < 0) && ascending) || ((y <= 0 && y_prev > 0) && descending)) {
			ids << i;
			zeros << (x_prev - (x - x_prev)*y_prev/(y - y_prev));
		}
		x_prev = x;
		y_prev = y;
	}
}
Exemplo n.º 2
0
Arquivo: t.cpp Projeto: pedia/raidget
void ZoneAlloc::Clear()
{
	for(int i = 0; i < zsmall.GetCount(); i++)
		delete[] zsmall[i];
	for(int i = 0; i < zbig.GetCount(); i++)
		delete[] zbig[i];
	zsmall.Clear();
	zbig.Clear();
	ptr = lim = NULL;
}
Exemplo n.º 3
0
template<> void* ToluaToVector<String>(lua_State* L, int narg, void* def)
{
    if (!lua_istable(L, narg))
        return 0;

    static Vector<String> result;
    result.Clear();

    int length = lua_objlen(L, narg);
    for (int i = 1; i <= length; ++i)
    {
        lua_pushinteger(L, i);
        lua_gettable(L, narg);

        if (!lua_isstring(L, -1))
        {
            lua_pop(L, 1);
            return 0;
        }

        String string = tolua_tourho3dstring(L, -1, "");
        result.Push(string);

        lua_pop(L, 1);
    }

    return &result;
}
Exemplo n.º 4
0
bool ODBCConnection::Fetch()
{
	if(rowi >= rowcount)
		return false;
	fetchrow.Clear();
	for(int i = 0; i < info.GetCount(); i++) {
		Value v;
		switch(info[i].type) {
		case DOUBLE_V:
			v = number[number_i++];
			break;
		case INT64_V:
			v = num64[num64_i++];
			break;
		case TIME_V:
			v = time[time_i++];
			break;
		case DATE_V:
			v = date[date_i++];
			break;
		case STRING_V:
			v = text[text_i++];
			break;
		default:
			NEVER();
		}
		fetchrow.Add(v);
	}
	++rowi;
	return true;
}
Exemplo n.º 5
0
void MaxRectsBinPack::Insert(Vector<Vector2i> &rectSizes, Vector<Rectangle> &dst, FreeRectChoiceHeuristic method)
{
    dst.Clear();

    while(rectSizes.Size() > 0)
    {
        int bestScore1 = std::numeric_limits<int>::max();
        int bestScore2 = std::numeric_limits<int>::max();
        int bestRectIndex = -1;
        Rectangle bestNode;

        for(size_t i = 0; i < rectSizes.Size(); ++i)
        {
            int score1;
            int score2;
            Rectangle newNode = ScoreRect(rectSizes[i].x, rectSizes[i].y, method, score1, score2);

            if (score1 < bestScore1 || (score1 == bestScore1 && score2 < bestScore2))
            {
                bestScore1 = score1;
                bestScore2 = score2;
                bestNode = newNode;
                bestRectIndex = i;
            }
        }

        if (bestRectIndex == -1)
            return;

        PlaceRect(bestNode);
        rectSizes.Erase(rectSizes.begin() + bestRectIndex);
    }
}
int UtcDaliVectorIterate(void)
{
  tet_infoline("Testing Dali::Vector<float>::Begin");

  Vector< float > floatvector;
  DALI_TEST_EQUALS( ZERO, floatvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( ZERO, floatvector.Capacity(), TEST_LOCATION );

  floatvector.PushBack( 0.9f );
  floatvector.PushBack( 1.1f );
  floatvector.PushBack( 1.2f );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), floatvector.Count(), TEST_LOCATION );

  Vector< float >::Iterator iter = floatvector.Begin();
  int index = 0;
  for( ; iter != floatvector.End(); ++iter, ++index )
  {
    std::cout << "value " << *iter << std::endl;
    DALI_TEST_EQUALS( *iter, floatvector[ index ], TEST_LOCATION );
  }
  DALI_TEST_EQUALS( 3, index, TEST_LOCATION );

  iter = std::find( floatvector.Begin(), floatvector.End(), 1.1f );
  DALI_TEST_EQUALS( 1.1f, *iter, TEST_LOCATION );

  floatvector.Clear();
  iter = std::find( floatvector.Begin(), floatvector.End(), 1.1f );
  DALI_TEST_EQUALS( floatvector.End(), iter, TEST_LOCATION );
  END_TEST;
}
int UtcDaliVectorInt(void)
{
  tet_infoline("Testing Dali::Vector<int>");

  Vector< int > intvector;

  DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );

  intvector.PushBack( 11 );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Capacity(), TEST_LOCATION );
  DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION );

  intvector.PushBack( 99 );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(2), intvector.Capacity(), TEST_LOCATION );
  DALI_TEST_EQUALS( 99, intvector[ 1 ], TEST_LOCATION );

  intvector.PushBack( 34 );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(3), intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(6), intvector.Capacity(), TEST_LOCATION );
  DALI_TEST_EQUALS( 11, intvector[ 0 ], TEST_LOCATION );
  DALI_TEST_EQUALS( 99, intvector[ 1 ], TEST_LOCATION );
  DALI_TEST_EQUALS( 34, intvector[ 2 ], TEST_LOCATION );

  intvector.Clear();
  DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(6), intvector.Capacity(), TEST_LOCATION );
  intvector.PushBack( 123 );
  DALI_TEST_EQUALS( static_cast<Dali::VectorBase::SizeType>(1), intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( 123, intvector[ 0 ], TEST_LOCATION );
  END_TEST;
}
Exemplo n.º 8
0
void FlushCode(Vector<String>& code)
{
	while(code.GetCount() && TrimBoth(code[0]).GetCount() == 0)
		code.Remove(0);
	while(code.GetCount() && TrimBoth(code.Top()).GetCount() == 0)
		code.Drop();
	
	bool tabs = true;
	for(auto l : code)
		if(l.GetCount() && *l != '\t') {
			tabs = false;
			break;
		}
	if(tabs)
		for(auto& l : code)
			if(l.GetCount())
				l.Remove(0);
	
	if(code.GetCount() == 0)
		return;
	OUT("============= CODE");
	OUT(Join(code, "\r\n"));

	qtf << "&[s4; \1" << Join(code, "\n") << "\1&]&";
	code.Clear();
}
Exemplo n.º 9
0
void Octree::Raycast(Vector<RaycastResult>& result, const Ray& ray, unsigned short nodeFlags, float maxDistance, unsigned layerMask)
{
    PROFILE(OctreeRaycast);

    result.Clear();
    CollectNodes(result, &root, ray, nodeFlags, maxDistance, layerMask);
    Sort(result.Begin(), result.End(), CompareRaycastResults);
}
Exemplo n.º 10
0
void BuildBase::GetDefaultResourcePaths(Vector<String>& paths)
{
    paths.Clear();

    ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();

    paths.Push(AddTrailingSlash(tenv->GetCoreDataDir()));
    paths.Push(AddTrailingSlash(tenv->GetPlayerDataDir()));
}
Exemplo n.º 11
0
inline void Console::do_output (ConsoleScreenBuffer & buffer) {

    //	The strings to write
    Vector<String> write;
    //	Whether or not we must
    //	lead with a clear
    bool clear=false;

    lock.Execute([&] () mutable {

        for (auto & str : queue) {

            if (str.IsNull()) {

                //	Clear

                clear=true;

                //	Don't even bother
                //	writing out these
                //	lines, they'll just
                //	get immediately cleared
                //	anyway
                write.Clear();

            } else {

                //	A string to write

                write.EmplaceBack(
                    std::move(*str)
                );

            }

        }

        //	We've dequeued everything,
        //	clear the queue
        queue.Clear();

        //	Wake waiting threads
        wait.WakeAll();

        //	Reset event so we don't
        //	loop infinitely
        if (!ResetEvent(queued)) Raise();

    });

    //	Clear console if necessary
    if (clear) buffer.Clear();

    //	Write strings
    buffer.WriteLines(std::move(write));

}
Exemplo n.º 12
0
	virtual void Paint(Draw& w) {
		w.DrawRect(GetSize(), White());

		w.DrawRect(10, 10, 60, 80, Green());

		w.DrawLine(100, 10, 160, 80, 0, Black());
		w.DrawLine(160, 10, 100, 80, 4, Red());
		w.DrawLine(160, 40, 100, 50, PEN_DOT, Red());

		w.DrawEllipse(210, 20, 80, 60, Blue());

		w.DrawEllipse(310, 20, 80, 60, LtBlue(), 5, Red());

		w.DrawArc(RectC(410, 20, 80, 60), Point(10, 10), Point(450, 80), 3, Cyan);

		Vector<Point> p;
		p << Point(30, 110) << Point(60, 180) << Point(10, 150) << Point(70, 150);
		w.DrawPolyline(p, 4, Black);

		p.Clear();
		p << Point(130, 110) << Point(160, 180) << Point(110, 150) << Point(170, 120)
		  << Point(130, 110);
		w.DrawPolygon(p, Blue);

		p.Clear();
		p << Point(230, 110) << Point(260, 180) << Point(210, 150) << Point(270, 120)
		  << Point(230, 110);
		w.DrawPolygon(p, Cyan, 5, Magenta);

		p.Clear();
		p << Point(330, 110) << Point(360, 180) << Point(310, 150) << Point(370, 120)
		  << Point(330, 110);
		w.DrawPolygon(p, Cyan, 5, Magenta, I64(0xaa55aa55aa55aa55));

		w.DrawImage(40, 240, CtrlImg::save());
		w.DrawImage(110, 210, 80, 80, CtrlImg::save());
		w.DrawImage(240, 240, CtrlImg::save(), Blue);
		w.DrawImage(310, 210, 80, 80, CtrlImg::save(), Blue);

		w.DrawText(20, 330, "Hello world!");
		w.DrawText(120, 330, "Hello world!", Arial(15).Bold());
		w.DrawText(220, 330, "Hello world!", Roman(15).Italic(), Red);
		w.DrawText(320, 380, 400, "Hello world!", Courier(15).Underline());
	}
Exemplo n.º 13
0
void FlushLog(Vector<String>& log)
{
	if(log.GetCount() == 0)
		return;
	OUT("============ LOG");
	OUT(Join(log, "\r\n"));
	
	qtf << "[s5; \1" << Join(log, "\n") << "\1&]&";
	log.Clear();
}
Exemplo n.º 14
0
void FileSystem::ScanDir(Vector<String>& result, const String& pathName, const String& filter, unsigned flags, bool recursive) const
{
    result.Clear();

    if (CheckAccess(pathName))
    {
        String initialPath = AddTrailingSlash(pathName);
        ScanDirInternal(result, initialPath, initialPath, filter, flags, recursive);
    }
}
Exemplo n.º 15
0
void ClearDatabases()
{
  cleared_databases = true;
  for (size_t dind = 0; dind < databases.Size(); dind++) {
    const XdbInfo &info = databases[dind];
    if (info.xdb != NULL)
      delete info.xdb;
  }
  databases.Clear();
}
Exemplo n.º 16
0
bool ff::GetDirectoryContents(StringRef path, Vector<String> &dirs, Vector<String> &files, Vector<FILETIME> *fileTimes)
{
	dirs.Clear();
	files.Clear();
	if (fileTimes)
	{
		fileTimes->Clear();
	}

	String szFilter = CanonicalizePath(path, true);
	assertRetVal(szFilter.size(), false);
	AppendPathTail(szFilter, String(L"*"));

	WIN32_FIND_DATA data;
	ZeroObject(data);

	HANDLE hFind = FindFirstFileEx(szFilter.c_str(), FindExInfoStandard, &data, FindExSearchNameMatch, nullptr, 0);

	for (BOOL bDone = FALSE; !bDone && hFind != INVALID_HANDLE_VALUE; bDone = !FindNextFile(hFind, &data))
	{
		if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
		{
			files.Push(String(data.cFileName));

			if (fileTimes)
			{
				fileTimes->Push(data.ftLastWriteTime);
			}
		}
		else if (wcscmp(data.cFileName, L".") && wcscmp(data.cFileName, L".."))
		{
			dirs.Push(String(data.cFileName));
		}
	}

	if (hFind != INVALID_HANDLE_VALUE)
	{
		FindClose(hFind);
	}

	return hFind != INVALID_HANDLE_VALUE;
}
Exemplo n.º 17
0
void ODBCConnection::FetchAll()
{
	LLOG("FetchAll " << (void *)this);
	rowcount = 0;
	rowi = 0;
	number.Clear();
	num64.Clear();
	text.Clear();
	time.Clear();
	date.Clear();
	number_i = 0;
	num64_i = 0;
	text_i = 0;
	time_i = 0;
	date_i = 0;
	while(info.GetCount() && Fetch0()) {
		rowcount++;
		for(int i = 0; i < info.GetCount(); i++)
			switch(info[i].type) {
			case DOUBLE_V:
				number.Add(fetchrow[i]);
				break;
			case INT64_V:
				num64.Add(fetchrow[i]);
				break;
			case STRING_V:
				text.Add(fetchrow[i]);
				break;
			case TIME_V:
				time.Add(fetchrow[i]);
				break;
			case DATE_V:
				date.Add(fetchrow[i]);
				break;
			default:
				NEVER();
			}
	}
	LLOG("Flush fetched " << rowcount << " info count: " << info.GetCount());
}
Exemplo n.º 18
0
void BaseMesh::WeldVertices(float Epsilon, Vector<UINT> &OldToNewMapping)
{
    PointSet MyPoints;
    MyPoints.LoadFromMesh(*this);
    KDTree3 &Tree = MyPoints.KDTree();
    
    UINT VC = VertexCount(), IC = IndexCount();
    MeshVertex *V = Vertices();
    DWORD *I = Indices();

    OldToNewMapping.ReSize(VC);
    OldToNewMapping.Clear(VC);
    Vector<UINT> NNResult;
    //MeshVertex *VStorage = new MeshVertex[VC];
    
    for(UINT VertexIndex = 0; VertexIndex < VC; VertexIndex++)
    {
        Vec3f Pos = V[VertexIndex].Pos;
        Tree.WithinDistance(Pos, Epsilon, NNResult);
        bool MatchFound = false;
        //VStorage[VertexIndex] = V[VertexIndex];
        for(UINT ResultIndex = 0; ResultIndex < NNResult.Length() && !MatchFound; ResultIndex++)
        {
            UINT CurIndex = NNResult[ResultIndex];
            if(OldToNewMapping[CurIndex] != VC)
            {
                MatchFound = true;
                OldToNewMapping[VertexIndex] = CurIndex;
            }
        }
        if(!MatchFound)
        {
            OldToNewMapping[VertexIndex] = VertexIndex;
        }
    }

    //DWORD *IStorage = new DWORD[IC];
    for(UINT IndexIndex = 0; IndexIndex < IC; IndexIndex++)
    {
        I[IndexIndex] = OldToNewMapping[UINT(I[IndexIndex])];
    }

    //Allocate(
    //delete[] VStorage;
    
    Vector<UINT> SecondMapping, SplitToUnsplit = OldToNewMapping;
    CleanVerticesAndTriangles(SecondMapping);
    for(UINT VertexIndex = 0; VertexIndex < VC; VertexIndex++)
    {
        OldToNewMapping[VertexIndex] = SecondMapping[SplitToUnsplit[VertexIndex]];
    }
}
Exemplo n.º 19
0
 O3DGCErrorCode    LoadIntData(Vector<long> & data,
                               const BinaryStream & bstream,
                               unsigned long & iterator) 
 {
     bstream.ReadUInt32ASCII(iterator);
     const unsigned long size = bstream.ReadUInt32ASCII(iterator);
     data.Allocate(size);
     data.Clear();
     for(size_t i = 0; i < size; ++i)
     {
         data.PushBack(bstream.ReadIntASCII(iterator));
     }
     return O3DGC_OK;
 }
Exemplo n.º 20
0
template <> void* ToluaToVector<SharedPtr<VertexBuffer> >(lua_State* L, int narg, void* def)
{
    if (!lua_istable(L, narg))
        return nullptr;
    static Vector<SharedPtr<VertexBuffer> > result;
    result.Clear();
    result.Resize((unsigned)lua_objlen(L, narg));
    for (unsigned i = 0; i < result.Size(); ++i)
    {
        lua_rawgeti(L, narg, i + 1);    // Lua index starts from 1
        result[i] = SharedPtr<VertexBuffer>(static_cast<VertexBuffer*>(tolua_tousertype(L, -1, def)));
        lua_pop(L, 1);
    }
    return &result;
}
Exemplo n.º 21
0
template <> void* ToluaToVector<String>(lua_State* L, int narg, void* /*def*/)
{
    if (!lua_istable(L, narg))
        return 0;
    static Vector<String> result;
    result.Clear();
    result.Resize((unsigned)lua_objlen(L, narg));
    for (unsigned i = 0; i < result.Size(); ++i)
    {
        lua_rawgeti(L, narg, i + 1);
        result[i] = tolua_tourho3dstring(L, -1, "");
        lua_pop(L, 1);
    }
    return &result;
}
Exemplo n.º 22
0
void BaseMesh::CleanVerticesAndTriangles(Vector<UINT> &OldToNewMapping)
{
    UINT NumFaces = FaceCount(), NumVertices = VertexCount();
    DWORD *I = Indices();
    MeshVertex *V = Vertices();

    Vector<DWORD> NewIndices;
    Vector<MeshVertex> NewVertices;
    OldToNewMapping.ReSize(NumVertices);
    OldToNewMapping.Clear(NumVertices);
    
    for(UINT FaceIndex = 0; FaceIndex < NumFaces; FaceIndex++)
    {
        if(I[FaceIndex * 3 + 0] != I[FaceIndex * 3 + 1] &&
           I[FaceIndex * 3 + 1] != I[FaceIndex * 3 + 2] &&
           I[FaceIndex * 3 + 2] != I[FaceIndex * 3 + 0])
        {
            for(UINT i = 0; i < 3; i++)
            {
                UINT SourceIndex = I[FaceIndex * 3 + i];
                if(OldToNewMapping[SourceIndex] == NumVertices)
                {
                    OldToNewMapping[SourceIndex] = NewVertices.Length();
                    NewVertices.PushEnd(V[SourceIndex]);
                }
                NewIndices.PushEnd(OldToNewMapping[SourceIndex]);
            }
        }
    }
    Allocate(NewVertices.Length(), NewIndices.Length() / 3);
    NumFaces = FaceCount();
    NumVertices = VertexCount();
    I = Indices();
    V = Vertices();
    for(UINT VertexIndex = 0; VertexIndex < NumVertices; VertexIndex++)
    {
        V[VertexIndex] = NewVertices[VertexIndex];
    }
    for(UINT FaceIndex = 0; FaceIndex < NumFaces; FaceIndex++)
    {
        for(UINT i = 0; i < 3; i++)
        {
            I[FaceIndex * 3 + i] = NewIndices[FaceIndex * 3 + i];
        }
    }
}
int UtcDaliEmptyVectorInt(void)
{
  tet_infoline("Testing Dali::Vector<int>");

  Vector< int > intvector;

  DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );

  intvector.Clear();
  DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );

  intvector.Release();
  DALI_TEST_EQUALS( ZERO, intvector.Count(), TEST_LOCATION );
  DALI_TEST_EQUALS( ZERO, intvector.Capacity(), TEST_LOCATION );
  END_TEST;
}
Exemplo n.º 24
0
	void CurvePreview::Redraw()
	{
		if (!mCurve)
			return;

		TextureRef texture = mSprite->GetTexture();
		if (!texture || texture->GetSize() != layout->GetSize())
		{
			texture = TextureRef(layout->GetSize(), PixelFormat::R8G8B8A8, Texture::Usage::RenderTarget);
			mSprite->SetTexture(texture);
			mSprite->SetTextureSrcRect(RectI(Vec2I(), texture->GetSize()));
		}

		const Color4 backColor(120, 120, 120, 255);
		const Color4 curveColor(0, 255, 0, 255);

		Camera prevCamera = o2Render.GetCamera();
		Camera currCamera; currCamera.SetRect(mCurve->GetRect());
		currCamera.SetScale(currCamera.GetScale().InvertedY());

		o2Render.SetRenderTexture(texture);
		o2Render.SetCamera(currCamera);
		o2Render.Clear(backColor);

		static Vector<Vertex2> buffer;
		buffer.Clear();

		auto curveColorHex = curveColor.ARGB();

		auto& keys = mCurve->GetKeys();
		for (auto& key : keys)
		{
			buffer.Add(Vertex2(key.position, key.value, curveColorHex, 0, 0));

			auto points = key.GetApproximatedPoints();
			for (int i = 0; i < key.GetApproximatedPointsCount(); i++)
				buffer.Add(Vertex2(points[i], curveColorHex, 0, 0));

			o2Render.DrawAAPolyLine(buffer.Data(), buffer.Count(), 2);
		}

		o2Render.UnbindRenderTexture();
		o2Render.SetCamera(prevCamera);
	}
Exemplo n.º 25
0
DockableCtrl* DockBase::GetDockedWindowFromIndex(int index)
{
	Vector<DockableCtrl*> docks;
	docks.Clear();
	for(int i = 0; i < 8; i++)
	{
		if(i < 4) 
		{
			int n = GetPaneFrame(i).GetCount();
			if(n) for(int j = 0; j < n; j++) docks.Add(GetPaneFrame(i).GetChild(j + 1));
		}
		else
		{
			int n = GetHideBar(i - 4).GetCount();
			if(n) for(int j = 0; j < n; j++) docks.Add(GetHideBar(i - 4).GetChild(j));
		}
	}
	return docks.GetCount() ? docks.At(index) : NULL;
}
Exemplo n.º 26
0
void DockBase::NewWidgetGroup(String name, bool predefined)
{
	predefined  = true;
	TreeCtrl& tree = grouptab.grouptree;
	Vector<int> ids;
	ids.Clear();
	int group = groups.FindAdd(name, ids);
	if(tree.Find(name) < 0) tree.Add(0, DockCtrlImages::DefaultImage(), Value(name));

	if(name != t_("Default")) return; 
	for(int i = 0; i < ctrls.GetCount(); i++)
	{
		DockableCtrl * ctrl = ctrls[i]->ctrl;
		int id	= ctrls[i]->id;
		ids.Add(ctrls[i]->id);
		tree.Add(tree.Find(name), ctrl->GetIcon(), Value(id), Value(ctrl->GetLabel()));
	}
	groups[group] = ids;
}
Exemplo n.º 27
0
void IconDes::SaveUndo()
{
	if(!IsCurrent())
		return;
	Slot& c = Current();
	Vector<Image> undo = UnpackImlData(c.undo);
	int maxn = minmax((single_mode ? 4000000 : 400000) / max(c.image.GetLength(), 1), 4, 128);
	while(undo.GetCount() > maxn)
		undo.Remove(0);
	if(undo.GetCount() && undo.Top() == c.image)
		return;
	sSetSsFlag(c.image, c.supersampling);
	undo.Add(c.image);
	c.undo = PackImlData(undo);
	c.redo.Clear();
	SetBar();
	undo.Clear();
	sRemoveSsFlag(c.image);
}
Exemplo n.º 28
0
void CheckRawPickValue()
{
	Vector<int> x;
	x.Add(123);
	Value v = RawPickToValue(x);
	ASSERT(v.Is< Vector<int> >());
	const Vector<int>& xx = v.To< Vector<int> >();
	ASSERT(xx.GetCount() == 1);
	ASSERT(xx[0] == 123);

	x.Clear();
	x.Add(321);
	v = RawDeepToValue(x);
	const Vector<int>& x2 = v.To< Vector<int> >();
	ASSERT(x2.GetCount() == 1);
	ASSERT(x2[0] == 321);
	ASSERT(x.GetCount() == 1);
	ASSERT(x[0] == 321);	
}
Exemplo n.º 29
0
int RegExp::ReplaceGlobal(String& t, Callback1<Vector<String>&> cbr)
{
	String t_copy(t);
	int count=0;
	int pos_offset=0;
	int rv_count=0;
	Vector<String> rv; 
	
	first = false;
	while(GlobalMatch(t_copy)) {
		rv.Clear();
		rv=GetStrings();
		cbr(rv);
		rv_count=rv.GetCount();
		count += Replace0(t, rv, rv_count, pos_offset);	
	}
	
	return count;
	
}
Exemplo n.º 30
0
	void SelectItem()
	{
		if (!_View.IsLayout())
			return;

		if (_ItemList.IsSelected())
		{
			Vector<int> sel;
			_View.ClearSelection();
			for (int i = 0; i < _ItemList.GetRowCount(); ++i)
				if (_ItemList.IsSelected(i))
				{
					_View.AddToSelection(i);
					if (!sel.GetCount())
						sel << i;
					else if (sel.GetCount() > 0)
						sel.Clear();
				}
			OpenObjectProperties(sel);
		}
	}