示例#1
0
/**
 * Adds a new child surface for the state to take care of,
 * giving it the game's display palette. Once associated,
 * the state handles all of the surface's behaviour
 * and management automatically.
 * @param surface Child surface.
 * @note Since visible elements can overlap one another,
 * they have to be added in ascending Z-Order to be blitted
 * correctly onto the screen.
 */
void State::add(Surface *surface)
{
	// Set palette
	surface->setPalette(_game->getScreen()->getPalette());

	// Set default fonts
	Text *t = dynamic_cast<Text*>(surface);
	TextButton *tb = dynamic_cast<TextButton*>(surface);
	TextEdit *te = dynamic_cast<TextEdit*>(surface);
	TextList *tl = dynamic_cast<TextList*>(surface);
	if (t)
	{
		t->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}
	else if (tb)
	{
		tb->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}
	else if (te)
	{
		te->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}
	else if (tl)
	{
		tl->setFonts(_game->getResourcePack()->getFont("BIGLETS.DAT"), _game->getResourcePack()->getFont("SMALLSET.DAT"));
	}

	_surfaces.push_back(surface);
}
示例#2
0
/**
 * switch all the colours to something a little more battlescape appropriate.
 */
void State::applyBattlescapeTheme()
{
	for (std::vector<Surface*>::iterator i = _surfaces.begin(); i != _surfaces.end(); ++i)
	{
		Window* window = dynamic_cast<Window*>(*i);
		if (window)
		{
			window->setColor(Palette::blockOffset(0)-1);
			window->setHighContrast(true);
			window->setBackground(_game->getResourcePack()->getSurface("TAC00.SCR"));
		}
		Text* text = dynamic_cast<Text*>(*i);
		if (text)
		{
			text->setColor(Palette::blockOffset(0)-1);
			text->setHighContrast(true);
		}
		TextButton* button = dynamic_cast<TextButton*>(*i);
		if (button)
		{
			button->setColor(Palette::blockOffset(0)-1);
			button->setHighContrast(true);
		}
		TextEdit* edit = dynamic_cast<TextEdit*>(*i);
		if (edit)
		{
			edit->setColor(Palette::blockOffset(0)-1);
			edit->setHighContrast(true);
		}
		TextList* list = dynamic_cast<TextList*>(*i);
		if (list)
		{
			list->setColor(Palette::blockOffset(0)-1);
			list->setArrowColor(Palette::blockOffset(0));
			list->setHighContrast(true);
		}
		ArrowButton *arrow = dynamic_cast<ArrowButton*>(*i);
		if (arrow)
		{
			arrow->setColor(Palette::blockOffset(0));
		}
		Slider *slider = dynamic_cast<Slider*>(*i);
		if (slider)
		{
			slider->setColor(Palette::blockOffset(0)-1);
			slider->setHighContrast(true);
		}
	}
}
示例#3
0
    void PerformanceTest(const char* Caption, TextList& Text, int MaxText, int MaxLines, int AverageLine, int MaxOffset, int Loops)
    {
        Assert(Text.Init(MaxText, MaxLines));

        DWORD StartTicks = GetTickCount();
        for (int i = 0; i < Loops; ++i)
        {
            int Deleted;
            int Size = AverageLine + (rand() % (2 * MaxOffset)) - MaxOffset;
            FillLine(i, Size);
            Assert(Text.AddLine(m_Buffer, Deleted));
            //Assert(m_Text.IsValid());
        }
        DWORD EndTicks = GetTickCount();
        LogEvent(LE_INFOHIGH, "%s: Loops %d, Ticks %d", Caption, Loops, EndTicks - StartTicks);
    }
示例#4
0
void StyleOptDialog::RefreshFontInfo()
{
	int count = pList->count();
	int cur = fontList.GetCurrent();
	
	const char *s = "";
	if (count>=0 && cur>=0 && cur<count)
	{
		int n = fontList.GetCurrentInt();
		if (pList->get(n).newFont.ptr())
			s = pList->get(n).newFont->printable_name();
		else
		if (pList->get(n).oldFont)
			s = pList->get(n).oldFont->printable_name();
	}
		
	fontNameStatic.SetText(utf8_to_unicode(s).ptr());
}
示例#5
0
const char *CfgLangDialog::GetId()
{ 
	int n = _list.GetCurrent();
	if (n <= 0 ) return "+";
	if (n == 1) return "-";
	n-=2;
	if (n >= nodeList->count()) return "+";
	return nodeList->get(n).id.ptr();
}
void MissionSelectDelegate::onNewContentControl(Control *, Control *newGui)
{
   CMDConsole* console = CMDConsole::getLocked();
   char buf[256];
   edit = (FearGui::TestEdit *)(newGui->findControlWithTag(IDCTG_SESSION));
   if(edit)
   {
      const char *var = console->getVariable("Server::Session");
      if(!var[0])
      {
         strcpy(buf, "FearSession");
         DWORD type;
         DWORD len = 255;
         RegQuery(
            HKEY_LOCAL_MACHINE,
            "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon\\DefaultDomainName",
            &type,
            (unsigned char *)buf,
            &len);
      }
      else
         strcpy(buf, var);

      edit->setText(buf);
   }

   TextList *tl = (TextList *)(newGui->findControlWithTag(IDCTG_MISSION_SELECT_LIST));
   if (! tl) return;

   WIN32_FIND_DATA data;
   HANDLE handle = FindFirstFile(MissionNameTemplate, &data);

   if (handle != INVALID_HANDLE_VALUE)
   {
      do
      {
         data.cFileName[strlen(data.cFileName) - 4] = '\0';
         tl->addEntryBack(data.cFileName);
      }
      while (FindNextFile(handle,&data));
      FindClose(handle);
   }
}
DWORD MissionSelectDelegate::onMessage(SimObject *sender, DWORD msg)
{
   char buf[256];
   if(edit)
   {
     	CMDConsole* console = CMDConsole::getLocked();
      edit->getText(buf);
     	console->setVariable("Client::Session", buf);
     	console->setVariable("Server::Session", buf);
   }
   if(msg == IDCTG_MISSION_SELECT_LIST)
   {
     	CMDConsole* console = CMDConsole::getLocked();
      TextList *tl = (TextList *)(sender);
      sprintf(buf, "SERVER %s;startup", tl->getSelectedText());
      console->evaluate(buf, false);
      return 0;
   }
   return Parent::onMessage(sender, msg);
}
示例#8
0
/**
 * Adds a new child surface for the state to take care of,
 * giving it the game's display palette. Once associated,
 * the state handles all of the surface's behaviour
 * and management automatically.
 * @param surface Child surface.
 * @note Since visible elements can overlap one another,
 * they have to be added in ascending Z-Order to be blitted
 * correctly onto the screen.
 */
void State::add(Surface *surface)
{
	// Set palette
	surface->setPalette(_game->getScreen()->getPalette());

	// Set default fonts
	Text *t = dynamic_cast<Text*>(surface);
	TextButton *tb = dynamic_cast<TextButton*>(surface);
	TextEdit *te = dynamic_cast<TextEdit*>(surface);
	TextList *tl = dynamic_cast<TextList*>(surface);
	WarningMessage *wm = dynamic_cast<WarningMessage*>(surface);
	BaseView *bv = dynamic_cast<BaseView*>(surface);
	if (t)
	{
		t->setFonts(_game->getResourcePack()->getFont("Big.fnt"), _game->getResourcePack()->getFont("Small.fnt"));
	}
	else if (tb)
	{
		tb->setFonts(_game->getResourcePack()->getFont("Big.fnt"), _game->getResourcePack()->getFont("Small.fnt"));
	}
	else if (te)
	{
		te->setFonts(_game->getResourcePack()->getFont("Big.fnt"), _game->getResourcePack()->getFont("Small.fnt"));
	}
	else if (tl)
	{
		tl->setFonts(_game->getResourcePack()->getFont("Big.fnt"), _game->getResourcePack()->getFont("Small.fnt"));
	}
	else if (bv)
	{
		bv->setFonts(_game->getResourcePack()->getFont("Big.fnt"), _game->getResourcePack()->getFont("Small.fnt"));
	}
	else if (wm)
	{
		wm->setFonts(_game->getResourcePack()->getFont("Big.fnt"), _game->getResourcePack()->getFont("Small.fnt"));
	}

	_surfaces.push_back(surface);
}
示例#9
0
	CfgLangDialog(NCDialogParent *parent, char *id, ccollect<LangListNode> *nl)
	:	NCDialog(createDialogAsChild, 0, parent, utf8_to_unicode( _LT("Language") ).ptr(), bListOkCancel), 
		_selected(0),
		_list(Win::WT_CHILD,Win::WH_TABFOCUS|WH_CLICKFOCUS, 0, this, VListWin::SINGLE_SELECT, VListWin::BORDER_3D, 0),
		nodeList(nl)
		
	{ 
		_list.Append( utf8_to_unicode( _LT("Autodetect") ).ptr()); //0
		_list.Append( utf8_to_unicode( _LT("English") ).ptr()); //1
		
		for (int i = 0; i<nl->count(); i++)
			_list.Append( utf8_to_unicode(nl->get(i).name.ptr()).ptr() );
			
		int cur = 0;
		if (id[0] == '+') cur = 0;
		else if (id[0] == '-') cur = 1;
		else {
			for (int i = 0; i<nl->count(); i++)
				if (!strcmp(id, nl->get(i).id.ptr()))
				{
					cur = i+2;
					break;
				}
		}
		_list.MoveCurrent(cur);
		
		_list.Enable();
		_list.Show();
		_list.SetFocus();
		LSRange h(10, 1000, 10);
		LSRange w(50, 1000, 30);
		_list.SetHeightRange(h); //in characters
		_list.SetWidthRange(w); //in characters
		
		AddWin(&_list);
		SetEnterCmd(CMD_OK);
		SetPosition();
	};
示例#10
0
//----------------------------------------------------------------------------
const char *Plugin::consoleCallback(CMDConsole *, int id,int argc,const char *argv[])
{
   if (!manager) return "False";

   switch(id)
   {   
      case GuiGetValue:
      case GuiGetVisible:
      case GuiGetActive:
      case GuiGetText:
      case GuiPerformClick:
      case TextListClear:
         if(argc != 2)
            Console->printf("%s(control);", argv[0]);
         else
         {
            Control *ctrl = findControl(argv[1]);
            if(!ctrl)
            {
               return "";
            }
            switch(id)
            {
               case GuiPerformClick:
               {
                  Event ev;
                  ev.time = GetTickCount();
                  ev.ptMouse = ctrl->localToGlobalCoord(Point2I(0,0));
                  ev.modifier = 0;
                  ev.mouseDownCount = 1;
                  ctrl->onMouseDown(ev);
                  return "";
               }
               case GuiGetValue:
                  return ctrl->getScriptValue();
               case GuiGetVisible:
                  return ctrl->isVisible() ? "True" : "False";
               case GuiGetActive: {
                  ActiveCtrl *c = dynamic_cast<ActiveCtrl*>(ctrl);
                  if(c)
                     return c->active ? "True" : "False";
                  else
                     return "False";
               }
               case GuiGetText: {
                  SimpleText *c = dynamic_cast<SimpleText*>(ctrl);
                  if(c)
                     return c->getText();
                  else
                     return "";
               }
               case TextListClear: {
                  TextList *c = dynamic_cast<TextList*>(ctrl);
                  if(c)
                     c->clear();
                  return "True";
               }
            }
         }
      case GuiSetValue:
      case GuiSetVisible:
      case GuiSetActive:
      case GuiSetText:
      case TextListAdd:
         if (argc != 3)
            Console->printf("%s(control, value);", argv[0]);
         else
         {
            Control *ctrl = findControl(argv[1]);
            if(!ctrl)
            {
               return "";
            }
            switch(id)
            {
               case GuiSetValue:
                  ctrl->setScriptValue(argv[2]);
                  break;
               case GuiSetVisible:
                  ctrl->setVisible(CMDConsole::getBool(argv[2]));
                  ctrl->setUpdate();
                  break;
               case GuiSetActive: {
                  ActiveCtrl *c = dynamic_cast<ActiveCtrl*>(ctrl);
                  if(c)
                  {
                     c->active = CMDConsole::getBool(argv[2]);
                     c->setUpdate();
                  }
                  break;
               }
               case GuiSetText: {
                  SimpleText *c = dynamic_cast<SimpleText*>(ctrl);
                  if(c)
                  {
                     c->setText(argv[2]);
                     c->setUpdate();
                  }
                  break;
               }
               case TextListAdd: {
                  TextList *c = dynamic_cast<TextList*>(ctrl);
                  if(c)
                  {
                     c->addEntryBack(argv[2]);
                     c->setUpdate();
                  }
                  break;
               }
            }
            return "True";
         }
         return "False";
   }

   Control *ctrl, *newCtrl = NULL, *newCtrlParent = NULL;
   EditControl *ectrl = NULL;
   Persistent::Base::Error err;
   Canvas *canvas = NULL;
   Canvas *root;
   SimObject *obj;
   bool argBool = FALSE;

   if(argc >= 2)
   {
      if((obj=manager->findObject(argv[1])) != NULL)
         canvas = dynamic_cast<Canvas *>(obj);
      if(!canvas)
      {
         console->printf("%s: %s is not a valid SimGui::Canvas", argv[0], argv[1]);
         return "False";
      }
      root = canvas;
      ectrl = dynamic_cast<EditControl*>(root->getMouseLockedControl());
   }
   // check the arguments here...

   switch(id)
   {
      case GuiSendToBack:
      case GuiBringToFront:
         if (argc != 2)
         {
            console->printf("%s: canvasName", argv[0]);
            return "False";
         }
         if(!ectrl)
         {
            console->printf("%s: must be in edit mode", argv[0]);
            return "False";
         }
         break;
      case SetCCursor:
         if (argc != 3)
         {
            console->printf("%s: console bitmap", argv[0]);
            return "False";
         }
         break;
      case IsCursorOn:
      case CursorOn:
      case CursorOff:
      case WindowsMouseEnable:
      case WindowsMouseDisable:

#ifdef WINKEYBOARD 
      case WindowsKeyboardEnable:
      case WindowsKeyboardDisable:
#endif
         if(argc != 2)
         {
            console->printf("%s: canvasName", argv[0]);
            return "False";
         }
         break;
      case SendRootMessage:
      case GuiJustify:
      case GuiPopDialog:
         if(argc != 3)
         {
            console->printf("%s: simCanvas int", argv[0]);
            return "False";
         }
         break;
      case SaveSelection:
         if(!ectrl)
         {
            console->printf("%s: must be in edit mode", argv[0]);
            return "False";
         }
         // fall through
      case LoadSelection:
      case LoadContent:
      case SaveContent:
      case GuiPushDialog:
         if(argc != 3)
         {
            console->printf("%s: simCanvas filename", argv[0]);
            return "False";
         }
         break;
         
      case SetCurrentAddSet:
         if (argc != 3)
         {
            console->printf("%s: simCanvas objectID", argv[0]);
            return "False";
         }
         newCtrlParent = dynamic_cast<Control *>(manager->findObject(argv[2]));
         
         break;
         
      case SetSelection:
         if (argc < 3)
         {
            console->printf("%s: simCanvas objectID <inclusive T or F>", argv[0]);
            return "False";
         }
         ctrl = dynamic_cast<Control *>(manager->findObject(argv[2]));
         
         if (argc == 4)
         {
            if (! stricmp(argv[3], "TRUE")) argBool = TRUE;
            else argBool = FALSE;
         }
         break;
         
      case EditNewControl:
      case NewContent:
         if(argc != 3)
         {
            console->printf("%s: simCanvas classname", argv[0]);
            return "False";
         }
         obj = (SimObject *) Persistent::AbstractTaggedClass::create(argv[2]);
         if(obj)
         {
            newCtrl = dynamic_cast<Control *>(obj);
            if(!newCtrl)
            {
               delete obj;
               console->printf("%s: %s is not a control class", argv[0], argv[2]);
               return "False";
            }
         }
         else
         {
            console->printf("%s: %s is not a valid class name", argv[0], argv[2]);
            return "False";
         }
         break;
      case GuiInspect:
         if(argc < 2 || argc > 3)
         {
            console->printf("%s: simCanvas [simTagDictionary]", argv[0]);
            return "False";
         }
         break;
      case EditMode:
      case GuiToolbar:
         if(argc != 2)
         {
            console->printf("%s: simCanvas", argv[0]);
            return "False";
         }
         break;
   }

   // all arguments checked
   
	switch(id) 
	{
      case SetCCursor:
         {
         // kinda hacky
         Resource<GFXBitmap> curs = SimResource::get(manager)->load(argv[2], true);
         if ((bool)curs)
		      canvas->setCursor( curs );
         else
				console->printf("%s: canvas bitmap", argv[0]);
         return "False";
         }
      case IsCursorOn:
         return(canvas->isCursorON() ? "True" : "False");
      case CursorOn:
      case CursorOff:
         canvas->setCursorON(id == CursorOn);   
         return "False";
      case WindowsMouseEnable:
         canvas->setUseWindowsMouseEvents(true);
         return "False";
      case WindowsMouseDisable:
         canvas->setUseWindowsMouseEvents(false);
         return "False";

#ifdef WINKEYBOARD
      case WindowsKeyboardEnable:
         canvas->setUseWindowsKeyboardEvents(true);
         return "False";
      case WindowsKeyboardDisable:
         canvas->setUseWindowsKeyboardEvents(false);
         return "False";
#endif

      case SendRootMessage:
         root->onMessage(NULL, atoi(argv[2]));
         return "False";
      case GuiToolbar:
         {
         SimObject *tb = manager->findObject("GuiEditBar");
         if (tb)
         {
            console->printf("GuiToolbar is already running");
            return "False";
         }

         // load up the toolbar art volume
         SimVolume* vol = new SimVolume;
         manager->addObject(vol);

	      if ( !vol->open("guiToolbar.vol")) 
			{
            manager->deleteObject(vol);
            console->printf("Could not load guiToolbar.vol");
            console->printf("copy it from phoenix/data into your exe directory");
            return "False";   
         }

			SimResource::find(manager)->addObject(vol);

         // remember root
         console->evaluate(avar("$SimGui::TBRoot = %s;", argv[1]), false); 
            
         // setup the toolbar
         console->evaluate(avar("newToolWindow(GuiEditBar, %s);", argv[1]), false); 
         console->evaluate("exec(\"guiTBSetup.cs\");", false);
         return "False";
         }
      case GuiJustify:
         {
            int just = atoi(argv[2]);
            if(just < 0 || just > 6)
            {
               console->printf("%s: justification must be 0-6", argv[0]);
               break;
            }
            ectrl->justifySelection((EditControl::Justification) just);
         }
         break;
      case GuiSendToBack:
         ectrl->sendToBack();
         break;
      case GuiBringToFront:
         ectrl->bringToFront();
         break;
      case GuiInspect:
         if(argc != 2 && argc != 3)
         {
            console->printf("GuiInspect: simCanvas [simTagDictionary]");
            break;
         }
         InspectWindow *gi;
         gi = dynamic_cast<InspectWindow *>(manager->findObject("guiInspector"));
         if (gi)
         {
            console->printf("Gui Inspector is already running");
            break;
         }
         RECT winrect;
         winrect.left = 50;
         winrect.top = 50;

         POINT cursorPos;
         if ( GetCursorPos(&cursorPos) )
         {
            winrect.left = cursorPos.x;
            winrect.top = cursorPos.y;
         }

         winrect.right = winrect.left + 30;
         winrect.bottom = winrect.top + 30;
         
         GWWindow *parent;
         parent = canvas;

         SimTagDictionary *std;
         std = NULL;
         if (argc == 3)
         {
            std = dynamic_cast<SimTagDictionary*>(manager->findObject(argv[2]));
         }
      
         gi = new InspectWindow(parent, "Gui Inspector", winrect, std);
         if (gi)
            manager->addObject(gi,"guiInspector");
         
         return (0);
      case GuiPopDialog:
         canvas->handleDLGClose(atoi(argv[2]));
         break;
      case GuiPushDialog:
         canvas->handleDLGMessage(argv[2], 0);
         break;
      case SaveSelection:
         ectrl->saveSelection(argv[2]);
         break;
      case LoadSelection:
         ectrl->loadSelection(argv[2]);
         break;
      case SaveContent:
         ctrl = root->getContentControl();
         if(!ctrl)
         {
            console->printf("No content control on root: %s", argv[1]);
            break;
         }
         err = ctrl->fileStore(argv[2]);
         if (err != Persistent::Base::Ok)
            console->printf("Error saving content control to file: %s", argv[2]);
         break;
      case LoadContent:
         if(root->inEditMode())
            root->editMode(0);

         root->handleGUIMessage(argv[2]);
         break;
      case NewContent:
         if(root->inEditMode())
            root->editMode(0);
         Control *prev;
         prev = root->getContentControl();

         manager->addObject(newCtrl);
         root->setContentControl(newCtrl, NULL);
         if(prev && prev->deleteOnLoseContent())
            prev->deleteObject();
         return 0;
         
      case SetCurrentAddSet:
         if (newCtrlParent)
         {
            if(!root->getContentControl())
            {
               console->printf("GuiSetAddSet: no content control for %s", argv[1]);
               return 0;
            }
            if(!root->inEditMode())
               root->editMode(1);
               
            ectrl = dynamic_cast<EditControl*>(root->getMouseLockedControl());
            if (ectrl) ectrl->setCurrentAddSet(newCtrlParent);
         }
         return 0;
         
      case SetSelection:
      if (ctrl)
      {
         if (!root->getContentControl())
         {
            console->printf("GuiSetSelection: no content control for %s", argv[1]);
            return 0;
         }
         if (!root->inEditMode())
         {
            root->editMode(1);
         }
            
         ectrl = dynamic_cast<EditControl*>(root->getMouseLockedControl());
         if (ectrl) ectrl->setSelection(ctrl, argBool);
      }
      return 0;
         
      case EditNewControl:
         if(!root->getContentControl())
         {
            console->printf("GuiEditNewControl: no content control for %s", argv[1]);
            return 0;
         }
         if(!root->inEditMode())
            root->editMode(1);

         ectrl = dynamic_cast<EditControl*>(root->getMouseLockedControl());
         manager->addObject(newCtrl);
         ectrl->addNewControl(newCtrl);
         return 0;
      case EditMode:
         if(root->inEditMode())
            root->editMode(0);
         else
            root->editMode(1);
         break;
	}
	return 0;
}
示例#11
0
bool StyleOptDialog::Command(int id, int subId, Win *win, void *data)
{
	
	if (win == &fontList)
	{
		RefreshFontInfo();
		return true;
	}
#ifdef _WIN32
	if (id == CMD_CHFONT)
	{
		int count = pList->count();
		int cur = fontList.GetCurrent();
	
		if (count<=0 || cur<0 || cur>=count) return true;

		LOGFONT lf;
		carray<char> *pUri = pList->get(fontList.GetCurrentInt()).pUri;
		cfont::UriToLogFont(&lf, pUri && pUri->ptr() ?  pUri->ptr() : 0);

		CHOOSEFONT cf;
		memset(&cf,0,sizeof(cf));
		cf.lStructSize = sizeof(cf);
		cf.hwndOwner = GetID();
		cf.lpLogFont = &lf;
		cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT ;

		if (pList->get(fontList.GetCurrentInt()).fixed)
			cf.Flags |= CF_FIXEDPITCHONLY;


		if (ChooseFont(&cf))
		{
			cptr<cfont> p = new cfont(cfont::LogFontToUru(lf).ptr());
			if (p.ptr()) {
				pList->get(fontList.GetCurrentInt()).newFont = p;
				RefreshFontInfo();
			}
		}

		return true;
	}

#else
	if (id == CMD_CHFONT)
	{
		int count = pList->count();
		int cur = fontList.GetCurrent();
	
		if (count<=0 || cur<0 || cur>=count) return true;
		
		carray<char> *pUri = pList->get(fontList.GetCurrentInt()).pUri;
		
		cptr<cfont> p = SelectFTFont((NCDialogParent*)Parent(), pList->get(fontList.GetCurrentInt()).fixed, (pUri && pUri->ptr()) ? pUri->ptr() : 0 );
		if (p.ptr()) {
			pList->get(fontList.GetCurrentInt()).newFont = p;
			RefreshFontInfo();
		}
		
		return true;
	}
	
	if (id == CMD_CHFONTX11)
	{
		int count = pList->count();
		int cur = fontList.GetCurrent();
	
		if (count<=0 || cur<0 || cur>=count) return true;

		cptr<cfont> p = SelectX11Font((NCDialogParent*)Parent(), pList->get(fontList.GetCurrentInt()).fixed);
		if (p.ptr()) {
			pList->get(fontList.GetCurrentInt()).newFont = p;
			RefreshFontInfo();
		}
		
		return true;
	}
#endif
	
	return NCVertDialog::Command(id, subId, win, data);
}