int CFolderJoin::AddPlayerCtrl(CGameSpyPlayer* pPlr)
{
	CLTGUIFont *pFont = GetSmallFont();
    CGroupCtrl *pGroup = CreateGroup(nPlayerGroupWidth,pFont->GetHeight(),LTNULL);
    LTIntPt pos(0,0);
    pGroup->SetParam1((uint32)pPlr);

	char sTemp[128] = "";
	strcpy(sTemp, pPlr->GetName());
    CStaticTextCtrl *pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nNameWidth,pFont->GetHeight(),LTTRUE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nNameWidth+nGap;

	sprintf(sTemp, "%i", pPlr->GetFrags());
    pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nScoreWidth,pFont->GetHeight(),LTTRUE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nScoreWidth+nGap;

	if (pPlr->GetPing() >= 9999) strcpy(sTemp, "???");
	else sprintf(sTemp,"%d",pPlr->GetPing());
    pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nPingWidth,pFont->GetHeight(),LTTRUE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);

	pGroup->Enable(LTFALSE);
	return m_pPlayerList->AddControl(pGroup);

}
Exemple #2
0
/** Parse an option group. */
void ParseGroup(const TokenNode *tp)
{

   const TokenNode *np;
   struct GroupType *group;

   Assert(tp);

   group = CreateGroup();

   for(np = tp->subnodeHead; np; np = np->next) {
      switch(np->type) {
      case TOK_CLASS:
         AddGroupClass(group, np->value);
         break;
      case TOK_NAME:
         AddGroupName(group, np->value);
         break;
      case TOK_OPTION:
         ParseGroupOption(np, group, np->value);
         break;
      default:
         InvalidTag(np, TOK_GROUP);
         break;
      }
   }

}
Exemple #3
0
void CGroupingDlg::OnAdd() 
{
	CString strValue;
	m_wndGroup.GetWindowText( strValue );
	
	strValue.TrimLeft(); strValue.TrimRight();
	if ( strValue.IsEmpty() ) return;
	
	if ( ! m_pXML ) m_pXML = new CXMLElement;
	
	if ( m_wndGroup.FindStringExact( -1, strValue ) == CB_ERR ) CreateGroup( strValue, m_pXML );
	
	int nItem = m_wndList.InsertItem( LVIF_TEXT|LVIF_PARAM,
		m_wndList.GetItemCount(), NULL, 0, 0, 0, NULL );
	
	for ( int nDeselect = m_wndList.GetNextItem( -1, LVNI_SELECTED ) ;
		nDeselect != -1 ; nDeselect = m_wndList.GetNextItem( nDeselect, LVNI_SELECTED ) )
	{
		m_wndList.SetItemState( nDeselect, 0, LVIS_SELECTED );
	}
	
	m_wndList.SetItemState( nItem, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED );
	m_wndList.EnsureVisible( nItem, TRUE );
	
	m_pHitInfo.iItem	= nItem;
	m_pHitInfo.iSubItem	= 0;
	
	m_wndList.SetFocus();
	m_wndList.EditLabel( nItem );
}
int CFolderJoin::AddServerCtrl(CGameSpyServer* pGame)
{
	CLTGUIFont *pFont = GetSmallFont();
    CGroupCtrl *pGroup = CreateGroup(nServerGroupWidth,pFont->GetHeight(),LTNULL);
    LTIntPt pos(0,0);
    pGroup->SetParam1((uint32)pGame->GetHandle());

	char sTemp[128] = "";
	sprintf(sTemp,"%s",pGame->GetName());
    CStaticTextCtrl *pCtrl = CreateStaticTextItem(sTemp,CMD_SELECT_SERVER,LTNULL,nGameWidth,pFont->GetHeight(),LTFALSE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nGameWidth+nGap;

	sprintf(sTemp,"%d/%d",pGame->GetNumPlayers(), pGame->GetMaxPlayers());
    pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nPlayerWidth,pFont->GetHeight(),LTFALSE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nPlayerWidth+nGap;

	if (pGame->GetPing() >= 9999) strcpy(sTemp, "???");
	else sprintf(sTemp,"%d",pGame->GetPing());
    pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nPingWidth,pFont->GetHeight(),LTFALSE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nPingWidth+nGap;

	sprintf(sTemp,"%s",pGame->GetGameType());
    pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nTypeWidth,pFont->GetHeight(),LTFALSE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nTypeWidth+nGap;

	sprintf(sTemp,"%s",pGame->GetMap());
    pCtrl = CreateStaticTextItem(sTemp,LTNULL,LTNULL,nMapWidth,pFont->GetHeight(),LTFALSE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);

	return m_pServerList->AddControl(pGroup);
}
Exemple #5
0
bool CNNM2ECC::addNewGroup(string svname, svutil::word & putid, string parentid)
{
	WORDLIST subglist;

	//获取所有子孙 id 
	if(parentid.find(".")==std::string::npos)
	{
		OBJECT objse= Cache_GetSVSE(parentid);
		if( objse==INVALID_VALUE )
			return false;
		SVSE *se= reinterpret_cast<SVSE *>(objse);
		if(se==NULL)
			return false;
		subglist= se->GetSubGroups();
	}
	else
	{
		OBJECT objgroup= Cache_GetGroup( parentid );
		if(objgroup==INVALID_VALUE)
			return false;
		Group* pNnmGroup = reinterpret_cast<Group *>(objgroup);
		if(pNnmGroup==NULL)
			return false;
		subglist= pNnmGroup->GetSubGroups();
	}

	//遍历子孙
	for(WORDLIST::iterator it1=subglist.begin();it1!=subglist.end();it1++)
	{
		OBJECT objgroup2= Cache_GetGroup( (*it1).getword() );
		if(objgroup2==INVALID_VALUE)
			continue;
		Group *pGroup = reinterpret_cast<Group *>(objgroup2);
		if(pGroup!=NULL)
		{
			std::string groupname = svname.c_str();
			if(groupname.compare((pGroup->GetProperty())["sv_name"])==0)
			{
				putid = pGroup->GetID();
				return true;
			}
		}
	}

	//如果没有发现需要的子孙,则新建
	OBJECT newobj= CreateGroup();
	if(newobj==INVALID_VALUE)
		return false;
	Group* pg= reinterpret_cast<Group *>(newobj);
	if(pg==NULL)
		return false;

	(pg->GetProperty())["sv_name"]= svname.c_str();
	putid = AddNewGroup(newobj,parentid);
	bool ret= SubmitGroup(newobj);
	CloseGroup( newobj );
	return ret;
}
Exemple #6
0
void DefineFlatGroup( void )
/**************************/
{
    if( ModuleInfo.flat_grp == NULL ) {
        /* can't fail because <FLAT> is a reserved word */
        ModuleInfo.flat_grp = CreateGroup( "FLAT" );
        ModuleInfo.flat_grp->sym.Ofssize = ModuleInfo.defOfssize;
        //ModuleInfo.flatgrp_idx = ModuleInfo.flat_grp->e.grpinfo->grp_idx;
    }
}
Exemple #7
0
static int ImportGroup(const char* szSettingName, LPARAM lParam)
{
    int* pnGroups = (int*)lParam;

    TCHAR* tszGroup = myGetWs(NULL, "CListGroups", szSettingName);
    if (tszGroup != NULL) {
        if ( CreateGroup( tszGroup+1, NULL ))
            pnGroups[0]++;
        mir_free(tszGroup);
    }
    return 0;
}
int CFolderJoin::AddOptionCtrl(int nID, char *pszValue)
{
	CLTGUIFont *pFont = GetSmallFont();
    CGroupCtrl *pGroup = CreateGroup(nOptionGroupWidth,pFont->GetHeight(),LTNULL);
    LTIntPt pos(0,0);

    CStaticTextCtrl *pCtrl = CreateStaticTextItem(nID,LTNULL,LTNULL,nOptionWidth,pFont->GetHeight(),LTTRUE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);
	pos.x += nOptionWidth+nGap;

    pCtrl = CreateStaticTextItem(pszValue,LTNULL,LTNULL,(nOptionGroupWidth-pos.x),pFont->GetHeight(),LTTRUE,pFont);
    pGroup->AddControl(pCtrl,pos,LTTRUE);

	return m_pOptionList->AddControl(pGroup);
}
std::wstring Group::VerifyGroup(const std::wstring& str) const
{
	std::wstring strTmp;

	std::wstring::size_type pos = str.find_first_not_of(L" \t\r\n");
	if (pos != std::wstring::npos)
	{
		// Trim white-space
		strTmp.assign(str, pos, str.find_last_not_of(L" \t\r\n") - pos + 1);

		CreateGroup(strTmp);
	}

	return strTmp;
}
void CParticleEffect::AddGroup (SParticleType *pType, int iCount)

//	AddGroup
//
//	Adds a group of particles. pType must be allocated. This
//	object takes ownership.

	{
	CreateGroup(pType, iCount, NULL);

	//	Make sure the bounds is properly set

	if (GetBounds() < pType->rRadius)
		SetBounds(pType->rRadius);
	}
Exemple #11
0
void YahooMoveCallback(MCONTACT hContact, char *unused)
{
	char protocol[128] = {0};
	GetContactProtocol(hContact, protocol, sizeof(protocol));
	
	if (mir_strlen(protocol) > 0)
	{
		char ygroup[128] = {0};
		
		if (!GetStringFromDatabase(hContact, protocol, "YGroup", NULL, ygroup, sizeof(ygroup)))
		{
			CreateGroup(ygroup);
			AddContactToGroup(hContact, ygroup);
		}
	}
}
Exemple #12
0
//测试用的函数
std::string CCheckBoxTreeView::MyAddNode(std::string name, std::string id, std::string type, std::string index)
{
	std::string strTmp = "";	
	
	OBJECT root;	
	if(type == "1")
		root = CreateGroup();
	else
		root = CreateEntity();
	
	if (root != INVALID_VALUE)
	{
		MAPNODE attr;
		if(type == "1")
			attr = GetGroupMainAttribNode(root);
		else
			attr = GetEntityMainAttribNode(root);


		bool bState = false;
		if(attr != INVALID_VALUE)
		{
			if(AddNodeAttrib(attr, "sv_id", id))
			{
				if(AddNodeAttrib(attr, "sv_type", type))
				{
					bState = AddNodeAttrib(attr, "sv_name", name);
				}
			}
		}
		
		if(bState)
		{
			if(type == "1")
				strTmp = AddNewGroup(root, index);
			else
				strTmp = AddNewEntity(root, index);
		}

		if(type == "1")
			CloseGroup(root);
		else
			CloseEntity(root);			
	}

	return strTmp;
}
void Group::InitializeGroup(const std::wstring& groups)
{
	if (wcscmp(groups.c_str(), m_OldGroups.c_str()) != 0)
	{
		m_OldGroups = groups;
		m_Groups.clear();

		if (!groups.empty())
		{
			std::vector<std::wstring> vGroups = ConfigParser::Tokenize(groups, L"|");
			for (auto iter = vGroups.begin(); iter != vGroups.end(); ++iter)
			{
				m_Groups.insert(CreateGroup(*iter));
			}
		}
	}
}
Exemple #14
0
static MCONTACT AddContact(HWND hdlgProgress, char* szProto, char* pszUniqueSetting, DBVARIANT* id, const TCHAR* pszUserID, TCHAR *nick, TCHAR *group)
{
    MCONTACT hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
    if (CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)szProto) != 0) {
        CallService(MS_DB_CONTACT_DELETE, hContact, 0);
        AddMessage(LPGENT("Failed to add %S contact %s"), szProto, pszUserID);
        return INVALID_CONTACT_ID;
    }

    mySet(hContact, szProto, pszUniqueSetting, id);

    CreateGroup(group, (MCONTACT)hContact);

    if (nick && *nick) {
        db_set_ws((MCONTACT)hContact, "CList", "MyHandle", nick);
        AddMessage(LPGENT("Added %S contact %s, '%s'"), szProto, pszUserID, nick);
    }
    else AddMessage(LPGENT("Added %S contact %s"), szProto, pszUserID);

    srcDb->FreeVariant(id);
    return hContact;
}
Exemple #15
0
EffectTechniqueGroup* IEffect::CreateDefaultGroup(bool setCurrent/*=true*/)
{
	return CreateGroup(mDefaultTechniqueGroupName,setCurrent);
}
Exemple #16
0
ret_code GrpDir( int i, struct asm_tok tokenarray[] )
/***************************************************/
{
    char        *name;
    struct dsym *grp;
    struct dsym *seg;

    /* GROUP directive must be at pos 1, needs a name at pos 0 */
    if( i != 1 ) {
        EmitErr( SYNTAX_ERROR_EX, tokenarray[i].string_ptr );
        return( ERROR );
    }
#if COFF_SUPPORT || ELF_SUPPORT
    /* GROUP valid for OMF + BIN only */
    if ( Options.output_format == OFORMAT_COFF
#if ELF_SUPPORT
        || Options.output_format == OFORMAT_ELF
#endif
       ) {
        EmitError( GROUP_DIRECTIVE_INVALID_FOR_COFF );
        return( ERROR );
    }
#endif
    grp = CreateGroup( tokenarray[0].string_ptr );
    if( grp == NULL )
        return( ERROR );

    i++; /* go past GROUP */

    do {

        /* get segment name */
        if ( tokenarray[i].token != T_ID ) {
            EmitErr( SYNTAX_ERROR_EX, tokenarray[i].string_ptr );
            return( ERROR );
        }
        name = tokenarray[i].string_ptr;
        i++;

        seg = (struct dsym *)SymSearch( name );
        if ( Parse_Pass == PASS_1 ) {
            if( seg == NULL || seg->sym.state == SYM_UNDEFINED ) {
                seg = CreateSegment( seg, name, TRUE );
                /* inherit the offset magnitude from the group */
                if ( grp->e.grpinfo->seglist )
                    seg->e.seginfo->Ofssize = grp->sym.Ofssize;
            } else if( seg->sym.state != SYM_SEG ) {
                EmitErr( SEGMENT_EXPECTED, name );
                return( ERROR );
            } else if( seg->e.seginfo->group != NULL &&
                       seg->e.seginfo->group != &grp->sym ) {
                /* segment is in another group */
                DebugMsg(("GrpDir: segment >%s< is in group >%s< already\n", name, seg->e.seginfo->group->name));
                EmitErr( SEGMENT_IN_ANOTHER_GROUP, name );
                return( ERROR );
            }
            /* the first segment will define the group's word size */
            if( grp->e.grpinfo->seglist == NULL ) {
                grp->sym.Ofssize = seg->e.seginfo->Ofssize;
            } else if ( grp->sym.Ofssize != seg->e.seginfo->Ofssize ) {
                EmitErr( GROUP_SEGMENT_SIZE_CONFLICT, grp->sym.name, seg->sym.name );
                return( ERROR );
            }
        } else {
            /* v2.04: don't check the "defined" flag. It's for IFDEF only! */
            //if( seg == NULL || seg->sym.state != SYM_SEG || seg->sym.defined == FALSE ) {
            /* v2.07: check the "segment" field instead of "defined" flag! */
            //if( seg == NULL || seg->sym.state != SYM_SEG ) {
            if( seg == NULL || seg->sym.state != SYM_SEG || seg->sym.segment == NULL ) {
                EmitErr( SEG_NOT_DEFINED, name );
                return( ERROR );
            }
        }

        /* insert segment in group if it's not there already */
        if ( seg->e.seginfo->group == NULL ) {
            struct seg_item    *si;

            /* set the segment's grp */
            seg->e.seginfo->group = &grp->sym;

            si = LclAlloc( sizeof( struct seg_item ) );
            si->seg = seg;
            si->next = NULL;
            grp->e.grpinfo->numseg++;

            /* insert the segment at the end of linked list */
            if( grp->e.grpinfo->seglist == NULL ) {
                grp->e.grpinfo->seglist = si;
            } else {
                struct seg_item *curr;
                curr = grp->e.grpinfo->seglist;
                while( curr->next != NULL ) {
                    curr = curr->next;
                }
                curr->next = si;
            }
        }

        if ( i < Token_Count ) {
            if ( tokenarray[i].token != T_COMMA || tokenarray[i+1].token == T_FINAL ) {
                EmitErr( SYNTAX_ERROR_EX, tokenarray[i].tokpos );
                return( ERROR );
            }
            i++;
        }

    } while ( i < Token_Count );

    return( NOT_ERROR );
}
Exemple #17
0
bool CGroup::BelongsToGroup(const std::wstring& group)
{
	return (m_Groups.find(CreateGroup(group)) != m_Groups.end());
}
BOOL CTestOptionsListCtrlDialog::OnInitDialog()
{
  CRhinoUiDockBarDialog::OnInitDialog();

  CRect r;
  GetClientRect( r);

  m_options_list.SetBorders( 0, 0, 0, 0 );

  if( m_options_list.CreateOptionsList(this, WS_VISIBLE | WS_CHILD, r) )
  {
    m_options_list.SetIndentItems( true );

    m_options_list.AddItem( new CRhinoUiOptionsListCtrlStaticText(L"Object type", L"unknown type") );
    m_options_list.AddItem( new CRhinoUiOptionsListCtrlEditBox(L"Name", L"*unnamed*") );
    m_pLayerItem = new CRhinoUiOptionsListCtrlLayerComboBox( L"Layer", L"Layer 01" );
    m_options_list.AddItem( m_pLayerItem );
    m_pColorItem = new CRhinoUiOptionsListCtrlColorComboBox( L"Color", L"Black" );
    m_options_list.AddItem( m_pColorItem );
    m_options_list.AddItem( new CRhinoUiOptionsListCtrlPushButton(L"Details", L"...") );
    m_options_list.AddItem( new CRhinoUiOptionsListCtrlColorButton(L"Color button", RGB(255,0,0)) );

    m_options_list.m_HasIsoCurves.SetAutoDelete( false );
    m_options_list.m_HasIsoCurves.SetCheck( BST_CHECKED );
    m_options_list.m_HasIsoCurves.SetLabel( L"Object has Isocurves" );
    m_options_list.m_HasIsoCurves.SetText( L"True" );
    m_options_list.m_HasIsoCurves.SetCheckText( L"True" );
    m_options_list.AddItem( &m_options_list.m_HasIsoCurves );

    m_options_list.m_ShowIsoCurves.SetAutoDelete( false );
    m_options_list.m_ShowIsoCurves.SetLabel( L"Isocurves" );
    m_options_list.m_ShowIsoCurves.SetText( L"Display" );
    m_options_list.m_ShowIsoCurves.SetCheckText( L"Display" );
    m_options_list.AddItem( &m_options_list.m_ShowIsoCurves );

    m_options_list.m_IsoCurveDinsity.SetAutoDelete( false );
    m_options_list.m_IsoCurveDinsity.SetLabel( L"Isocurve density" );
    m_options_list.m_IsoCurveDinsity.SetEditType( CRhinoUiEdit::et_int );
    m_options_list.m_IsoCurveDinsity.SetText( L"1" );
    m_options_list.m_IsoCurveDinsity.SetValue( 1 );
    m_options_list.m_IsoCurveDinsity.SetMin( true, 0 );
    m_options_list.m_IsoCurveDinsity.SetMax( true, 99 );
    m_options_list.m_IsoCurveDinsity.SetAllowEmpty( false );
    m_options_list.m_IsoCurveDinsity.SetNonZero( false );
    m_options_list.m_IsoCurveDinsity.SetIncludeSpinner( true );
    m_options_list.AddItem( &m_options_list.m_IsoCurveDinsity );

    m_options_list.m_PointEditBox.SetLabel( L"Point edit test" );
    m_options_list.m_PointEditBox.SetPoint( 1.0, 2.0, 3.0 );
    m_options_list.AddItem( &m_options_list.m_PointEditBox );

    m_options_list.AddItem( new CRhinoUiOptionsListCtrlSeparator(L"This is a separator") );
    
    m_options_list.m_ExpandCheckBox1.SetLabel( L"Expandable item" );
    m_options_list.m_ExpandCheckBox1.SetText( L"One" );
    m_options_list.m_ExpandCheckBox1.SetCheckText( L"One" );
    m_options_list.m_ExpandCheckBox1.SetCheck( BST_CHECKED );
    int iCheck1 = m_options_list.AddItem( &m_options_list.m_ExpandCheckBox1 );

    int iIndent = 1;
    m_options_list.m_ExpandCheckBox2.SetLabel( L"Expandable item" );
    m_options_list.m_ExpandCheckBox2.SetText( L"Two" );
    m_options_list.m_ExpandCheckBox2.SetCheckText( L"Two" );
    m_options_list.m_ExpandCheckBox2.SetIndentLevel( iIndent++ );
    m_options_list.m_ExpandCheckBox2.SetCheck( BST_CHECKED );
    m_options_list.m_ExpandCheckBox2.SetIsFullRowItem( true );
    int iCheck2 = m_options_list.AddItem( &m_options_list.m_ExpandCheckBox2 );
    m_options_list.m_ExpandCheckBox2.SetParentIndex( iCheck1 );

    m_options_list.m_ExpandCheckBox3.SetLabel( L"Expandable item" );
    m_options_list.m_ExpandCheckBox3.SetText( L"Three" );
    m_options_list.m_ExpandCheckBox3.SetCheckText( L"Three" );
    m_options_list.m_ExpandCheckBox3.SetIndentLevel( iIndent++ );
    m_options_list.m_ExpandCheckBox3.SetCheck( BST_CHECKED );
    int iCheck3 = m_options_list.AddItem( &m_options_list.m_ExpandCheckBox3 );
    m_options_list.m_ExpandCheckBox3.SetParentIndex( iCheck2 );

    m_options_list.m_ExpandCheckBox4.SetLabel( L"Expandable item" );
    m_options_list.m_ExpandCheckBox4.SetText( L"Four" );
    m_options_list.m_ExpandCheckBox4.SetCheckText( L"Four" );
    m_options_list.m_ExpandCheckBox4.SetIndentLevel( 1 );
    m_options_list.m_ExpandCheckBox4.SetCheck( BST_CHECKED );
    m_options_list.AddItem( &m_options_list.m_ExpandCheckBox4 );
    m_options_list.m_ExpandCheckBox4.SetParentIndex( iCheck1 );

    m_options_list.m_GroupCombo.SetLabel( L"Group combo" );
    m_options_list.AddItem( &m_options_list.m_GroupCombo );
    m_options_list.m_GroupCombo.SetParentIndex( iCheck1 );
    m_options_list.m_GroupCombo.SetIndentLevel( 1 );

    m_options_list.m_GroupCombo.AddGroupItem( L"No controls", NULL, 0 );
    CreateGroup( m_options_list.m_GroupCombo, L"One", &m_options_list.m_NestedGroupCombo );
    m_options_list.m_GroupCombo.SetCurGroupSel( 0 );

    int iTestFullRow = m_options_list.AddItem( new CRhinoUiOptionsListCtrlStaticText( L"label", L"Indented, full row", 1));
    if( iTestFullRow >= 0)
    {
      CRhinoUiOptionsListCtrlStaticText* pST = static_cast<CRhinoUiOptionsListCtrlStaticText*>( m_options_list.GetItem( iTestFullRow));
      if( pST)
      {
        pST->SetParentIndex( iCheck1);
        pST->SetIndentLevel( 1);
        pST->SetIsFullRowItem( true);
        int iTestFullRowSubItem = m_options_list.AddItem( new CRhinoUiOptionsListCtrlStaticText( L"label", L"full row sub item", 1));
        if( iTestFullRowSubItem >= 0)
        {
          CRhinoUiOptionsListCtrlStaticText* pSI = static_cast<CRhinoUiOptionsListCtrlStaticText*>( m_options_list.GetItem( iTestFullRowSubItem));
          if( pSI)
          {
            pSI->SetParentIndex( iTestFullRow);
            pSI->SetIndentLevel( 2);
            pSI->SetIsFullRowItem( true);
          }
        }
      }
    }

    m_options_list.ExpandItem( iCheck1, true );
    m_options_list.ExpandItem( iCheck2, true );

    int iFullRowCheck = m_options_list.AddItem( new CRhinoUiOptionsListCtrlCheckBox( L"Full row check", L"Full row check", 1));
    if( iFullRowCheck >= 0)
    {
      CRhinoUiOptionsListCtrlItem* pI = m_options_list.GetItem( iFullRowCheck );
      if( pI)
      {
        pI->SetIsFullRowItem( true );
        static_cast<CRhinoUiOptionsListCtrlCheckBox*>(pI)->SetCheckText( L"Full row check" );
      }
    }

    m_options_list.m_VerticalCheckBox.SetAutoDelete( false );
    m_options_list.m_VerticalCheckBox.SetLabel( L"Tab Alignment" );
    m_options_list.m_VerticalCheckBox.SetText( L"Top" );
    m_options_list.m_VerticalCheckBox.SetCheckText( L"Top" );
    m_options_list.m_VerticalCheckBox.SetCheck( BST_CHECKED );
    m_options_list.m_VerticalCheckBox.SetLabelBackGroundColor( RGB(200,0,0) );
    m_options_list.m_VerticalCheckBox.SetLabelTextColor( RGB(255,255,255) );
    m_options_list.m_VerticalCheckBox.SetIndentLevel( 1 );
    //m_options_list.AddItem( &m_options_list.m_VerticalCheckBox);

    m_options_list.m_HideTabCheckBox.SetAutoDelete( false );
    m_options_list.m_HideTabCheckBox.SetLabel( L"Test Tab Three" );
    m_options_list.m_HideTabCheckBox.SetText( L"Show" );
    m_options_list.m_HideTabCheckBox.SetCheckText( L"Show" );
    m_options_list.m_HideTabCheckBox.SetCheck( BST_CHECKED );
    m_options_list.m_HideTabCheckBox.SetLabelBackGroundColor( RGB(255,0,0) );
    m_options_list.m_HideTabCheckBox.SetLabelTextColor( RGB(255,255,255) );
    m_options_list.AddItem( &m_options_list.m_HideTabCheckBox );

    m_options_list.m_IPAddress.SetAutoDelete( false );
    m_options_list.m_IPAddress.SetLabel( L"Test IP Address" );
    m_options_list.m_IPAddress.SetIPAddress( MAKEIPADDRESS(255, 255, 255, 255) );
    m_options_list.m_IPAddress.SetIsReadOnly( true );
    m_options_list.m_IPAddress.SetIndentLevel( 1 );
    m_options_list.AddItem( &m_options_list.m_IPAddress );

    m_options_list.m_RadioColumn.SetLabel( L"Radio button test" );
    m_options_list.m_RadioColumn.SetAutoDelete( false );
    m_options_list.m_RadioColumn.AddRadioButton( L"One" );
    m_options_list.m_RadioColumn.AddRadioButton( L"Two" );
    m_options_list.m_RadioColumn.AddRadioButton( L"Three" );
    m_options_list.m_RadioColumn.SetSelectedButton( 1 );
    m_options_list.m_RadioColumn.SetIndentLevel( 1 );
    m_options_list.AddItem( &m_options_list.m_RadioColumn );

    m_options_list.AddItem( new CRhinoUiOptionsListCtrlColorComboBox(L"Color combo test", L"Black", 1) );
    m_options_list.AddItem( new CRhinoUiOptionsListCtrlEditBox(L"File name test", L"C:\\Temp\\3dm\\AtoZ.jpg", 1) );
    m_options_list.AddItem( new CRhinoUiOptionsListCtrlFontComboBox(L"Font combo test", L"Arial", 1) );

    m_ComboBoxItem.SetLabel( L"Combo Box test" );
    m_ComboBoxItem.SetText( L"Item 01" );
    m_ComboBoxItem.SetAutoDelete( false );
    m_ComboBoxItem.SetIndentLevel( 1 );
    m_options_list.AddItem( &m_ComboBoxItem );

    CRect rBefore;
    m_options_list.GetWindowRect( rBefore );
    m_options_list.SizeToContent( true );
    
    CRect rAfter;
    m_options_list.GetWindowRect( rAfter );
    
    CRect r;
    GetWindowRect( r );
    if( rAfter.Height() != rBefore.Height() )
      SetWindowPos( NULL, 0, 0, r.Width(), r.Height() + (rAfter.Height() - rBefore.Height()), SWP_NOZORDER|SWP_NOMOVE );

    m_Resize.Add( &m_options_list, CRhinoUiDialogItemResizer::resize_lockall );
  }

  return TRUE;
}
Exemple #19
0
GroupServer::UserStatus GroupServer::UserAlive(
        const char *userName, const char *userPassword,
        const IpEndpointName& privateEndpoint,
		const IpEndpointName& publicEndpoint,
        const char **groupNamesAndPasswords,
        UserStatus *userGroupsStatus, int groupCount )
{
    // find or create the user, aborting if the password for an existing
    // user is incorrect, or if the maximum number of users has been reached

    User *user = FindUser( userName );
    if( user ){
        if( user->password.compare( userPassword ) != 0 ){
            Log() << "attempt to update user '"
                    << userName << "' with incorrect password." << std::endl;
            return USER_STATUS_WRONG_PASSWORD;
        }
    }else{
        if( userCount_ == maxUsers_ ){
            Log() << "user limit reached, user '"
                    << userName << "' not admitted." << std::endl;
            return USER_STATUS_SERVER_LIMIT_REACHED;
        }else{
            user = CreateUser( userName, userPassword );
        }
    }

    UpdateEndpoint(
            user->privateEndpoint, privateEndpoint, userName, "private" );
    UpdateEndpoint( user->publicEndpoint, publicEndpoint, userName, "public" );

    user->lastAliveMessageArrivalTime = time(0);


    // previousButNotCurrentGroups begins containing all the groups the user
    // was in before the current message was received. We remove those which
    // the user is still a member of, leaving the set that the user is no
    // longer a member of. We then use the set to remove associations with
    // non-current groups.

    std::set<Group*> previousButNotCurrentGroups( user->groups_ );

    for( int i=0; i < groupCount; ++i ){
        const char *groupName = groupNamesAndPasswords[i*2];
        const char *groupPassword = groupNamesAndPasswords[i*2 + 1];

        Group *group = FindGroup( groupName );
        if( group ){
            if( user->IsMemberOf( group ) ){
                // check that previousButNotCurrentGroups contains group before
                // removing it. it won't if we were passed the same group
                // multiple times
                std::set<Group*>::iterator j =
                        previousButNotCurrentGroups.find( group );
                if( j != previousButNotCurrentGroups.end() )
                    previousButNotCurrentGroups.erase( j );

                userGroupsStatus[i] = USER_STATUS_OK;
            }else{
                // user isn't in group so join it
                if( group->password.compare( groupPassword ) == 0 ){
                    AssociateUserWithGroup( user, group );
                    userGroupsStatus[i] = USER_STATUS_OK;
                }else{                                   
                    userGroupsStatus[i] = USER_STATUS_WRONG_PASSWORD;
                }
            }
        }else{  // group doesn't exist
            if( groupCount_ == maxGroups_ ){
                Log() << "group limit reached, group '"
                        << groupName << "' not created." << std::endl;
                userGroupsStatus[i] = USER_STATUS_SERVER_LIMIT_REACHED;
            }else{
                group = CreateGroup( groupName, groupPassword );
                AssociateUserWithGroup( user, group );
                userGroupsStatus[i] = USER_STATUS_OK;
            }
        }
    }

    for( std::set<Group*>::iterator j = previousButNotCurrentGroups.begin();
            j != previousButNotCurrentGroups.end(); ++j ){

        SeparateUserFromGroup( user, *j );
    }

    return USER_STATUS_OK;
}