Exemple #1
0
static void
Expand(AG_Event *event)
{
	AG_UCombo *com = AG_PTR(1);
	AG_Driver *drv = WIDGET(com)->drv;
	int expand = AG_INT(2);
	AG_SizeReq rList;
	int x, y, w, h;
	Uint wView, hView;

	AG_ObjectLock(com);
	if (expand) {
		com->panel = AG_WindowNew(AG_WINDOW_POPUP|AG_WINDOW_MODAL|
		                          AG_WINDOW_NOTITLE);
		AG_ObjectSetName(com->panel, "_UComboPopup");
		AG_WindowSetPadding(com->panel, 0,0,0,0);
		AG_ObjectAttach(com->panel, com->list);
		if (WIDGET(com)->window != NULL)
			AG_WindowAttach(WIDGET(com)->window, com->panel);
	
		if (com->wSaved > 0) {
			w = com->wSaved;
			h = com->hSaved;
		} else {
			if (com->wPreList != -1 && com->hPreList != -1) {
				AG_TlistSizeHintPixels(com->list,
				    com->wPreList, com->hPreList);
			}
			AG_WidgetSizeReq(com->list, &rList);
			w = rList.w + com->panel->wBorderSide*2;
			h = rList.h + com->panel->wBorderBot;
		}
		x = WIDGET(com)->rView.x2 - w;
		y = WIDGET(com)->rView.y1;
		
		AG_GetDisplaySize(WIDGET(com)->drv, &wView, &hView);
		if (x+w > wView) { w = wView - x; }
		if (y+h > hView) { h = hView - y; }
		
		if (AGDRIVER_CLASS(drv)->wm == AG_WM_MULTIPLE &&
		    WIDGET(com)->window != NULL) {
			x += WIDGET(WIDGET(com)->window)->x;
			y += WIDGET(WIDGET(com)->window)->y;
		}
		if (x < 0) { x = 0; }
		if (y < 0) { y = 0; }
		if (w < 4 || h < 4) {
			Collapse(com);
			return;
		}
		AG_SetEvent(com->panel, "window-modal-close",
		    ModalClose, "%p", com);
		AG_WindowSetGeometry(com->panel, x,y, w,h);
		AG_WindowShow(com->panel);
	} else {
		Collapse(com);
	}
	AG_ObjectUnlock(com);
}
Exemple #2
0
/** Collapse the fold item at the given index
  * If the panel is already collapsed, nothing happens, and no
  * events are sent, regardless of the value of bSendEvent
  * \param iIndex : the index of the panel to fold
  * \param bSendEvent: if true, an event wxEVT_FOLDPANELEX is sent
  * \return true on success, false on failure (vetoed)
  */
bool wxFoldPanelEx::Collapse(size_t iIndex, bool bSendEvent)
{
    wxFoldItemEx *f;

    f = GetFoldItem(iIndex);
    return(Collapse(f, bSendEvent));
}
Exemple #3
0
void Chopper::chop( Array< Vector3 > & vert, Array< Triangle > &tri, 
							Array< int > &map, Array< int > &permutation )
{
	AddVertex(vert);  // put input data into our data structures
	AddFaces(tri);

	ComputeAllEdgeCollapseCosts(); // cache all edge collapse costs

	permutation.allocate(s_Vertices.size());  // allocate space
	map.allocate(s_Vertices.size());          // allocate space

	// reduce the object down to nothing:
	while(s_Vertices.size() > 0) 
	{
		// get the next vertex to collapse
		Vertex *mn = MinimumCostEdge();
		// keep track of this vertex, i.e. the collapse ordering
		permutation[mn->id]=s_Vertices.size()-1;
		// keep track of vertex to which we collapse to
		map[s_Vertices.size()-1] = (mn->collapse)?mn->collapse->id:-1;
		// Collapse this edge
		Collapse(mn,mn->collapse);
	}
	// reorder the map list based on the collapse ordering
	for(int i=0;i<map.size();i++) {
		map[i] = (map[i]==-1)?0:permutation[map[i]];
	}
	// The caller of this function should reorder their vertices
	// according to the returned "permutation".
}
void ExpandingToolBar::OnToggle(wxCommandEvent & WXUNUSED(event))
{
   if (mIsExpanded)
      Collapse();
   else
      Expand();
}
Exemple #5
0
void ProgressiveMesh(std::vector<float3> &vert, std::vector<tridata> &tri,
                     std::vector<int> &map, std::vector<int> &permutation)
{
	AddVertex(vert);  // put input data into our data structures
	AddFaces(tri);
	ComputeAllEdgeCollapseCosts(); // cache all edge collapse costs
	permutation.resize(vertices.size());  // allocate space
	map.resize(vertices.size());          // allocate space
	// reduce the object down to nothing:
	while (vertices.size() > 0) {
		// get the next vertex to collapse
		Vertex *mn = MinimumCostEdge();
		// keep track of this vertex, i.e. the collapse ordering
		permutation[mn->id] = vertices.size() - 1;
		// keep track of vertex to which we collapse to
		map[vertices.size() - 1] = (mn->collapse) ? mn->collapse->id : -1;
		// Collapse this edge
		Collapse(mn,mn->collapse);
	}
	// reorder the map Array based on the collapse ordering
	for (unsigned int i = 0; i<map.size(); i++) {
		map[i] = (map[i]==-1)?0:permutation[map[i]];
	}
	// The caller of this function should reorder their vertices
	// according to the returned "permutation".
}
void CXTPDockingPaneSidePanel::OnPinButtonClick()
{
	if (!m_hWnd)
		return;

	BOOL bPinning = m_bCollapsed;

	if (OnAction(bPinning ? xtpPaneActionPinning : xtpPaneActionUnpinning))
		return;

	if (!m_bCollapsed)
	{
		Collapse(TRUE);
	}
	else
	{
		if (m_nStepsCount != m_nSlideStep)
		{
			SetWindowPos(0, 0, 0, m_rcWindow.Width(), m_rcWindow.Height(), SWP_NOZORDER | SWP_NOMOVE);
		}
		m_bCollapsed = FALSE;
		m_bExpanded = FALSE;

		KillTimer(TID_CHECKACTIVE);
		KillTimer(TID_SLIDEOUT);

	}
	InvalidatePane(FALSE);

	OnAction(bPinning ? xtpPaneActionPinned : xtpPaneActionUnpinned);
}
//------------------------------------------------------------------------
void CVehicleMovementWarrior::EnableThruster(SThruster *pThruster, bool enable)
{
	pThruster->enabled = enable;
	//if (!enable)
	//pThruster->hoverHeight = 0.2f;

	if(!pThruster->pHelper)
	{
		// disable exhaust
		// todo: add direct access to these
		for(std::vector<SExhaustStatus>::iterator it = m_paStats.exhaustStats.begin(); it != m_paStats.exhaustStats.end(); ++it)
		{
			if(it->pHelper == pThruster->pHelper)
			{
				it->enabled = (int)enable;
			}
		}
	}

	int nDamaged = m_thrustersDamaged + (enable ? -1 : 1);

	if(m_maxThrustersDamaged >= 0 && nDamaged >= m_maxThrustersDamaged && m_thrustersDamaged < m_maxThrustersDamaged)
	{
		Collapse();
	}

	m_thrustersDamaged = nDamaged;
}
Exemple #8
0
//---------------------------------------------------------
void CACTIVE_History::_Expand(wxTreeItemId Node, const wxString &Name, bool bExpand)
{
	if( !GetItemText(Node).Cmp(Name) )
	{
		if( bExpand )
		{
			Expand(Node);
		}
		else
		{
			Collapse(Node);
		}
	}
	else
	{
		wxTreeItemIdValue	Cookie;

		wxTreeItemId	Child	= GetFirstChild(Node, Cookie);

		while( Child.IsOk() )
		{
			_Expand(Child, Name, bExpand);

			Child	= GetNextChild(Node, Cookie);
		}
	}
}
Exemple #9
0
static void
DesEncrypt( u_char *clear, /* IN  8 octets */
            u_char *key,   /* IN  7 octets */
            u_char *cipher /* OUT 8 octets */)
{
  u_char des_key[8];
  u_char crypt_key[66];
  u_char des_input[66];

  MakeKey(key, des_key);

  Expand(des_key, crypt_key);
  setkey((char*)crypt_key);

#if 0
  CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n",
             clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7]));
#endif

  Expand(clear, des_input);
  encrypt((char*)des_input, 0);
  Collapse(des_input, cipher);

#if 0
  CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n",
             cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7]));
#endif
}
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item)
{
    Freeze();
    // first (recursively) collapse all the children
    wxTreeItemIdValue cookie;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for ( wxTreeItemId idCurr = GetFirstChild(item, cookie);
          idCurr.IsOk();
          idCurr = GetNextChild(item, cookie) )
    {
        CollapseAllChildren(idCurr);
    }

    // then collapse this element too unless it's the hidden root which can't
    // be collapsed
    if ( item != GetRootItem() || !HasFlag(wxTR_HIDE_ROOT) )
        Collapse(item);
    Thaw();
}
void ExpandingToolBar::OnToggle(wxCommandEvent &evt)
{
   if (mIsExpanded)
      Collapse();
   else
      Expand();
}
Exemple #12
0
static void
Expand(AG_Event *event)
{
    AG_FileSelector *fs = AG_PTR(1);
    AG_Driver *drv = WIDGET(fs)->drv;
    int expand = AG_INT(2);
    AG_SizeReq rFileDlg;
    int x, y, w, h;
    Uint wView, hView;

    if (expand) {						/* Expand */
        fs->panel = AG_WindowNew(AG_WINDOW_MODAL|AG_WINDOW_NOTITLE);
        AG_WindowSetPadding(fs->panel, 0, 0, 0, 0);
        AG_ObjectAttach(fs->panel, fs->filedlg);

        if (fs->wSaved > 0) {
            w = fs->wSaved;
            h = fs->hSaved;
        } else {
            AG_WidgetSizeReq(fs->filedlg, &rFileDlg);
            w = rFileDlg.w + fs->panel->wBorderSide*2;
            h = rFileDlg.h + fs->panel->wBorderBot;
        }
        x = WIDGET(fs)->rView.x2 - w;
        y = WIDGET(fs)->rView.y1;

        if (AGDRIVER_SINGLE(drv) &&
                AG_GetDisplaySize(drv, &wView, &hView) == 0) {
            if (x+w > wView) {
                w = wView - x;
            }
            if (y+h > hView) {
                h = hView - y;
            }
        }
        if (w < 4 || h < 4) {
            Collapse(fs);
            return;
        }
        AG_SetEvent(fs->panel, "window-modal-close",
                    ModalClose, "%p", fs);
        AG_WindowSetGeometry(fs->panel, x, y, w, h);
        AG_WindowShow(fs->panel);
    } else {
        Collapse(fs);
    }
}
Exemple #13
0
void DBTreeCtrl::OnExpand(wxCommandEvent &event)
{
	wxTreeItemId sel_item = GetSelection();
	if (IsExpanded(sel_item))
		Collapse(sel_item);
	else
		Expand(sel_item);
}
Exemple #14
0
static void
ModalClose(AG_Event *event)
{
	AG_UCombo *com = AG_PTR(1);

	if (com->panel != NULL)
		Collapse(com);
}
Exemple #15
0
static void
ModalClose(AG_Event *event)
{
    AG_FileSelector *fs = AG_PTR(1);

    if (fs->panel != NULL)
        Collapse(fs);
}
Exemple #16
0
void wxFoldPanelBar::OnPressCaption(wxCaptionBarEvent &event)
{
    // act upon the folding or expanding status of the bar

    if(event.GetFoldStatus())
        Collapse(wxFoldPanel((wxFoldPanelItem *)event.GetTag()));
    else
        Expand(wxFoldPanel((wxFoldPanelItem *)event.GetTag()));
}
Exemple #17
0
static void
FileChosen(AG_Event *event)
{
    AG_FileSelector *fs = AG_PTR(1);
    char *path = AG_STRING(2);

    AG_TextboxSetString(fs->tbox, path);
    AG_PostEvent(NULL, fs, "file-chosen", "%s", path);
    Collapse(fs);
}
Exemple #18
0
BOOL CDropListBox::Expand(PLIST_ITEM pItem, UINT nCode)
{
	if(pItem == NULL)
	{
		return FALSE;
	}

	BOOL bResult = FALSE;
	if(nCode == LBE_COLLAPSE)
	{
		bResult = Collapse(pItem);
	}
	else if(nCode == LBE_EXPAND)
	{
		bResult = Expand(pItem);
	}
	else if(nCode == LBE_TOGGLE)
	{
		if(pItem->state & ACBIS_COLLAPSED)
		{
			bResult = Expand(pItem);
		}
		else
		{
			bResult = Collapse(pItem);
		}
	}

	if(bResult)
	{
		SCROLLINFO info;
		info.cbSize = sizeof(SCROLLINFO);
		if( m_pDropWnd->GetScrollBarPtr()->GetScrollInfo( &info, SIF_ALL|SIF_DISABLENOSCROLL ) )
		{
			info.nPage = GetBottomIndex() - GetTopIndex();
			info.nMax = GetCount()-1;
			info.nMin = 0;
			m_pDropWnd->GetScrollBarPtr()->SetScrollInfo( &info );
		}
	}
	return bResult;
}
void pawsTreeNode::CollapseAll()
{
    pawsTreeNode* child;

    Collapse();
    child = firstChild;
    while(child != NULL)
    {
        child->CollapseAll();
        child = child->GetNextSibling();
    }
}
Exemple #20
0
	void CustomDropDown::OnItemSelected()
	{
		auto pressedState = state["pressed"];
		if (pressedState)
			*pressedState = false;

		Collapse();
		onSelectedPos(mItemsList->GetSelectedItemPos());
		onSelectedItem(mItemsList->GetSelectedItem());

		OnSelectionChanged();
	}
/*
=================
idSurface_Patch::SubdivideExplicit
=================
*/
void idSurface_Patch::SubdivideExplicit( int horzSubdivisions, int vertSubdivisions, bool genNormals, bool removeLinear ) {
	int i, j, k, l;
	idDrawVert sample[3][3];
	int outWidth = ((width - 1) / 2 * horzSubdivisions) + 1;
	int outHeight = ((height - 1) / 2 * vertSubdivisions) + 1;
	idDrawVert *dv = new idDrawVert[ outWidth * outHeight ];

	// generate normals for the control mesh
	if ( genNormals ) {
		GenerateNormals();
	}

	int baseCol = 0;
	for ( i = 0; i + 2 < width; i += 2 ) {
		int baseRow = 0;
		for ( j = 0; j + 2 < height; j += 2 ) {
			for ( k = 0; k < 3; k++ ) {
				for ( l = 0; l < 3; l++ ) {
					sample[k][l] = verts[ ((j + l) * width) + i + k ];
				}
			}
			SampleSinglePatch( sample, baseCol, baseRow, outWidth, horzSubdivisions, vertSubdivisions, dv );
			baseRow += vertSubdivisions;
		}
		baseCol += horzSubdivisions;
	}
	verts.SetNum( outWidth * outHeight );
	for ( i = 0; i < outWidth * outHeight; i++ ) {
		verts[i] = dv[i];
	}

	delete[] dv;

	width = maxWidth = outWidth;
	height = maxHeight = outHeight;
	expanded = false;

	if ( removeLinear ) {
		Expand();
		RemoveLinearColumnsRows();
		Collapse();
	}

	// normalize all the lerped normals
	if ( genNormals ) {
		for ( i = 0; i < width * height; i++ ) {
			verts[i].normal.Normalize();
		}
	}

	GenerateIndexes();
}
Exemple #22
0
//-----------------------------------------------------------------------------
//!
//-----------------------------------------------------------------------------
void tEditExpandSideBar::ToggleExpanded()
{
    bool animate = true;

    if( !ExpandedView() )
    {     
        Expand( animate );
    }
    else
    {
        Collapse( animate );
    }
}
Exemple #23
0
void ctlTree::NavigateTree(int keyCode)
{
	switch(keyCode)
	{
		case WXK_LEFT:
			{
				//If tree item has children and is expanded, collapse it, otherwise select it's parent if has one
				wxTreeItemId currItem = GetSelection();

				if (ItemHasChildren(currItem) && IsExpanded(currItem))
				{
					Collapse(currItem);
				}
				else
				{
					wxTreeItemId parent = GetItemParent(currItem);
					if (parent.IsOk())
					{
						SelectItem(currItem, false);
						SelectItem(parent, true);
					}
				}
			}
			break;
		case WXK_RIGHT:
			{
				//If tree item do not have any children ignore it,
				//otherwise  expand it if not expanded, and select first child if already expanded
				wxTreeItemId currItem = GetSelection();

				if(ItemHasChildren(currItem))
				{
					if (!IsExpanded(currItem))
					{
						Expand(currItem);
					}
					else
					{
						wxCookieType cookie;
						wxTreeItemId firstChild = GetFirstChild(currItem, cookie);
						SelectItem(currItem, false);
						SelectItem(firstChild, true);
					}
				}
			}
			break;
		default:
			wxASSERT_MSG(false, _("Currently handles only right and left arrow key, other keys are working"));
			break;
	}
}
Exemple #24
0
void wxGenericCollapsiblePane::OnButton(wxCommandEvent& event)
{
    if ( event.GetEventObject() != m_pButton )
    {
        event.Skip();
        return;
    }

    Collapse(!IsCollapsed());

    // this change was generated by the user - send the event
    wxCollapsiblePaneEvent ev(this, GetId(), IsCollapsed());
    GetEventHandler()->ProcessEvent(ev);
}
TiXmlElement* ConfigManager::AssertPath(wxString& path)
{
    Collapse(path);

    wxString illegal(_T(" -:.\"\'$&()[]<>+#"));
    size_t i = 0;
    while ((i = path.find_first_of(illegal, i)) != wxString::npos)
        path[i] = _T('_');

    TiXmlElement *localPath = pathNode ? pathNode : root;

    if (path.GetChar(0) == '/')  // absolute path
    {
        localPath = root;
        path = path.Mid(1);
    }

    if (path.find(_T('/')) != wxString::npos) // need for path walking
        to_lower(path);

    wxString sub;

    while (path.find(_T('/')) != wxString::npos)
    {
        sub = path.BeforeFirst(_T('/'));
        path = path.AfterFirst(_T('/'));

        if (localPath != root && sub.IsSameAs(CfgMgrConsts::dotDot))
            localPath = localPath->Parent()->ToElement();
        else if (sub.GetChar(0) < _T('a') || sub.GetChar(0) > _T('z'))
        {
            cbThrow(InvalidNameMessage(_T("subpath"), sub, localPath));
        }
        else
        {
            TiXmlElement* n = localPath->FirstChildElement(cbU2C(sub));
            if (n)
                localPath = n;
            else
                localPath = (TiXmlElement*) localPath->InsertEndChild(TiXmlElement(cbU2C(sub)));
        }
    }

    to_upper(path);

    if (!path.IsEmpty() && (path.GetChar(0) < _T('A') || path.GetChar(0) > _T('Z')))
        cbThrow(InvalidNameMessage(_T("key"), path, localPath));

    return localPath;
}
Exemple #26
0
void wxTreeCtrlBase::CollapseAllChildren(const wxTreeItemId& item)
{
    // first (recursively) collapse all the children
    wxTreeItemIdValue cookie;
    for ( wxTreeItemId idCurr = GetFirstChild(item, cookie);
          idCurr.IsOk();
          idCurr = GetNextChild(item, cookie) )
    {
        CollapseAllChildren(idCurr);
    }

    // then collapse this element too
    Collapse(item);
}
Exemple #27
0
static void
SelectedItem(AG_Event *event)
{
	AG_Tlist *tl = AG_SELF();
	AG_Combo *com = AG_PTR(1);
	AG_TlistItem *ti;

	AG_ObjectLock(tl);
	if ((ti = AG_TlistSelectedItem(tl)) != NULL) {
		AG_TextboxSetString(com->tbox, ti->text);
		AG_PostEvent(NULL, com, "combo-selected", "%p", ti);
	}
	AG_ObjectUnlock(tl);
	Collapse(com);
}
Exemple #28
0
bool MCParagraphCursor::Move(MCParagraphCursorMove p_movement, int4 p_delta)
{
	if (p_delta == 0)
		return true;

	bool t_moved;
	if (p_delta < 0)
		t_moved = MoveStart(p_movement, p_delta);
	else if (p_delta > 0)
		t_moved = MoveFinish(p_movement, p_delta);

	Collapse(p_delta);

	return t_moved;
}
Exemple #29
0
	void CustomDropDown::MoveAndCheckClipping(const Vec2F& delta, const RectF& clipArea)
	{
		RectF last = mBoundsWithChilds;

		mBoundsWithChilds += delta;
		mIsClipped = !mBoundsWithChilds.IsIntersects(clipArea);

		if (!mIsClipped)
			UpdateSelfTransform();

		for (auto child : mChildWidgets)
			child->MoveAndCheckClipping(delta, clipArea);

		if (IsExpanded())
			Collapse();
	}
void
DesEncrypt(unsigned char *clear, unsigned char *key, unsigned char *cipher)
{
    u_char des_key[8];
    u_char crypt_key[66];
    u_char des_input[66];

    MakeKey(key, des_key);

    Expand(des_key, crypt_key);
    setkey(crypt_key);

    Expand(clear, des_input);
    encrypt(des_input, 0);
    Collapse(des_input, cipher);
}