Esempio n. 1
0
INT NextID(
    INT idType,
    NPLABEL plHead,
    INT idExclude)
{
    INT id;

    if (idType == NEXTID_CONTROL) {
        /*
         * Start at the base from the dialog plus one.  It is
         * assumed that this routine will not be called for an
         * id for a control if there is not a dialog being
         * edited first.
         */
        id = gcd.npc->id + 1;

        /*
         * Keep looping until an unused id is found.
         */
        while (!IsUniqueID(id) || FindID(id, plHead) || id == idExclude)
            id++;
    }
    else if (idType == NEXTID_DIALOG) {
        /*
         * Start at 100.
         */
        id = 100;

        /*
         * Keep looping by hundreds until an unused id is found.
         */
        while (!IsUniqueID(id) || FindID(id, plHead) || id == idExclude)
            id += 100;
    }
    else {
        /*
         * We are looking for a default id for a new label.  Start
         * at the dialog base, if there is a dialog being edited.
         */
        if (gfEditingDlg)
            id = gcd.npc->id + 1;
        else
            id = 100;

        /*
         * Keep looping until an unused id is found.  The id should
         * not be used by any control in the current dialog, any
         * other label already, or any control in the res file.
         */
        while (FindID(id, plHead) || FindIDInRes(id) || id == idExclude)
            id++;
    }

    /*
     * We found an unused one.  Return it.
     */
    return id;
}
Esempio n. 2
0
	const char * cPlugs::Name (unsigned int h) {
		if (!h) return "CORE";
		if (h<3) return _sprintf("___BC%u",h-1);
		int pos=FindID(h);
		if (pos>=0) return Plug[pos].name.c_str();
		else return _sprintf("%#.4x",h);
	}
Esempio n. 3
0
UString CPairsStorage::GetValue(const UString &id) const
{
  int pos = FindID(id);
  if (pos < 0)
    return UString();
  return Pairs[pos].Value;
}
Esempio n. 4
0
void PhoneBook::Add(_TCHAR *desc, unsigned short lp, unsigned short rp){
	PHONEBOOK *newph,*cur;

	long tmpID=1;

	while(FindID(tmpID)){
		tmpID++;
	}

	newph=new PHONEBOOK;
	newph->ID=tmpID;
	_tcsncpy(newph->url,desc,MAX_URL_SIZE-1);
	newph->url[MAX_URL_SIZE]=0;
	newph->Next=NULL;

	// tail insert
	if (Root_ == NULL){
		Root_=newph;
	}
	// add tail
	else{
		cur=Root_;
		while(cur->Next){
			cur=cur->Next;
		}
		cur->Next=newph;
	}
}
Esempio n. 5
0
int C_Font::StrWidth(long fontID,_TCHAR *Str,int len)
{
#if 0 // Replacing OLD method
	FONTLIST *cur;
	int w=0,i;
	_TCHAR c;

	cur=FindID(fontID);
	if(cur)
	{
		i=0;

		while(Str[i] && i < len)
		{
			c=Str[i];
			if(c > cur->Metrics_.tmLastChar) c=0;
			w+=cur->Widths_[c]+cur->Spacing_;
			i++;
		}
		return(w+1);
	}
	return(0);
#else // New method
	C_Fontmgr *found;

	found=Find(fontID);
	if(found)
		return(found->Width(Str,len));
	return(0);
#endif
}
Esempio n. 6
0
void C_ListBox::SetItemUserData(long ID,short idx,long value)
{
	LISTBOX *cur;

	cur=FindID(ID);
	if(cur){
		cur->Label_->SetUserNumber(idx,value);
	}
}
Esempio n. 7
0
void C_ListBox::SetItemCluster(long ID,long cluster)
{
	LISTBOX *cur;

	cur=FindID(ID);
	if(cur){
		cur->Label_->SetCluster(cluster);
	}
}
Esempio n. 8
0
void C_ListBox::SetItemGroup(long ID,long group)
{
	LISTBOX *cur;

	cur=FindID(ID);
	if(cur){
		cur->Label_->SetGroup(group);
	}
}
Esempio n. 9
0
void C_ListBox::SetItemFlags(long ID,long flags)
{
	LISTBOX *cur;

	cur=FindID(ID);
	if(cur){
		cur->Label_->SetFlags(flags & ~(C_BIT_USEBGFILL));
	}
}
Esempio n. 10
0
HFONT C_Font::GetFont(long ID)
{
	FONTLIST *cur;

	cur=FindID(ID);
	if(cur)
		return(cur->Font_);
	return(NULL);
}
Esempio n. 11
0
bool CPairsStorage::GetValue(const UString &id, UString &value) const
{
  value.Empty();
  int pos = FindID(id);
  if (pos < 0)
    return false;
  value = Pairs[pos].Value;
  return true;
}
Esempio n. 12
0
void CPairsStorage::AddPair(const CTextPair &pair)
{
  int insertPos;
  int pos = FindID(pair.ID, insertPos);
  if (pos >= 0)
    Pairs[pos] = pair;
  else
    Pairs.Insert(insertPos, pair);
}
Esempio n. 13
0
C_Button *C_ListBox::GetItem(long ID)
{
	LISTBOX *item;

	item=FindID(ID);
	if(item){
		return(item->Label_);
	}
	return(NULL);
}
Esempio n. 14
0
C_ListBox *C_ListBox::AddItem(long ID,short,_TCHAR *Str)
{
	LISTBOX *newitem,*cur;

	if(!ID) return(NULL);

	if(Str == NULL) return(NULL);

	if(!(GetFlags() & C_BIT_REMOVE)) // Using premade list ... don't add to it
		return(NULL);

	if(FindID(ID))
		return(NULL);

	newitem=new LISTBOX;
	newitem->Label_=new C_Button;
	newitem->Label_->Setup(ID,C_TYPE_RADIO,0,0);
	newitem->Label_->SetText(C_STATE_0,Str);
	newitem->Label_->SetText(C_STATE_1,Str);
	newitem->Label_->SetColor(C_STATE_0,NormalColor_);
	newitem->Label_->SetColor(C_STATE_1,SelColor_);
	newitem->Label_->SetGroup(5551212);
	newitem->Label_->SetFont(Font_);
	newitem->Label_->SetFlags((GetFlags() & ~(C_BIT_INVISIBLE|C_BIT_ABSOLUTE|C_BIT_USEBGFILL|C_BIT_REMOVE)));
	newitem->Label_->SetOwner(this);
	newitem->Label_->SetParent(Parent_);
	newitem->Next=NULL;

	if(Root_ == NULL){
		Root_=newitem;
		Count_=1;
		Root_->Label_->SetState(C_STATE_1);
		Label_->SetText(Root_->Label_->GetText(C_STATE_0));
		LabelVal_=Root_->Label_->GetID();
	}
	else {
		cur=Root_;
		while(cur->Next){
			cur=cur->Next;
		}
		cur->Next=newitem;
		Count_++;
	}
	newitem->Label_->SetXY(5,(Count_-1)*gFontList->GetHeight(Font_));
	if(Root_ && Root_->Label_ && Root_->Label_->Ready()){
		SetReady(1);
	}
	return(this);
}
Esempio n. 15
0
int C_Font::GetHeight(long ID)
{
#if 0 // Replacing OLD code
	FONTLIST *cur;

	cur=FindID(ID);
	if(cur)
		return(cur->Metrics_.tmHeight);
#else // New method
	C_Fontmgr *found;

	found=Find(ID);
	if(found)
		return(found->Height());
	found=Find(1);
	if(found)
		return(found->Height());
#endif
	return(0);
}
Esempio n. 16
0
 //
 // UniformBase
 //
 UniformBase::UniformBase( const std::string& uniformName, const ShaderProgram* uniformOwner )
 {
     name    = uniformName;
     owner   = uniformOwner;
     FindID();
 }
Esempio n. 17
0
void CPairsStorage::DeletePair(const UString &id)
{
  int pos = FindID(id);
  if (pos >= 0)
    Pairs.Delete(pos);
}
Esempio n. 18
0
int CPairsStorage::FindID(const UString &id) const
{
  int pos;
  return FindID(id, pos);
}