Exemple #1
0
void __fastcall TObjFrm::AddCombo(int gr,int id,String Title,int vid,bool enable)
{
TGroupBox *g=SelectGroup(gr);
int h=g->Height;
TLabel *l=new TLabel(this);
l->Parent=g;
l->AutoSize=true;
l->Caption=Title;
l->Top=h+VCSP;
TComboBox *c=new TComboBox(this);
c->Parent=g;
c->Style=csDropDownList;
c->Top=h;
c->Tag=id;
Dict->TextPropByClasses(c->Items,id);
for (int i=0;i<c->Items->Count;i++)
    {
    TTextPropRec *rec=(TTextPropRec*)c->Items->Objects[i];
    if (rec->Id==vid)
        {
        c->ItemIndex=i;
        break;
        }
    }
c->Anchors=c->Anchors<<akRight;
c->OnChange=ElemChange;
c->Enabled=enable;
g->Height=h+c->Height+VERTSP;
AlignGroup(gr);
AddRef(c,id);
}
Exemple #2
0
void QueueEditor::MergeGroups(DownloadQueue* pDownloadQueue, ItemList* pItemList)
{
	if (pItemList->size() == 0)
	{
		return;
	}

	EditItem* pDestItem = pItemList->front();

	for (ItemList::iterator it = pItemList->begin() + 1; it != pItemList->end(); it++)
	{
		EditItem* pItem = *it;
		if (pItem->m_pFileInfo->GetNZBInfo() != pDestItem->m_pFileInfo->GetNZBInfo())
		{
			debug("merge %s to %s", pItem->m_pFileInfo->GetNZBInfo()->GetFilename(), pDestItem->m_pFileInfo->GetNZBInfo()->GetFilename());
			g_pQueueCoordinator->MergeQueueEntries(pDestItem->m_pFileInfo->GetNZBInfo(), pItem->m_pFileInfo->GetNZBInfo());
		}
		delete pItem;
	}

	// align group
	AlignGroup(pDownloadQueue, pDestItem->m_pFileInfo->GetNZBInfo());

	delete pDestItem;
}
Exemple #3
0
void __fastcall TObjFrm::AddCheckBox(int gr,int id,String Title,int Val,bool enable)
{
TGroupBox *g=SelectGroup(gr);
int h=g->Height;
TLabel *l=new TLabel(this);
l->Parent=g;
l->AutoSize=true;
l->Caption=Title;
l->Top=h+VCSP;
TCheckBox *c=new TCheckBox(this);
c->Parent=g;
c->Top=h;
c->Checked=Val;
c->Anchors=c->Anchors<<akRight;
c->OnClick=ElemChange;
c->Enabled=enable;

g->Height=h+c->Height+VERTSP;
AlignGroup(gr);
AddRef(c,id);
}
Exemple #4
0
void __fastcall TObjFrm::AddText(int gr,int id,String Title,String Val,bool enable)
{
TGroupBox *g=SelectGroup(gr);
int h=g->Height;
TLabel *l=new TLabel(this);
l->Parent=g;
l->AutoSize=true;
l->Caption=Title;
l->Top=h+VCSP;
TEdit *m=new TEdit(this);
m->Parent=g;
m->Top=h;
m->Text=Val;
m->Anchors=m->Anchors<<akRight;
m->OnChange=ElemChange;
m->Enabled=enable;

g->Height=h+m->Height+VERTSP;
AlignGroup(gr);
AddRef(m,id);
}
Exemple #5
0
void QueueEditor::AlignAffectedGroups(DownloadQueue* pDownloadQueue, IDList* pIDList, bool bSmartOrder, int iOffset)
{
	// Build list of all groups; List contains first file of each group
	FileList cGroupList;
	BuildGroupList(pDownloadQueue, &cGroupList);

	// Find affected groups. It includes groups being moved and groups directly
	// above or under of these groups (those order is also changed)
	FileList cAffectedGroupList;
	cAffectedGroupList.clear();
	ItemList cItemList;
	PrepareList(pDownloadQueue, &cItemList, pIDList, bSmartOrder, eaFileMoveOffset, iOffset);
	for (ItemList::iterator it = cItemList.begin(); it != cItemList.end(); it++)
	{
		EditItem* pItem = *it;
		unsigned int iNum = 0;
		for (FileList::iterator it = cGroupList.begin(); it != cGroupList.end(); it++, iNum++)
		{
			FileInfo* pFileInfo = *it;
			if (pItem->m_pFileInfo->GetNZBInfo() == pFileInfo->GetNZBInfo())
			{
				if (!ItemExists(&cAffectedGroupList, pFileInfo))
				{
					cAffectedGroupList.push_back(pFileInfo);
				}
				if (iOffset < 0)
				{
					for (int i = iNum - 1; i >= -iOffset-1; i--)
					{
						if (!ItemExists(&cAffectedGroupList, cGroupList[i]))
						{
							cAffectedGroupList.push_back(cGroupList[i]);
						}
					}
				}
				if (iOffset > 0)
				{
					for (unsigned int i = iNum + 1; i <= cGroupList.size() - iOffset; i++)
					{
						if (!ItemExists(&cAffectedGroupList, cGroupList[i]))
						{
							cAffectedGroupList.push_back(cGroupList[i]);
						}
					}

					if (iNum + 1 < cGroupList.size())
					{
						cAffectedGroupList.push_back(cGroupList[iNum + 1]);
					}
				}
				break;
			}
		}
		delete pItem;
	}
	cGroupList.clear();

	// Aligning groups
	for (FileList::iterator it = cAffectedGroupList.begin(); it != cAffectedGroupList.end(); it++)
	{
		FileInfo* pFileInfo = *it;
		AlignGroup(pDownloadQueue, pFileInfo->GetNZBInfo());
	}
}