Example #1
0
void DirectoryTree::OnItemExpanded(wxTreeEvent& evt)
  {
  wxTreeItemId tid = evt.GetItem();
	if(!tid.IsOk())
		{
    wxLogDebug(wxT("OnItemExpanded(): invalid event wxTreeItemId %u"), (int) tid);
		return;
		}

  wxString sPath;
  bool bGotPath = GetItemPath(tid, sPath);
	if(!bGotPath)
		{
    wxLogDebug(wxT("OnItemExpanded(): Can't get path from tree item %u"), (int) tid);
		return;
		}

  wxLogTrace(DIRECTORYTREE_EVENTS, wxT("OnItemExpanded(): '%s'"), sPath.c_str());

	AddChildren(tid);

	// TBI: Improve this by using GetBoundingRect
  // Scroll the view so that we can see as much of the newly expanded branch as possible
	// Get the last 'nChildId', so we can call 'EnsureVisible'
	wxTreeItemId tidLastChild = GetLastChild(tid);
 	if(tidLastChild.IsOk())
 		EnsureVisible(tidLastChild);
	EnsureVisible(tid);
  }
Example #2
0
BOOL CDuiItemBox::SetNewPosition(CDuiWindow * pChild, DWORD nPos, BOOL bEnsureVisible)
{
    if (pChild == NULL)
    {
        return FALSE;
    }

    CDuiWindow * pCurChild = m_pFirstChild;
    DWORD nCurPos = 0;
    for (; pCurChild != NULL; pCurChild = pCurChild->GetDuiWindow(GDUI_NEXTSIBLING))
    {
        if (pCurChild == pChild)
        {
            break;
        }
        ++nCurPos;
    }

    if (pCurChild == NULL)
    {
        return FALSE;
    }

    if (nCurPos == nPos)
    {
        if (bEnsureVisible)
        {
            EnsureVisible(pChild);
        }

        NotifyInvalidate();
        return TRUE;
    }

    if (nPos == 0)
    {
        BringWindowAfter(pChild, ICWND_FIRST);
    }
    else
    {
        CDuiWindow * pNewNext = m_pFirstChild;
        for (UINT i = 0; i < nPos && pNewNext != NULL; i++)
        {
            pNewNext = pNewNext->GetDuiWindow(GDUI_NEXTSIBLING);
        }

        BringWindowAfter(pChild, pNewNext);
    }

    UpdateScroll();
    ReLayout();
    if (bEnsureVisible)
    {
        EnsureVisible(pChild);
    }
    NotifyInvalidate();
    return TRUE;
}
Example #3
0
void CLogView::SetHighLight(unsigned id)
{
	auto it = m_items.find(id);
	if (it == m_items.end())
		return;

	int begin = it->second.beginLine;
	int end = it->second.endLine;
	SetHighLight(begin, end);

	EnsureVisible(end, true);
	EnsureVisible(begin, true);
//	SetSelectionMark(begin);
	SetItemState(begin, LVIS_FOCUSED, LVIS_FOCUSED);
}
void CTuotuoTabCtrl::InsertItem(size_t nInsertTo, CTabItem *pItem)
{
	ATLASSERT(pItem);
	m_bClosingTabs = false;

	// we assume, that any new tab appears on the right
	if (m_TabItems.empty())
	{
		m_TabItems.push_back(pItem);
		pItem->SetIndex(0);
		pItem->ChangeItemParent(this);
		pItem->SetPosImmediately(0);
		pItem->SetNewWidthImmediately();
	}
	else
	{
		if (nInsertTo == -1)
			nInsertTo = m_TabItems.size();
		ATLASSERT(nInsertTo >= 0 && nInsertTo <= m_TabItems.size());
		m_TabItems.insert(m_TabItems.begin() + nInsertTo, pItem);
		for (size_t i = nInsertTo; i < m_TabItems.size(); i++)
		{
			m_TabItems[i]->SetIndex(i);
			m_TabItems[i]->SetPosImmediately(i * m_iCurrentWidth);
		}
		pItem->ChangeItemParent(this);
		pItem->SetNewWidthImmediately();
	}
	EnsureVisible(pItem);

	UpdateLayout();
}
void CCrystalEditView::OnEditDelete() 
{
	if (! QueryEditable() || m_pTextBuffer == NULL)
		return;

	CPoint ptSelStart, ptSelEnd;
	GetSelection(ptSelStart, ptSelEnd);
	if (ptSelStart == ptSelEnd)
	{
		if (ptSelEnd.x == GetLineLength(ptSelEnd.y))
		{
			if (ptSelEnd.y == GetLineCount() - 1)
				return;
			ptSelEnd.y ++;
			ptSelEnd.x = 0;
		}
		else
			ptSelEnd.x ++;
	}

	CPoint ptCursorPos = ptSelStart;
	ASSERT_VALIDTEXTPOS(ptCursorPos);
	SetAnchor(ptCursorPos);
	SetSelection(ptCursorPos, ptCursorPos);
	SetCursorPos(ptCursorPos);
	EnsureVisible(ptCursorPos);

	m_pTextBuffer->DeleteText(this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_DELETE); // [JRT]
}
LRESULT CObjectProperty::OnAddEditBox ( WPARAM wParam, LPARAM lParam )
{
    //char szDebug [ 255 ] = "";
    //theApp.m_Debug.Write ( "OnAddEditBox - Begin" );

    sItem* pEdit = ( sItem* ) lParam;

    //sprintf ( szDebug, "pEdit->iGroup - %i", pEdit->iGroup );
    //theApp.m_Debug.Write ( szDebug );

    if ( pEdit->iGroup > (int)m_pGroups.size ( ) )
    {
        //theApp.m_Debug.Write ( "INVALID GROUP" );
        return 0;
    }

    CBCGProp* pProp = m_pGroups [ pEdit->iGroup ].pProperty;

    m_pGroups [ pEdit->iGroup ].iType = 0;

    //sprintf ( szDebug, "pEdit->name - %s", GetANSIFromWide ( pEdit->name ) );
    //theApp.m_Debug.Write ( szDebug );
    //sprintf ( szDebug, "pEdit->contents - %s", GetANSIFromWide ( pEdit->contents ) );
    //theApp.m_Debug.Write ( szDebug );
    //sprintf ( szDebug, "pEdit->description - %s", GetANSIFromWide ( pEdit->description ) );
    //theApp.m_Debug.Write ( szDebug );

    pProp->AddSubItem ( new CBCGProp ( pEdit->name, ( _variant_t ) pEdit->contents, pEdit->description ) );

    EnsureVisible ( pProp );

    //theApp.m_Debug.Write ( "OnAddEditBox - End\n" );
    return 0;
}
Example #7
0
CDuiPanel* CDuiItemBox::InsertItem(LPCWSTR pszXml,int iItem/*=-1*/,BOOL bEnsureVisible/*=FALSE*/)
{
    CDuiStringA strXml=DUI_CW2A(pszXml,CP_UTF8);;

    pugi::xml_document xmlDoc;
    if(!xmlDoc.load_buffer((LPCSTR)strXml,strXml.GetLength(),pugi::parse_default,pugi::encoding_utf8)) return NULL;

    CDuiWindow *pChild=m_pFirstChild,*pPrevChild=ICWND_FIRST;
    for(int iChild=0; iChild<iItem || iItem==-1; iChild++)
    {
        if(!pChild) break;
        pPrevChild=pChild;
        pChild=pChild->GetDuiWindow(GDUI_NEXTSIBLING);
    }

    CDuiPanel *pPanel=new CDuiPanel;
    InsertChild(pPanel, pPrevChild);

    pPanel->LoadChildren(xmlDoc);
    pPanel->SetVisible(TRUE);
    pPanel->SetFixSize(m_nItemWid,m_nItemHei);

    UpdateScroll();
    ReLayout();

    if(bEnsureVisible) EnsureVisible(pPanel);

    NotifyInvalidate();
    return pPanel;
}
Example #8
0
// ----------------------------------------------------------------------------
// ArchiveEntryList::filterList
//
// Filters the list to only entries and directories with names matching
// [filter], and with type categories matching [category].
// ----------------------------------------------------------------------------
void ArchiveEntryList::filterList(string filter, string category)
{
	// Update variables
	filter_text = filter;
	filter_category = category;

	// Save current selection
	vector<ArchiveEntry*> selection = getSelectedEntries();
	ArchiveEntry* focus = getFocusedEntry();

	// Apply the filter
	clearSelection();
	applyFilter();

	// Restore selection (if selected entries aren't filtered)
	ArchiveEntry* entry = nullptr;
	for (int a = 0; a < GetItemCount(); a++)
	{
		entry = getEntry(a, false);
		for (unsigned b = 0; b < selection.size(); b++)
		{
			if (entry == selection[b])
			{
				selectItem(a);
				break;
			}
		}

		if (entry == focus)
		{
			focusItem(a);
			EnsureVisible(a);
		}
	}
}
bool CXTPShellTreeCtrl::Init()
{
	if (!CXTPShellTreeCtrlBase::Init())
		return false;

	if (m_bAutoInit)
	{
		// mimic native Windows Explorer styles.
		DWORD dwStyle = TVS_SHOWSELALWAYS | TVS_HASBUTTONS;

		if (XTPSystemVersion()->IsWinXPOrGreater())
		{
			dwStyle |= (TVS_TRACKSELECT);
		}
		else
		{
			dwStyle |= (TVS_HASLINES | TVS_LINESATROOT);
		}

		if (InitializeTree(dwStyle))
		{
			PopulateTreeView();
		}

		// make the parent of the selected item visible if found.
		HTREEITEM hItem = GetSelectedItem();
		HTREEITEM hItemParent = GetParentItem(hItem);

		EnsureVisible(hItemParent ? hItemParent : hItem);
	}

	return true;
}
Example #10
0
void CDebugView::MarkPauseItem(int64 PauseItemID){

	CVSpace2* Item = FindSpace(PauseItemID);
	if (Item)
	{

		if (m_Toolbar.m_Owner)
		{
			m_Toolbar.m_Owner->m_AreaBottom-=m_Toolbar.m_Height;
			m_Toolbar.m_Owner->m_State &= ~SPACE_SELECTED;
		}

		m_Toolbar.m_Owner = Item;
        m_Toolbar.m_Owner->m_AreaBottom+=m_Toolbar.m_Height;

		Item->m_State |= SPACE_PAUSE|SPACE_SELECTED;

		m_SpaceSelected = Item;

		SetStepBnt(true);
		SetRunBnt(true);
		SetBreakBnt(false,0);

		Layout();
		EnsureVisible(Item,true);
	}else
	{
		Invalidate();
	}
	
}
void CXTPTaskPanelGroup::RepositionScrollOffset()
{
	int nItemCount = GetItemCount();
	int nLastVisibleItem = m_pItems->GetNextVisibleIndex(nItemCount, -1);

	int nScrollOffset = min(GetOffsetItem(), nLastVisibleItem);

	if (nScrollOffset > 0)
	{
		CRect rcItem(GetAt(nLastVisibleItem)->GetItemRect());

		int nTopMargin = GetPaintManager()->GetGroupInnerMargins(this).top;

		while ((nScrollOffset > 0) && ((rcItem.bottom - GetAt(nScrollOffset - 1)->GetItemRect().top + nTopMargin
			< m_nExpandedClientHeight) || !GetAt(nScrollOffset - 1)->IsVisible()))
		{
			nScrollOffset--;
		}
	}
	SetOffsetItem(nScrollOffset, FALSE);

	for (int i = 0; i < nItemCount; i++)
	{
		CXTPTaskPanelGroupItem* pItem = GetAt(i);

		if (pItem->IsItemFocused() || (pItem->IsItemSelected() && GetTaskPanel()->m_bSelectItemOnFocus))
		{
			EnsureVisible(pItem, FALSE);
			break;
		}
	}
}
Example #12
0
/// Left-click
void InstanceCtrl::OnLeftClick(wxMouseEvent& event)
{
	SetFocus();
	VisualCoord clickedIndex;
	HitTest(event.GetPosition(), clickedIndex);
	if(clickedIndex.isItem())
	{
		int flags = 0;
		if (event.ControlDown())
			flags |= wxINST_CTRL_DOWN;
		if (event.ShiftDown())
			flags |= wxINST_SHIFT_DOWN;
		if (event.AltDown())
			flags |= wxINST_ALT_DOWN;
			
		EnsureVisible(clickedIndex);
		DoSelection(clickedIndex);
		SetIntendedColumn(clickedIndex);
	}
	else if(clickedIndex.isHeaderTicker())
	{
		ToggleGroup(clickedIndex.groupIndex);
	}
	else ClearSelections();
}
Example #13
0
void CEditWnd::InsertText(LPCSTR text, int action)
{
	m_pTextBuffer->BeginUndoGroup();
    
	CPoint ptCursorPos;
  if (IsSelection ())
  {
		CPoint ptSelStart, ptSelEnd;
    GetSelection (ptSelStart, ptSelEnd);
    
    ptCursorPos = ptSelStart;
    
		m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_PASTE);
	}
  else ptCursorPos = GetCursorPos ();
	ASSERT_VALIDTEXTPOS (ptCursorPos);
      
  int x, y;
  m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, text, y, x, action);

  ptCursorPos.x = x;
  ptCursorPos.y = y;
  ASSERT_VALIDTEXTPOS (ptCursorPos);
  SetAnchor (ptCursorPos);
  SetSelection (ptCursorPos, ptCursorPos);
  SetCursorPos (ptCursorPos);
  EnsureVisible (ptCursorPos);
  m_pTextBuffer->FlushUndoGroup (this);
}
Example #14
0
BOOL CEditWnd::ReplaceSelection (LPCTSTR pszNewText)
{
  if (!pszNewText)
    pszNewText = _T ("");

  CPoint ptCursorPos;
  if (IsSelection ())
	{
		CPoint ptSelStart, ptSelEnd;
		GetSelection (ptSelStart, ptSelEnd);
		ptCursorPos = ptSelStart;
		m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_REPLACE);
	}
  else ptCursorPos = GetCursorPos ();
  ASSERT_VALIDTEXTPOS (ptCursorPos);

  int x, y;
  m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszNewText, y, x, CE_ACTION_REPLACE);
  m_nLastReplaceLen = (int)_tcslen (pszNewText);
  CPoint ptEndOfBlock = CPoint (x, y);
  ASSERT_VALIDTEXTPOS (ptCursorPos);
  ASSERT_VALIDTEXTPOS (ptEndOfBlock);
  SetAnchor (ptEndOfBlock);
  SetSelection (ptCursorPos, ptEndOfBlock);
  SetCursorPos (ptEndOfBlock);
  EnsureVisible (ptEndOfBlock);
  return TRUE;
}
Example #15
0
void CEditWnd::Cut()
{
  if (!QueryEditable ())
    return;
  if (m_pTextBuffer == NULL)
    return;
  if (!IsSelection ())
    return;

  CPoint ptSelStart, ptSelEnd;
  GetSelection (ptSelStart, ptSelEnd);
  string text;
  GetText (ptSelStart, ptSelEnd, text);
  PutToClipboard (text.c_str());

  CPoint ptCursorPos = ptSelStart;
  ASSERT_VALIDTEXTPOS (ptCursorPos);
  SetAnchor (ptCursorPos);
  SetSelection (ptCursorPos, ptCursorPos);
  SetCursorPos (ptCursorPos);
  EnsureVisible (ptCursorPos);

  m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_CUT);

}
LRESULT CObjectProperty::OnAddGroup ( WPARAM wParam, LPARAM lParam )
{
    //char szDebug [ 255 ] = "";
    //theApp.m_Debug.Write ( "\n" );
    //theApp.m_Debug.Write ( "OnAddGroup - Begin" );

    CString* pString = ( CString* ) lParam;

    CBCGProp* pProp = new CBCGProp ( *pString );

    sPropertyItem add;

    add.iType     = 0;
    add.pProperty = pProp;

    m_pGroups.push_back ( add );

    AddProperty ( pProp );

    //theApp.m_Debug.Write ( "AddProperty->pProp" );

    EnsureVisible ( pProp );

    return 0;
}
LRESULT CObjectProperty::OnAddColorPicker (WPARAM wParam, LPARAM lParam )
{
    //char szDebug [ 255 ] = "";
    //theApp.m_Debug.Write ( "OnAddColorPicker - Begin" );

    sItem* pColor = ( sItem* ) lParam;

    //sprintf ( szDebug, "pColor->iGroup - %i", pColor->iGroup );
    //theApp.m_Debug.Write ( szDebug );

    if ( pColor->iGroup > (int)m_pGroups.size ( ) )
    {
        //theApp.m_Debug.Write ( "INVALID GROUP" );
        return 0;
    }

    CBCGProp* pProp = m_pGroups [ pColor->iGroup ].pProperty;

    int iColor [ 3 ];

    {
        char		szTextANSI [ 255 ]	= "";
        ConvertWideToANSI ( NULL, &pColor->contents, szTextANSI );

        char  seps[ ] = " ";
        char* token;

        token = strtok ( szTextANSI, seps );

        int iToken = 0;

        while ( token != NULL )
        {
            iColor [ iToken++ ] = atoi ( token );
            token = strtok ( NULL, seps );
        }
    }


    CBCGColorProp* pColorProp = new CBCGColorProp ( pColor->name, RGB ( iColor [ 0 ], iColor [ 1 ], iColor [ 2 ] ), NULL, pColor->description );

    //sprintf ( szDebug, "pColor->description - %s", GetANSIFromWide ( pColor->description ) );
    //theApp.m_Debug.Write ( szDebug );

    m_pGroups [ pColor->iGroup ].iType = 2;

    pProp->AddSubItem ( pColorProp );

    // v105 - 190107 - fix by reverting to standard colour dialog
//	pColorProp->EnableOtherButton ( _T ( "Other..." ) );
    pColorProp->EnableOtherButton ( _T ( "Other..." ), FALSE, TRUE );
    pColorProp->EnableAutomaticButton (_T ( "Default" ), ::GetSysColor ( COLOR_3DFACE ) );



    EnsureVisible ( pProp );

    //theApp.m_Debug.Write ( "OnAddColorPicker - End\n" );
    return 0;
}
Example #18
0
void PG_ListBox::OnItemSelected(PG_ListBoxBaseItem* item, bool select) 
{
	if(item == NULL) 
	{
		return;
	}

	if(!my_multiselect) 
	{
		if((m_poCurrentItem != NULL) && (m_poCurrentItem != item))
		{
			m_poCurrentItem->Select(false);
			m_poCurrentItem->Update();
		}

		m_poCurrentItem = item;
		m_poCurrentItem->Update();
	}

	if (select)
	{
		sigSelectItem(item);
		eventSelectItem(item);
		EnsureVisible(item);
	}
}
//------------------------------------------------------------------------
//! Called by the framework when a drop operation is to occur, where the
//! origin is the CGridListCtrlEx itself
//!
//! @param pDataObject Points to the data object containing the data that can be dropped
//! @param dropEffect The effect that the user chose for the drop operation (DROPEFFECT_COPY, DROPEFFECT_MOVE, DROPEFFECT_LINK)
//! @param point Contains the current location of the cursor in client coordinates.
//! @return Nonzero if the drop is successful; otherwise 0
//------------------------------------------------------------------------
BOOL CGridListCtrlGroups::OnDropSelf(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point)
{
	// Internal drag (Move rows to other group)
	int nRow, nCol;
	CellHitTest(point, nRow, nCol);
	if (!IsGroupViewEnabled())
		return CGridListCtrlEx::MoveSelectedRows(nRow);

	if (GetStyle() & LVS_OWNERDATA)
		return false;

	int nGroupId = nRow!=-1 ? GetRowGroupId(nRow) : GroupHitTest(point);
	if (nGroupId==-1)
		return FALSE;
		
	if (MoveSelectedRows(nGroupId))
	{
		if (nRow!=-1)
		{
			EnsureVisible(nRow, FALSE);
			SetFocusRow(nRow);
		}
	}
	return TRUE;
}
//******************************************************************************************
void CArrayGrid::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags) 
{
	CWnd::OnChar(nChar, nRepCnt, nFlags);

	if (m_nDraggedColumn >= 0 || m_bTracking || m_bSelecting || nChar == 3)
	{
		return;
	}

	if (!CanBeginInplaceEditOnChar (nChar, nRepCnt, nFlags))
	{
		return;
	}

	CBCGPGridRow* pSel = GetCurSel ();

	if (pSel == NULL || !pSel->IsEnabled())
	{
		return;
	}

	ASSERT_VALID (pSel);
	EnsureVisible (pSel, TRUE);

	SetBeginEditReason (BeginEdit_Char);
	if (!EditItem (pSel))
	{
		return;
	}

	DoInplaceEditSetSel (OnInplaceEditSetSel (GetCurSelItem (pSel), BeginEdit_Char));

	pSel->PushChar (nChar);
}
void CDragVirtualListCtrl::OnLButtonUp(UINT nFlags, CPoint point) 
{
	CListCtrl::OnLButtonUp(nFlags, point);
	// NOTE that only report view is supported
	if (m_Dragging) {
		m_Dragging = FALSE;
		ReleaseCapture();
		UINT	flags;
		int	InsPos = HitTest(point, &flags);
		if (InsPos < 0) {
			if (flags & LVHT_ABOVE)
				InsPos = 0;
			else	// assume end of list
				InsPos = GetItemCount();	// this works, amazingly
		}
		m_InsertPos = InsPos;	// update insert position member
		// notify the parent window
		NMLISTVIEW	lvh;
		ZeroMemory(&lvh, sizeof(lvh));
		lvh.hdr.hwndFrom = m_hWnd;
		lvh.hdr.idFrom = GetDlgCtrlID();
		lvh.hdr.code = ULVN_REORDER;
		GetParent()->SendMessage(WM_NOTIFY, lvh.hdr.idFrom, long(&lvh));
		KillTimer(m_ScrollTimer);
		m_ScrollTimer = 0;
		EnsureVisible(min(InsPos, GetItemCount() - 1), FALSE);
	}
}
Example #22
0
void BrushIconBox::SelectFirstBrush() {
	if(tileset && tileset->size() > 0) {
		DeselectAll();
		brush_buttons[0]->SetValue(true);
		EnsureVisible((size_t)0);
	}
}
void CTDLFindTaskExpressionListCtrl::MoveSelectedRuleDown()
{
	if (CanMoveSelectedRuleDown())
	{
		int nRow, nCol;
		GetCurSel(nRow, nCol);

		// save off rule
		SEARCHPARAM sp = m_aSearchParams[nRow];

		// delete rule
		m_aSearchParams.RemoveAt(nRow);
		DeleteItem(nRow);

		// reinsert rule
		nRow = InsertRule(nRow + 1, sp);
	
		// sanity check
		ValidateListData();

		// restore selection
		SetCurSel(nRow, nCol);
		EnsureVisible(nRow, FALSE);
	}
}
void CTuotuoCategoryCtrl::OnLButtonDown(UINT /* nFlags */, CPoint ptCursor)
{
	//CSogouToolTip::GetTooltip()->RelayEventSingleton(m_hWnd, INVALID_ITEM);

	if (::PtInRect(&m_rcTabItemAreaDraw, ptCursor))
	{
		CategoryPosition pos;
		CCategoryItem *pItem = HitTest(ptCursor, &pos);
		if (pItem)
		{
			SetMousePosAndStatus(pos, Btn_MouseDown);
			if (pItem != m_pSelectedItem && pos == CatePos_TabItem)
				FS()->MDI()->ActiveCategory(pItem);
			else if (pItem == m_pSelectedItem)
				EnsureVisible(pItem);
		}
	}
	else if (m_bOverflowLeft && ::PtInRect(&m_rcScrollLLeft, ptCursor))
	{
		SetMousePosAndStatus(CatePos_ScrollLLeftBtn, Btn_MouseDown);
		SetScrollDir(-1);
	}
	else if (m_bOverflowRight && ::PtInRect(&m_rcScrollRRight, ptCursor))
	{
		SetMousePosAndStatus(CatePos_ScrollRRightBtn, Btn_MouseDown);
		SetScrollDir(1);
	}
	else
		SetMousePosAndStatus(CatePos_Unknown, Btn_MouseOut);

	if (m_ePosition != CatePos_Unknown)
		SetCapture();
}
Example #25
0
void SListBoxEx::OnKeyDown( TCHAR nChar, UINT nRepCnt, UINT nFlags )
{
    int  nNewSelItem = -1;
    SWindow *pOwner = GetOwner();
    if (pOwner && (nChar == VK_ESCAPE))
    {
        pOwner->SSendMessage(WM_KEYDOWN, nChar, MAKELONG(nFlags, nRepCnt));
        return;
    }

    if (nChar == VK_DOWN && m_iSelItem < GetItemCount() - 1)
        nNewSelItem = m_iSelItem+1;
    else if (nChar == VK_UP && m_iSelItem > 0)
        nNewSelItem = m_iSelItem-1;
    else if (pOwner && nChar == VK_RETURN)
        nNewSelItem = m_iSelItem;
    else if(nChar == VK_PRIOR)
    {
        OnScroll(TRUE,SB_PAGEUP,0);
    }else if(nChar == VK_NEXT)
    {
        OnScroll(TRUE,SB_PAGEDOWN,0);
    }

    if(nNewSelItem!=-1)
    {
        EnsureVisible(nNewSelItem);
        NotifySelChange(m_iSelItem,nNewSelItem);
    }
}
Example #26
0
void MyGameTreeCtrl::RefreshTree(string* pstrPanelName)
{
	m_mapNode.clear();
	CreateTree();
	m_bInsertData = true;
	EnsureVisible(GetRootItem());
}
Example #27
0
void ProcList::showList(int highlight)
{
	int c = 0;
	Freeze();
	DeleteAllItems();
	for (std::vector<Database::Item>::const_iterator i = list.items.begin(); i != list.items.end(); i++)
	{
		const Database::Symbol *sym = i->symbol;
		double inclusive = i->inclusive;
		double exclusive = i->exclusive;
		float inclusivepercent = i->inclusive * 100.0f / list.totalcount;
		float exclusivepercent = i->exclusive * 100.0f / list.totalcount;

		InsertItem(c, sym->procname.c_str(), -1);
		if(sym->isCollapseFunction || sym->isCollapseModule) {
			SetItemTextColour(c,wxColor(0,128,0));
		}
		setColumnValue(c, COL_EXCLUSIVE,	wxString::Format("%0.2fs",exclusive));
		setColumnValue(c, COL_INCLUSIVE,	wxString::Format("%0.2fs",inclusive));
		setColumnValue(c, COL_EXCLUSIVEPCT,	wxString::Format("%0.2f%%",exclusivepercent));
		setColumnValue(c, COL_INCLUSIVEPCT,	wxString::Format("%0.2f%%",inclusivepercent));
		setColumnValue(c, COL_SAMPLES,		wxString::Format("%0.2fs",exclusive));
		setColumnValue(c, COL_CALLSPCT,		wxString::Format("%0.2f%%",exclusivepercent));
		setColumnValue(c, COL_MODULE,		sym->module.c_str());
		setColumnValue(c, COL_SOURCEFILE,	sym->sourcefile.c_str());
		setColumnValue(c, COL_SOURCELINE,	::toString(sym->sourceline).c_str());

		c++;
	}

	this->SetItemState(highlight, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED|wxLIST_STATE_SELECTED);

	Thaw();
	EnsureVisible(highlight);
}
Example #28
0
void OutputCtrl::ShowLine( int line )
{
   // First make sure the line is not folded.
   EnsureVisible( line );

   line = VisibleFromDocLine( line );

   int firstVisible = GetFirstVisibleLine();
   int lastVisible = firstVisible + ( LinesOnScreen() - 1 );
   if ( line <= firstVisible ) {

      int lines = line - firstVisible;
      if ( lines < -1 ) {
         lines -= LinesOnScreen() / 2;
      }
      LineScroll( 0, lines );

   } else if ( line >= lastVisible ) {

      int lines = line - lastVisible;
      if ( lines > 1 ) {
         lines += LinesOnScreen() / 2;
      }
      LineScroll( 0, lines );
   }
}
Example #29
0
void wxFileCtrl::GoToParentDir()
{
    if (!IsTopMostDir(m_dirName))
    {
        size_t len = m_dirName.Len();
        if (wxEndsWithPathSeparator(m_dirName))
            m_dirName.Remove( len-1, 1 );
        wxString fname( wxFileNameFromPath(m_dirName) );
        m_dirName = wxPathOnly( m_dirName );
#if defined(__DOS__) || defined(__WINDOWS__) || defined(__OS2__)
        if (!m_dirName.empty())
        {
            if (m_dirName.Last() == wxT('.'))
                m_dirName = wxEmptyString;
        }
#elif defined(__UNIX__)
        if (m_dirName.empty())
            m_dirName = wxT("/");
#endif
        UpdateFiles();
        long id = FindItem( 0, fname );
        if (id != wxNOT_FOUND)
        {
            ignoreChanges = true;
            SetItemState( id, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
            EnsureVisible( id );
            ignoreChanges = false;
        }
    }
}
Example #30
0
void CCrystalEditView::Paste()
{
	if (! QueryEditable())
		return;
	if (m_pTextBuffer == NULL)
		return;

	if(m_pTextBuffer->m_bUndoGroup)
		m_pTextBuffer->FlushUndoGroup(this);

	m_pTextBuffer->BeginUndoGroup();

	DeleteCurrentSelection();

	CString text;
	if (GetFromClipboard(text))
	{
		CPoint ptCursorPos = GetCursorPos();
		ASSERT_VALIDTEXTPOS(ptCursorPos);
		int x, y;
		m_pTextBuffer->InsertText(this, ptCursorPos.y, ptCursorPos.x, text, y, x, CE_ACTION_PASTE); //	[JRT]
		ptCursorPos.x = x;
		ptCursorPos.y = y;
		ASSERT_VALIDTEXTPOS(ptCursorPos);
		SetAnchor(ptCursorPos);
		SetSelection(ptCursorPos, ptCursorPos);
		SetCursorPos(ptCursorPos);
		EnsureVisible(ptCursorPos);
	}

	m_pTextBuffer->FlushUndoGroup(this);
}