void GroupOptionsPanel::OnRemoveGroup( wxCommandEvent& /*unused*/ )
{
  if (m_current_group == _T("Default")) return;
  useractions().DeleteGroup( m_current_group );
  ReloadGroupsList();
  ShowGroup(wxEmptyString);
}
Example #2
0
void CUpdateDlg::OnUpdate() 
{
	GetDlgItem (ID_UPDATE)->EnableWindow (FALSE);
	ShowGroup (TRUE);	
	_UpdateMgr.Update (IsDlgButtonChecked (IDC_FULLDISTRIB) == BST_CHECKED);	
	m_wndProgress.SetPos (0);
}
Example #3
0
void CUpdateDlg::CheckForUpdate()
{
	_UpdateMgr.CheckForUpdate (m_bCheckingByUser);
	GetDlgItem (ID_UPDATE)->EnableWindow (FALSE);
	GetDlgItem (IDC_DESC)->EnableWindow (FALSE);

	ShowGroup (TRUE);
}
void GroupOptionsPanel::OnGroupListSelectionChange( wxCommandEvent& /*unused*/ )
{
  wxString newgroup = m_group_list->GetStringSelection();
  wxSortedArrayString groupnames = useractions().GetGroupNames();
  if ( groupnames.Index(newgroup) == wxNOT_FOUND ) {
    return;
  }
  ShowGroup(newgroup);
}
void CSecureRuleDlg::OnSelChangeRuleType()
{
	UpdateData();

	ShowGroup( &m_wndGroupNetwork, m_nType == CSecureRule::srAddress );
	ShowGroup( &m_wndGroupContent, m_nType == CSecureRule::srContent );

	switch ( m_nType )
	{
	case CSecureRule::srAddress:
		m_wndIP1.SetFocus();
		m_wndIP1.SetSel( 0, -1 );
		break;
	case CSecureRule::srContent:
		m_wndContent.SetFocus();
		break;
	}
}
void GroupOptionsPanel::OnAddNewGroup( wxCommandEvent& /*unused*/ )
{
  wxTextEntryDialog* ted = new wxTextEntryDialog(this, _("Name of new group:"), _("Add New Group"));
  if ( ted->ShowModal() == wxID_OK ) {
    wxString newgroup = ted->GetValue();
    //!TODO: Check if group exists already.
    if ( newgroup != wxEmptyString ) useractions().AddGroup( newgroup );
    ReloadGroupsList();
    ShowGroup(newgroup);
  }
  delete ted;
}
Example #7
0
void CUpdateDlg::ShowUpdateInfo()
{
	GetDlgItem (ID_UPDATE)->EnableWindow ();
	GetDlgItem (IDC_DESC)->EnableWindow ();

	CString str;
	str.Format (LS (L_VERAVAIL), _UpdateMgr.GetVersion (), _UpdateMgr.GetBuildNumber ());
	m_wndMsg.SetWindowText (str);

	ShowGroup (FALSE);

	str.Format (LS (L_FULLDISTR),  _UpdateMgr.GetVersion (), _UpdateMgr.GetFullSize ());
	SetDlgItemText (IDC_FULLDISTRIB, str);

	LPCSTR pszUpgSize = _UpdateMgr.GetUpgSize ();
	
	
	if (*pszUpgSize == 0)
	{
		

		str.Format (LS (L_UPGTOVER), _UpdateMgr.GetVersion ());
		SetDlgItemText (IDC_UPGDISTRIB, str);
		
		GetDlgItem (IDC_UPGDISTRIB)->EnableWindow (FALSE);
		CheckRadioButton (IDC_FULLDISTRIB, IDC_UPGDISTRIB, IDC_FULLDISTRIB);
	}
	else
	{
		str.Format (LS (L_UPGTOVER2), _UpdateMgr.GetVersion (), pszUpgSize);
		SetDlgItemText (IDC_UPGDISTRIB, str);
		CheckRadioButton (IDC_FULLDISTRIB, IDC_UPGDISTRIB, IDC_UPGDISTRIB);
	}

	ShowWindow (SW_SHOW);
	SetFocus ();
}
void GroupOptionsPanel::Initialize()
{
  m_user_dialog = 0;
  ReloadGroupsList();
  ShowGroup( wxEmptyString );
}
Example #9
0
BOOL CMDOlcSet::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    OlcManager* omanager = world->GetOlcManager();
    OlcGroup* group = NULL;
    IOlcEntry* entry = NULL;
    VNUM vnum = 0;
    size_t dotpos = 0;
    std::string component;
    Component* ocomponent = NULL;
    ComponentMeta* meta = NULL;
    std::vector<std::string>::iterator it;
    std::string name;
    std::string value;

    union
    {
        Room* r;
        StaticObject* o;
        Npc* n;
    } o;
    o.o = NULL;

    if (args.size() == 0)
        {
            mobile->Message(MSG_ERROR, "Syntax: "+verb+" <vnum>[.component] [field] [value].");
            return false;
        }

//we see if there was a component attached to the object number.
    dotpos = args[0].find('.');
    if(dotpos == std::string::npos) //no component iidentifier found
        {
            if (subcmd == COS_ROOM && args[0]  == "here")
                {
                    vnum = mobile->GetLocation()->GetOnum();
                }
            else
                {
                    try
                        {
                            vnum = (VNUM)boost::lexical_cast<unsigned int>(args[0]);
                        }
                    catch (boost::bad_lexical_cast e)
                        {
                            mobile->Message(MSG_ERROR, "Invalid vnum.");
                            return false;
                        }
                }
        }
    else //there was a component attached.
        {
            if (subcmd == COS_ROOM && args[0].substr(0,dotpos) == "here")
                {
                    vnum = mobile->GetLocation()->GetOnum();
                }
            else
                {
                    try
                        {
                            vnum = boost::lexical_cast<unsigned int>(args[0].substr(0, dotpos));
                        }
                    catch (boost::bad_lexical_cast e)
                        {
                            mobile->Message(MSG_ERROR, "Invalid vnum.");
                            return false;
                        }
                }
            component = args[0].erase(0, dotpos + 1);
        }
    if (vnum < 1)
        {
            mobile->Message(MSG_ERROR, "Invalid vnum.");
            return false;
        }

//now we need to get the object we're actually editing.
    switch(subcmd)
        {
        case COS_OBJECT:
            o.o = world->GetVirtual(vnum);
            if (!component.length())
                {
                    group = omanager->GetGroup(OLCGROUP::STATIC);
                    if (!group)
                        {
                            mobile->Message(MSG_ERROR, "That group does not exist.");
                            return false;
                        }
                    break;
                }
            else
                {
                    ocomponent = o.o->GetComponent(component);
                    if (!ocomponent)
                        {
                            mobile->Message(MSG_ERROR, "That component does not exist.");
                            return false;
                        }
                    meta = ocomponent->GetMeta();
                    if (!meta)
                        {
                            mobile->Message(MSG_ERROR, "That component does not have a meta attached.");
                            return false;
                        }
                    if (meta->GetOlcGroup() == OLCGROUP::NONE)
                        {
                            mobile->Message(MSG_ERROR, "There is no olc attached to that component.");
                            return false;
                        }
                    group = omanager->GetGroup(meta->GetOlcGroup());
                    if (!group)
                        {
                            mobile->Message(MSG_ERROR, "That group does not exist.");
                            return false;
                        }
                }
            break;
        case COS_ROOM:
            o.r = world->GetRoom(vnum);
            if (!component.length())
                {
                    group = omanager->GetGroup(OLCGROUP::ROOM);
                    if (!group)
                        {
                            mobile->Message(MSG_ERROR, "That group does not exist.");
                            return false;
                        }
                    break;
                }
            else
                {
                    ocomponent = o.r->GetComponent(component);
                    if (!ocomponent)
                        {
                            mobile->Message(MSG_ERROR, "That component does not exist.");
                            return false;
                        }
                    meta = ocomponent->GetMeta();
                    if (!meta)
                        {
                            mobile->Message(MSG_ERROR, "That component does not have a meta attached.");
                            return false;
                        }
                    if (meta->GetOlcGroup() == OLCGROUP::NONE)
                        {
                            mobile->Message(MSG_ERROR, "There is no olc attached to that component.");
                            return false;
                        }
                    group = omanager->GetGroup(meta->GetOlcGroup());
                    if (!group)
                        {
                            mobile->Message(MSG_ERROR, "That group does not exist.");
                            return false;
                        }
                }
            break;
        case COS_MOB:
            o.n = world->GetNpc(vnum);
            if (!component.length())
                {
                    group = omanager->GetGroup(OLCGROUP::NPC);
                    if (!group)
                        {
                            mobile->Message(MSG_ERROR, "That group does not exist.");
                            return false;
                        }
                    break;
                }
            else
                {
                    ocomponent = o.n->GetComponent(component);
                    if (!ocomponent)
                        {
                            mobile->Message(MSG_ERROR, "That component does not exist.");
                            return false;
                        }
                    meta = ocomponent->GetMeta();
                    if (!meta)
                        {
                            mobile->Message(MSG_ERROR, "That component does not have a meta attached.");
                            return false;
                        }
                    if (meta->GetOlcGroup() == OLCGROUP::NONE)
                        {
                            mobile->Message(MSG_ERROR, "There is no olc attached to that component.");
                            return false;
                        }
                    group = omanager->GetGroup(meta->GetOlcGroup());
                    if (!group)
                        {
                            mobile->Message(MSG_ERROR, "That group does not exist.");
                            return false;
                        }
                }
            break;
        }

    if (!o.o)
        {
            mobile->Message(MSG_ERROR, "That vnum does not exist.");
            return false;
        }

    if (args.size() == 1) //we only have an object or object.component, show entries.
        {
            ShowGroup(mobile, group);
            return true;
        }
    name = args[1];
    entry = group->GetEntry(name);

    if (args.size() <= 2 && entry && entry->GetInputType() != OLCDT::EDITOR)
        {
            mobile->Message(MSG_ERROR, "Syntax: "+verb+" <vnum> <field");
            return false;
        }

    if (entry->RequiresInput())
        {
            it = args.begin();
            advance(it, 2);
            value = Explode(args, it);
        }
    else
        {
            value.clear();
        }

    switch(subcmd)
        {
        case COS_OBJECT:
        {
            if (entry->HandleInput(mobile, o.o, value))
                {
                    mobile->Message(MSG_INFO, "ok.");
                }
            else
                {
                    mobile->Message(MSG_ERROR, "Invalid input.");
                }
            break;
        }
        case COS_ROOM:
        {
            if (entry->HandleInput(mobile, o.r, value))
                {
                    mobile->Message(MSG_INFO, "ok.");
                }
            else
                {
                    mobile->Message(MSG_ERROR, "Invalid input.");
                }
            break;
        }
        case COS_MOB:
        {
            if (entry->HandleInput(mobile, o.n, value))
                {
                    mobile->Message(MSG_INFO, "ok.");
                }
            else
                {
                    mobile->Message(MSG_ERROR, "Invalid input.");
                }
            break;
        }
        }

    return true;
}
Example #10
0
void    key_GetGroups(void)
{
  if (bKey == bKEY_ENTER)
  {
    if (enKeyboard == KBD_ENTER)
    {
      enKeyboard = KBD_INPUT2;

      ShowHi(szGroups); 
      Group();
    }

    else if (enKeyboard == KBD_INPUT2)
    {
      enKeyboard = KBD_POSTENTER;   
        
      ibX = 0;
      ShowGroupNumber();

      ibY = 0;                
      ShowGroup();
    }
    else if (enKeyboard == KBD_POSTINPUT2)
    {
      if ((ibX = GetCharLo(10,11)-1) < bGROUPS)
      {
        enKeyboard = KBD_POSTENTER;   
        ShowGroupNumber();

        ibY = 0;                
        ShowGroup();
      }
      else Beep();
    }
    else if (enKeyboard == KBD_POSTENTER)
    {  
      if (++ibY >= GetGroupsSize(ibX))
        ibY = 0;
      ShowGroup();
    }
  }


  else if (bKey < 10)
  {
    if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT2;
      ShiftLo(10,11);
    }
  }


  else if (bKey == bKEY_POINT)
  {
    if (enKeyboard == KBD_POSTENTER)  
    {
      if (++ibX >= bGROUPS)
        ibX = 0;

      ShowGroupNumber();

      ibY = 0;                
      ShowGroup();
    }
    else Beep();
  }
}
Example #11
0
void    key_SetGroups(void)
{
  if (bKey == bKEY_ENTER)
  {    
    if (enKeyboard == KBD_ENTER)        
    {                                   // первое нажатие кнопки '¬вод'
      enKeyboard = KBD_INPUT2;          // подготовка к вводу номера группы
      ShowHi(szGroups); 
      Group();

      boSetGroups = true;
      SaveCache(&chSetGroups);
    }
    else if (enKeyboard == KBD_INPUT2)  // номер группы не введЄн
    {                                   // начинаем с первой группы
      enKeyboard = KBD_POSTINPUT3;      
      ibX = 0;                          // индекс группы
      ShowGroupNumber();  
    }
    else if (enKeyboard == KBD_POSTINPUT2)
    {                                   
      if ((ibX = GetCharLo(10,11)-1) < bGROUPS)
      {                                 // получили индекс группы
        enKeyboard = KBD_POSTINPUT3;
        ShowGroupNumber();
      } 
      else Beep();
    }    
    else if (enKeyboard == KBD_POSTINPUT1)              
    {                                   // запись данных после ввода
      if ((noT.ibCanal = GetCharLo(6,8)-1) < bCANALS)
      {
        enKeyboard = KBD_POSTENTER;     

        if (szLo[4] == '-')
          noT.ibCanal |= 0x80;

        if (AddNode() == 1)             // добавление узла в группу
        {                               // нет такого узла
          if (++ibY == bCANALS)      // если группа заполнена полностью
          {
            enKeyboard = KBD_SHOW;      // переходим в режим просмотра
            ibY = 0;
          }
        }
        else Beep();                    // есть такой узел
      }
      else Beep();
    }                                                                
    else if (enKeyboard == KBD_SHOW)
    {                                   // продолжаем просмотр
      ibY++;                            // переходим на следующий узел
      if (ibY == GetGroupsSize(ibX))    // дошли до последнего узла
      {                                 
        if (GetGroupsSize(ibX) == bCANALS) 
          ibY = 0;                      // если полный список - продолжаем просмотр с начала
        else 
          enKeyboard = KBD_POSTENTER;   // иначе ввод нового узла
      }
    }


    if (enKeyboard == KBD_POSTINPUT3)
    {
      // при перепрограммировании разрешаетс¤ редактировать незаданные группы
      if ((enGlobal == GLB_REPROGRAM) && (mpfUsedGroups[ibX] == true))
      {
        Error();
        LongBeep();
        return;
      }
    }


    if ((enKeyboard == KBD_POSTINPUT3) || (enKeyboard == KBD_INPUT1))
    {                                   // начинаем просмотр группы с начала
      ibY = 0;                          // переход на первый узел
      if (GetGroupsSize(ibX) == 0) 
        enKeyboard = KBD_POSTENTER;     // если группа пуста¤ - режим ввода
      else                  
        enKeyboard = KBD_SHOW;          // есть группа не пуста¤ - режим просмотра
    }


    if (enKeyboard == KBD_POSTENTER)    // неповредственно подготовка ввода
    {
      enKeyboard = KBD_INPUT1; 
      ShowLo(szMaskGroups);
    }
    else if (enKeyboard == KBD_SHOW)    // непосредственно просмотр
      ShowGroup();     
  }


  else if (bKey < 10)
  {
    if ((enKeyboard == KBD_INPUT2) || (enKeyboard == KBD_POSTINPUT2))
    {
      enKeyboard = KBD_POSTINPUT2;
      ShiftLo(10,11);
    }
    else 
    if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1))
    {
      enKeyboard = KBD_POSTINPUT1;
      ShiftLo(6,8);
    }
  }


  else if (bKey == bKEY_MINUS)
  {    
    if (enKeyboard == KBD_SHOW)         
    {                                   // в режиме просмотра
      DelNode();                        // удалить узел из группы
      LongBeep();

      if (GetGroupsSize(ibX) == 0)
      {
        enKeyboard = KBD_INPUT1; 
        ShowLo(szMaskGroups);
      }
      else ShowGroup();
    }
 

    else if ((enKeyboard == KBD_INPUT1) || (enKeyboard == KBD_POSTINPUT1)) 
    {                                   // в режиме ввода
      if (szLo[4] == '-')               // изменить знак узла на противоположный
        szLo[4] = '+';
      else
        szLo[4] = '-';
    } 
    else Beep();
  }


  else if (bKey == bKEY_POINT)
  {
    if ((enKeyboard == KBD_POSTENTER) || 
        (enKeyboard == KBD_INPUT1)    || (enKeyboard == KBD_SHOW))
    {
      if (++ibX >= bGROUPS)
        ibX = 0;

      ShowGroupNumber();
      ibY = 0;                

      if (GetGroupsSize(ibX) == 0) 
      {
        enKeyboard = KBD_INPUT1;        // если группа пуста¤ - режим ввода
        ShowLo(szMaskGroups);
      }
      else                  
      {
        enKeyboard = KBD_SHOW;          // есть группа не пуста¤ - режим просмотра
        ShowGroup();
      }
    }
    else Beep();
  }
}