示例#1
0
  FTC::FTC(const FTCParams& params)
    : _defaultColor(params.defaultColor)
    , _format(params.format)
    , Width(0)
    , Height(0)
    , _x(0)
    , _y(0)
    , _persistant(params.persistant)
    , _align(kHorizontalAlignment_Left)
  {
    if (params.font == nullptr)
    {
      _font = GGame.FindFont(params.fontName, params.fontSize);
    }
    else
    {
      _font = params.font;
    }

    _subParams.color = _defaultColor;
    _subParams.font = _font;
    _subParams.fontName = params.fontName;
    _subParams.fontSize = params.fontSize;
    _subParams.persistant = _persistant;
    _subParams.text = "";

    Rebuild();
    _preloaded = true;
  }
示例#2
0
void DeckDataWrapper::save(string filepath, bool useExpandedCardNames, string &deckTitle, string &deckDesc)
{
    if (parent)
    {
        Rebuild(parent);
        parent->save(filepath, useExpandedCardNames, deckTitle, deckDesc);
    }
}
示例#3
0
void DeckDataWrapper::save()
{
    if (parent)
    {
        Rebuild(parent);
        parent->save();
    }
}
示例#4
0
void CSmartFieldListBox::Fields(CStdMacroServer* pMacroServer, CMacroList* pMacros /*=NULL*/, CWordArray* pInUse /*=NULL*/)
{
	m_pMacroServer = pMacroServer;
	m_pMacros = (pMacros == NULL) ? &pMacroServer->MacroList() : pMacros;
	m_pInUse = pInUse;

	Rebuild();
}
示例#5
0
文件: Terrain.cpp 项目: lcs2/carpg
//=================================================================================================
void Terrain::Make(bool smooth)
{
	assert(state != 0);
	if(state == 1)
		Build(smooth);
	else
		Rebuild(smooth);
}
示例#6
0
void EventDispatcher::Unregister(UserTable* pTab)
{
  FDUT_MAP::iterator it = m_maps.find(pTab->GetInotify()->GetDescriptor());
  if (it != m_maps.end()) {
    m_maps.erase(it);
    Rebuild();
  }
}
示例#7
0
/**
* @brief Rebuild binary tree by given preorder and inorder.
*
* @param pPreOrder given preorder.
* @param pInOrder given inorder.
* @param nTreeLen given order length.
* @param pRoot output binary tree root.
*/
void Rebuild(const char* pPreOrder, 
	const char* pInOrder, 
	int nTreeLen, Node** pRoot) {
	*pRoot = NULL;
	if (NULL == pPreOrder 
		|| 0 == strlen(pPreOrder)
		|| NULL == pInOrder 
		|| 0 == strlen(pInOrder)
		|| nTreeLen != (int)strlen(pPreOrder) 
		|| nTreeLen != (int)strlen(pInOrder) ) {
		return;
	}
	char curroot = pPreOrder[0];
	// find leftInOrder and rightInOrder
	NewCharArray(leftInOrder, nTreeLen);
	NewCharArray(rightInOrder, nTreeLen);
	int i = 0, j = 0, n_leftlen = 0;
	while (i < nTreeLen && pInOrder[i] != curroot) {
		leftInOrder[j++] = pInOrder[i++];
	}
	if (i >= nTreeLen) {
		return;
	}
	n_leftlen = j;
	*pRoot = GenerateNewNode(pInOrder[i]);
	i ++, j = 0;
	while (i < nTreeLen && '\0' != pInOrder[i]) {
		rightInOrder[j++] = pInOrder[i++];
	}
	// find leftPreOrder and rightPreOrder
	NewCharArray(leftPreOrder, nTreeLen);
	NewCharArray(rightPreOrder, nTreeLen);
	memcpy(leftPreOrder, pPreOrder + 1, n_leftlen);
	memcpy(rightPreOrder, pPreOrder + 1 + n_leftlen, strlen(rightInOrder));
	if ('\0' != leftPreOrder) {
		Rebuild(leftPreOrder, leftInOrder, (int)strlen(leftPreOrder), 
			&((*pRoot)->lChild));
	}
	if ('\0' != rightPreOrder) {
		Rebuild(rightPreOrder, rightInOrder, (int)strlen(rightPreOrder), 
			&((*pRoot)->rChild));
	}
	free(leftInOrder), free(rightInOrder);
	free(leftPreOrder), free(rightPreOrder);
}
void
CMLocalVarsDir::Update()
{
	if ((itsLink->HasCore() || itsLink->ProgramIsStopped()) &&
		itsNeedsUpdateFlag)
		{
		Rebuild();
		}
}
示例#9
0
	void SetTargetted(bool targetted)
	{
		if (m_targetted == targetted)
			return;

		m_targetted = targetted;

		if (!UpdateColor())
			Rebuild();
	}
示例#10
0
void LineEdges::Update(const leda::nb::RatPolyMesh& mesh, const std::vector<M::Vector3>& fpos) {
    for(unsigned i = 0; i < _edges.size(); ++i) {
        Edge& edge = _edges[i];
        edge.p0 = fpos[edge.v0->id()];
        edge.p1 = fpos[edge.v1->id()];
        edge.color0 = mesh.color_of(edge.pe);
        edge.color1 = mesh.color_of(mesh.reversal(edge.pe));
    }
    Rebuild(_edges);
}
//---------------------------------------------------------------------------
// Description: Build a route connecting the last two cities selected with
//              [Ctrl] + [LeftClick]
int Civilization::BuildRoad(City *Dest)
{
 if(CityBuildingRoad != Dest)
  {
   Roads->Add( new Route(CityBuildingRoad,Dest,VirtualTerrain) );
   CityBuildingRoad = NULL;
  }

 Rebuild(VirtualCiv,1.0);
 return 1;
}
示例#12
0
void HashTable<T>::RemoveData(unsigned int _index)
{
    MarkNotUsed( _index );
    Rebuild();
    

    //
    // Find the data at the end of the "chain" and put it into this slot
    // Eg imagine this array : chris 
    //                         bob
    //                         charlie
    //                         null
    // In this case if we delete "bob" we want to move "charlie" into its place.
    // This is so that indexing of charlie still works.
    // Note: You can only move an entry back if doing so would improve the entries
    // collisions.  Eg assume charlie is already in its prime
    // hash spot and you remove Bob - in this case you cannot move charlie back.
    // More Notes: This still doesn't work properly.  
    // Once you have moved the "chain end" entry up to the removed slot, you then need
    // to see if any other entries can be moved into the "chain ends" slot.
    

    /*
        int endOfChainIndex = -1;
        int nextIndex = _index+1;
        nextIndex &= m_mask;

        while( m_keys[nextIndex] )
        {     
            int thisHashValue = HashFunc(m_keys[nextIndex]);
            int currentCollisionCount = (nextIndex - thisHashValue + m_size) & m_mask;
            int newCollisionCount = (_index - thisHashValue + m_size) & m_mask;

            if( newCollisionCount >= currentCollisionCount ) 
            {
                // Moving this entry back to _index would make things worse
                break;
            }

            endOfChainIndex = nextIndex;
            nextIndex++;
            nextIndex &= m_mask;
        }

        if( endOfChainIndex != -1 )
        {
            m_keys[_index] = m_keys[endOfChainIndex];
            m_data[_index] = m_data[endOfChainIndex];

            m_keys[endOfChainIndex] = NULL;
            m_data[endOfChainIndex] = NULL;
        }*/

}
示例#13
0
	bool SetColor(DWORD color)
	{
		if (color != m_color)
		{
			m_color = color;
			Rebuild();
			return true;
		}

		return false;
	}
//---------------------------------------------------------------------------
// Description: Highlights the routes with the heigher pheromone intesity
//              starting from the Nest. If the Food source is not reached
//              after a given number of tries, stop the search and draw the
//              result.
bool __fastcall Civilization::FindMainRoads(int Ntries, TImage *ImageBox, const int RWidth, const float Scale)
{
 // Start from the Anthill...
 City *CurrentCity = Nest;
 TList *MainRoads = new TList();

 while(CurrentCity!=FoodSourceCity && Ntries>0)
  {

     int PheroLevel = -MAXINT;
     Route *CurrentRoad = NULL;
     City* NextCity;
     Route* thisRoad;
     // the following loop select the best road acording to the pheromone level
     for(int j=0; j<Roads->Count; j++)
      {
       thisRoad = (Route*)Roads->Items[j];
       // if the road has a conection with the current city...
       NextCity = thisRoad->GetConection(CurrentCity);

       // Test the highest Pheromone level among the possible roads...

       // if 'thisRoad' was not used before...
       if(NextCity!=NULL && MainRoads->IndexOf(thisRoad)==-1)
        {
         if(thisRoad->GetPheromone() > PheroLevel)
          {
           CurrentRoad = thisRoad;
           PheroLevel = thisRoad->GetPheromone();
          }
        }
      }
     // Go to next city using the selected road...
     if(CurrentCity!=NULL && CurrentRoad!=NULL)
      {
       CurrentCity = CurrentRoad->GetConection(CurrentCity);
       MainRoads->Add(CurrentRoad);
      }
    Ntries--;
  }

 // Draw the MainRoad
 Rebuild(ImageBox,Scale);
  // Draw all the roads
 for(int i=0; i<MainRoads->Count; i++)
  {
   ImageBox->Canvas->Pen->Width = RWidth;
   ((Route*)MainRoads->Items[i])->DrawRoad(ImageBox,clRed,Scale);
   ImageBox->Canvas->Pen->Width = 1;
  }

 return (Ntries>0)?true:false;
}
示例#15
0
CoreTexture::CoreTexture(
  JSContext* cx,
  JS::Heap<JS::Value>* _path,
  int _width,
  int _height,
  bool _cube) :
    width(_width),
    height(_height),
    cube(_cube) {
  path = _path;
  Rebuild(cx);
}
示例#16
0
bool
Hud::Flush()
{
    if (!_visible) {
        _vboSource.clear();
        return false;
    }

    if (_requiresRebuildStatic)
        Rebuild(_windowWidth, _windowHeight);

    return true;
}
void SFlipbookTimelineTrack::Construct(const FArguments& InArgs, TSharedPtr<FUICommandList> InCommandList)
{
	CommandList = InCommandList;
	SlateUnitsPerFrame = InArgs._SlateUnitsPerFrame;
	FlipbookBeingEdited = InArgs._FlipbookBeingEdited;
	OnSelectionChanged = InArgs._OnSelectionChanged;

	ChildSlot
	[
		SAssignNew(MainBoxPtr, SHorizontalBox)
	];

	Rebuild();
}
示例#18
0
void ProjectExplorerWindow::SetFilterFlags(unsigned int filterFlags)
{
    if (m_filterFlags != filterFlags)
    {
        
        m_filterFlags = filterFlags;
        
        // Because rebuilding the tree can take a few milliseconds which prevents
        // the message pump from dispatching paint events, we get less flickering
        // if we update the button image after rebuilding the tree.
        Rebuild();
        UpdateFilterButtonImage();

    }
}
示例#19
0
void ProjectExplorerWindow::SetFontColorSettings(const FontColorSettings& settings)
{
  SetBackgroundColour(settings.GetColors(FontColorSettings::DisplayItem_Window).backColor);
  m_tree->SetBackgroundColour(settings.GetColors(FontColorSettings::DisplayItem_Window).backColor);

  m_searchBox->SetBackgroundColour(settings.GetColors(FontColorSettings::DisplayItem_Window).backColor);
  m_searchBox->SetDefaultStyle(wxTextAttr(settings.GetColors(FontColorSettings::DisplayItem_Window).foreColor));

  m_infoBox->SetFontColorSettings(settings);

  m_itemColor = settings.GetColors(FontColorSettings::DisplayItem_WindowMargin).foreColor;
  m_itemSelectBackground = settings.GetColors(FontColorSettings::DisplayItem_WindowMargin).backColor;

  Rebuild();
}
示例#20
0
void
EditorTextView::MessageReceived(BMessage *message)
{
	switch (message->what) {
		case M_VIEW_SELECTED: {
			if (fEditorWindow->fLastEditing == M_DRAW_TAB) {
				Rebuild();
			}
			
			fEditorWindow->fLastEditing = M_SOURCE_TAB;
			fEditorWindow->Settings()->SetTo(this);
		} break;
		default: BTextView::MessageReceived(message);
	}
}
示例#21
0
/* This function is called on a regular basis */
void PlaylistManager::Update()
{
    i_update_counter++;

    /* If the playlist isn't show there's no need to update it */
    if( !IsShown() ) return;

    if( this->b_need_update )
    {
        this->b_need_update = VLC_FALSE;
        Rebuild( VLC_TRUE );
    }

    /* Updating the playing status every 0.5s is enough */
    if( i_update_counter % 5 ) return;
}
示例#22
0
void CustomDataEditor::InputVariableName(ETHEntity* pEntity, EditorBase *pEditor)
{
	VideoPtr video = pEditor->GetVideoHandler();
	const Vector2 v2Pos = video->GetScreenSizeF()/2.0f - Vector2(m_inVariableName.GetWidth()/2.0f, 0.0f);

	if (m_inVariableName.IsActive())
	{
		DrawInputFieldRect(v2Pos, &m_inVariableName, pEditor, GS_L("Enter variable name"));
		m_inVariableName.PlaceInput(v2Pos);

		str_type::stringstream ss;
		ss << ETHCustomDataManager::GetDataName(m_cdesState);
		pEditor->ShadowPrint(v2Pos-Vector2(0.0f,m_inVariableName.GetSize()), ss.str().c_str(),
			GS_L("Verdana14_shadow.fnt"), gs2d::constant::BLACK);

		// if it has just been unactivated
		if (!m_inVariableName.IsActive())
		{
			if (m_inVariableName.GetValue() != GS_L(""))
			{
				switch (m_cdesState)
				{
				case CDES_ADDING_INT:
					pEntity->SetInt(m_inVariableName.GetValue(), 0);
					break;
				case CDES_ADDING_UINT:
					pEntity->SetUInt(m_inVariableName.GetValue(), 0);
					break;
				case CDES_ADDING_FLOAT:
					pEntity->SetFloat(m_inVariableName.GetValue(), 0.0f);
					break;
				case CDES_ADDING_STRING:
					pEntity->SetString(m_inVariableName.GetValue(), GS_L("none"));
					break;
				default:
					break;
				}
				Rebuild(pEntity, pEditor);
			}
			m_cdesState = CDES_IDLE;
		}
	}
}
void EditablePagedLevel::SelectPageByPoint( const core::position2df& point )
{
#ifdef USE_INVOKER
    if (NeedInvoke())
    {
        BeginInvoke(std::bind(&EditablePagedLevel::SelectPageByPoint, this, point));
    }
    else
#endif
    {
        size_t index = GetPageIndexByPoint( point );

        if (index != m_ActivePageIndx && index < m_PageList.size())
        {
            m_ActivePageIndx = index;

            Rebuild(false);
        }
    }
}
示例#24
0
void StatFormBase::Build()
{
	StartWin();
	LoadGeneralInfo();
	while(1)
	{
		Rebuild();
		signal(SIGALRM, TimeBreak);
		alarm(m_iInterval);
		int Key = getch();
		alarm(0);
		if (Key == 27)
		{
		  return;
		}
		switch (Key)
		{
			//键入回车
			case '\n':
			case '\r':
			  break;
			case KEY_UP:
				m_iSelectedRow--;
			  break;
			case KEY_DOWN:
				m_iSelectedRow++;
			  break;
			case KEY_LEFT:
				m_iSelectedRow -= LINE_SIZE;
				m_iStartRow -= LINE_SIZE;
			  break;
			case KEY_RIGHT:
				m_iSelectedRow += LINE_SIZE;
				m_iStartRow += LINE_SIZE;
				break;
			default	:
			  break;
		}
	}

}
示例#25
0
bool LatexPreviewWindow::Create(wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style)
{
////@begin LatexPreviewWindow creation
    wxFrame::Create( parent, id, caption, pos, size, style );

    CreateControls();
    SetIcon(GetIconResource(wxT("icon1.xpm")));
    if (GetSizer())
    {
        GetSizer()->SetSizeHints(this);
    }
    Centre();
////@end LatexPreviewWindow creation

    ConfigData data;
    LoadConfig(data);

    if (data.file_type == filetype::gif)
        m_filetype = filetype::gif;
    else
        m_filetype = filetype::png;
    m_transparent = data.transparent;
    m_autorender = data.autorender;

    m_control_template->ChangeValue(data.texplate);

    m_control_input->SetFocus();
    m_control_input->ChangeValue(data.textro);

    if (data.select_start < 0)
        data.select_start = std::max(0, (int) m_control_input->GetLastPosition() + data.select_start);
    if (data.select_end < 0)
        data.select_end = std::max(data.select_start, (int) m_control_input->GetLastPosition() + data.select_end);
    m_control_input->SetSelection(data.select_start, data.select_end);

    SetSize(data.width, data.height);
    Rebuild();
    m_resize_frame = true;

    return true;
}
示例#26
0
PagePalette::PagePalette(QWidget* parent) : ScDockPalette(parent, "PagePalette", 0)
{
	m_scMW = (ScribusMainWindow*) parent;
	m_view = 0;

	setObjectName(QString::fromLocal8Bit("PagePalette"));

	QStackedWidget* stackedWidget = new QStackedWidget(this);
	stackedWidget->setObjectName(QString::fromLocal8Bit("stackedWidget"));

	PagePalette_Pages* pageWidget = new PagePalette_Pages(stackedWidget);
	pageWidget->setObjectName(QString::fromLocal8Bit("PagePalette_Pages"));
	stackedWidget->addWidget(pageWidget);

	setWidget(stackedWidget);

	connect(pageWidget, SIGNAL(gotoMasterPage(QString)), m_scMW, SLOT(editMasterPagesStart(QString)));
	
	Rebuild();
	languageChange();
}
示例#27
0
void ProjectExplorerWindow::OnFilterTextChanged(wxCommandEvent& event)
{
    //No previous filter
    if (m_hasFilter == false)
    {
      SaveExpansion();
      m_hasFilter = true;
    }

    m_filter = m_searchBox->GetValue();

    if (m_filter.size() == 0)
      m_hasFilter = false;

    // If the filter begins with a space, we'll match the text anywhere in the
    // the symbol name.
    unsigned int filterLength = m_filter.Length();
    m_filter.Trim(false);
    m_filterMatchAnywhere = (m_filter.Length() < filterLength);

    // Make the filter lowercase since matching with be case independent.
    m_filter.MakeLower();
    
    Rebuild();

    if (filterLength > 0)
    {
      //Expand all directories
      TraverseTree(m_root, [&, this](wxTreeItemId const &item)
      {
        ItemData* data = static_cast<ItemData*>(m_tree->GetItemData(item));
        if (!data || data->isFile == false)
          m_tree->Expand(item);
      });
    }
    else
    {
      LoadExpansion();
    }
}
void EditablePagedLevel::Scroll(float stepX, float stepY)
{
    for (size_t i = 0; i < m_PageList.size(); ++i)
    {
        m_PageList[i]->Scroll(stepX, stepY);
    }

#ifndef EDITOR
    if (stepX != 0)
    {
        core::position2d<u32> hitpoint = core::position2d<u32>(GVideoDriver->getScreenSize() / 2);

        bool_t hittest = FALSE;
        if (stepX > 0)
        {
            hittest = (m_PagesInView[0]->GetPosition().X + m_PagesInView[0]->GetBound().getWidth() > hitpoint.X);
        }
        else
        {
            hittest = (m_PagesInView.getLast()->GetPosition().X < hitpoint.X);
        }

        if (hittest)
            Rebuild(stepX < 0);

#ifdef DBGMODE
        /*std::string indexes;
        for (size_t i = 0; i < MaxPagesInView; ++i)
        {
        std::string str = std::string(m_PagesInView[i]->GetIndex());
        str += " ";
        indexes += str;
        }

        LogDebug("Pages in view: " << indexes.c_str());*/
#endif // BGMODE
    }
#endif // EDITOR
}
示例#29
0
float CASW_DamageAllocationMgr::Deallocate( IndexType_t iTarget, CBaseEntity *pProjectile )
{
	if ( !IsValid( iTarget ) )
		return 0;

	Rebuild( iTarget );

	tuple_t * RESTRICT ptarget = &Elem(iTarget);
	ProjectilePool_t::IndexLocalType_t projIdx = iTarget->m_nProjectiles;
	const EHANDLE hProj = pProjectile; // for faster comparison
	while ( m_ProjectileLists.IsValidIndex(projIdx) )
	{
		if ( m_ProjectileLists[projIdx].m_hHandle == hProj )
		{
			ptarget->m_flAccumulatedDamage -= m_ProjectileLists[projIdx].m_flDamage;
			ptarget->m_nProjectiles = m_ProjectileLists.Next(projIdx);
			m_ProjectileLists.Remove( projIdx );
			return ptarget->m_flAccumulatedDamage; // better than break bc of load-hit-store
		}

		// clean up any dead projectiles (note the work to advance
		// the iterator while also deleting an element)
		if ( !m_ProjectileLists[projIdx].m_hHandle.Get() )
		{
			ProjectilePool_t::IndexLocalType_t toRemove = projIdx;
			ptarget->m_flAccumulatedDamage -= m_ProjectileLists[projIdx].m_flDamage;
			ptarget->m_nProjectiles = projIdx = m_ProjectileLists.Next( projIdx );
			m_ProjectileLists.Remove( toRemove );
		}
		else
		{
			Assert( static_cast<CASW_Rocket *>(m_ProjectileLists[projIdx].m_hHandle.Get())->GetTarget() == ptarget->m_hTargeted );
			projIdx = m_ProjectileLists.Next( projIdx );
		}
	}

	return ptarget->m_flAccumulatedDamage;
}
示例#30
-1
void EventDispatcher::Register(UserTable* pTab)
{
  if (pTab != NULL) {
    Inotify* pIn = pTab->GetInotify();
    if (pIn != NULL) {
      int fd = pIn->GetDescriptor();
      if (fd != -1) {
        m_maps.insert(FDUT_MAP::value_type(fd, pTab));
        Rebuild();
      }
    }
  }
}