Ejemplo n.º 1
0
//
// Displays the values from memory in the GUI.
//
void CPageDisk::ShowData()
{
	Manager	*manager;
	Worker	*worker;

	// Only enable the display if a disk worker or a manager with disk 
	// interfaces is selected.
	manager = theApp.pView->m_pWorkerView->GetSelectedManager();
	worker = theApp.pView->m_pWorkerView->GetSelectedWorker();
	if (( theApp.pView->m_pWorkerView->GetSelectedType() == ALL_MANAGERS) ||
		( manager && !manager->InterfaceCount( GenericDiskType ) ) ||
		( worker && !IsType( worker->Type(), GenericDiskType ) ) )
	{
		Reset();
		return;
	}

	// This is a new view of the target assignment.  
	// It has not been modified.
	selected = NULL;
	highlighted = NULL;
	// Show the target list.
	ShowTargets();
	// Set the target selection check boxes.
	ShowTargetSelection();
	// Bold the last selected item.
	ShowFocus();
	// Show the connection rate settings.
	ShowConnectionRate();
	// Show the disk specific settings.
	ShowSettings();
	// Enable the apropriate windows and redraw the page.
	EnableWindow();
}
Ejemplo n.º 2
0
void CPageNetwork::SetFocusDown()
{
	HTREEITEM hmgr, hifc;

	hifc = m_TTargets.GetNextSiblingItem(highlighted);
	// Does the currently focused interface have a next sibling?
	if (hifc) {
		// Yes. Set the focus to the sibling.
		highlighted = hifc;
	} else {
		// No.  Set the focus to the first interface on the first manager with 
		// interfaces in the tree after the currently focused interface's 
		// manager.
		hmgr = m_TTargets.GetParentItem(highlighted);
		while (hmgr = m_TTargets.GetNextSiblingItem(hmgr)) {
			if (hifc = m_TTargets.GetChildItem(hmgr)) {
				highlighted = hifc;
				break;
			}
		}
	}

	// Make the focused interface visible, and if possible,
	// also its manager.
	m_TTargets.EnsureVisible(m_TTargets.GetParentItem(highlighted));
	m_TTargets.EnsureVisible(highlighted);
	ShowFocus();
}
Ejemplo n.º 3
0
void CPageDisk::SetFocusHome()
{
	// Set the focus to the first disk.
	highlighted = m_TTargets.GetRootItem();
	// Make the newly focused disk visible.
	m_TTargets.EnsureVisible( highlighted );
	ShowFocus();
}
Ejemplo n.º 4
0
//
// Highlight the first interface of the first manager;
//
void CPageNetwork::SetFocusHome()
{
	highlighted = m_TTargets.GetChildItem(m_TTargets.GetRootItem());

	// Make sure the first manager item is visible.
	m_TTargets.EnsureVisible(m_TTargets.GetRootItem());
	m_TTargets.EnsureVisible(highlighted);
	ShowFocus();
}
Ejemplo n.º 5
0
void CPageDisk::OnSelchangingTTargets(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR;

	theApp.pView->ResetDisplayforNewTest();
	ShowFocus();

	// Return 1 so that the control doesn't update the selection since
	// we are managing it.
	*pResult = 1;
}
Ejemplo n.º 6
0
//
// Sets the focus to the first disk item.
//
void CPageDisk::OnSetfocusTTargets(NMHDR * pNMHDR, LRESULT * pResult)
{
	if (!highlighted) {
		//Find the first disk.
		highlighted = m_TTargets.GetRootItem();
	}
	// If we found a disk, show the focus.
	if (highlighted) {
		ShowFocus();
	}
	*pResult = 0;
}
Ejemplo n.º 7
0
//
// Sets the highlighted item to the first interface.
//
void CPageNetwork::OnSetfocusTTargets(NMHDR * pNMHDR, LRESULT * pResult)
{
	if (!highlighted) {
		//Find the first interface.
		for (HTREEITEM hmgr = m_TTargets.GetRootItem(); hmgr; hmgr = m_TTargets.GetNextSiblingItem(hmgr)) {
			highlighted = m_TTargets.GetChildItem(hmgr);
			if (highlighted) {
				ShowFocus();
				break;
			}
		}
	}
	*pResult = 0;
}
Ejemplo n.º 8
0
//
// Highlight the last interface of the last manager.
//
void CPageDisk::SetFocusEnd()
{
	HTREEITEM hdisk;

	// Get the last disk.
	hdisk = m_TTargets.GetRootItem(); 
	while ( m_TTargets.GetNextSiblingItem( hdisk ) )
		hdisk = m_TTargets.GetNextSiblingItem( hdisk);

	highlighted = hdisk;

	// Make the newly focused disk visible.
	m_TTargets.EnsureVisible( highlighted );
	ShowFocus();
}
Ejemplo n.º 9
0
void CPageDisk::SetFocusDown()
{
	HTREEITEM hdisk;

	hdisk = m_TTargets.GetNextSiblingItem( highlighted );
	// Does the currently selected disk have a next sibling?
	if ( !hdisk )
		return;
	
	// Yes. Set the focus to the sibling.
	highlighted = hdisk;

	// Make the newly focused disk visible.
	m_TTargets.EnsureVisible( highlighted );
	ShowFocus();
}
Ejemplo n.º 10
0
// 
// The SetFocusUp, Down, Home, and End functions handle keyboard input for
// the target tree and move the focus.
//
void CPageDisk::SetFocusUp()
{
	HTREEITEM hdisk;

	hdisk = m_TTargets.GetPrevSiblingItem( highlighted );
	// Does the currently selected interface have a previous sibling?
	if ( !hdisk )
		return;

	// Yes. Set the focus to the sibling.
	highlighted = hdisk;

	// Make the newly focused disk visible.
	m_TTargets.EnsureVisible( highlighted );
	ShowFocus();
}
Ejemplo n.º 11
0
//
// Highlight the last interface of the last manager with an interface.
//
void CPageNetwork::SetFocusEnd()
{
	HTREEITEM hmgr, hifc;

	// Get the last manager.
	hmgr = m_TTargets.GetRootItem();
	while (m_TTargets.GetNextSiblingItem(hmgr))
		hmgr = m_TTargets.GetNextSiblingItem(hmgr);

	// Loop through it's interfaces.
	for (hifc = m_TTargets.GetChildItem(hmgr); hifc; hifc = m_TTargets.GetNextSiblingItem(hifc)) {
		// Set the highlighted item to the last non-null interface.
		highlighted = hifc;
	}

	// Make sure the last item is visible.
	m_TTargets.EnsureVisible(highlighted);
	ShowFocus();
}
Ejemplo n.º 12
0
// 
// The SetFocusUp, Down, Home, and End functions handle keyboard input for
// the target tree and move the focus.
//
void CPageDisk::SetFocusUp()
{
	HTREEITEM hdisk;

	hdisk = m_TTargets.GetPrevSiblingItem(highlighted);

	if (!hdisk) 
		hdisk = m_TTargets.GetParentItem(highlighted);
	else if (m_TTargets.ItemHasChildren(hdisk)) {
		while (m_TTargets.GetChildItem(hdisk)) {
			hdisk = m_TTargets.GetNextSiblingItem(hdisk);
		}
	}
	// Does the currently selected interface have a previous sibling?
	if (!hdisk)
		return;

	// Yes. Set the focus to the sibling.
	highlighted = hdisk;

	// Make the newly focused disk visible.
	m_TTargets.EnsureVisible(highlighted);
	ShowFocus();
}
Ejemplo n.º 13
0
//
// Multi selection keyboard handler for the tree control.
//
void CPageDisk::KeyMultiSel( WORD wVKey )
{
	BOOL shift = GetKeyState( VK_SHIFT ) & 0x8000;
	BOOL control = GetKeyState( VK_CONTROL ) & 0x8000;

	// Make sure there are disks.
	if ( !highlighted )
		return;

	switch ( wVKey )
	{
	case VK_UP:
		if ( !selected && shift )
			selected = highlighted;
		SetFocusUp();
		// Only select items if the shift key is pressed.
		if ( shift )
		{
			SelectRange( selected, highlighted, !control, TargetChecked );
			StoreTargetSelection();
		}
		break;
	case VK_DOWN:
		if ( !selected && shift )
			selected = highlighted;

		SetFocusDown();
		// Only select items if the shift key is pressed.
		if ( shift )
		{
			SelectRange( selected, highlighted, !control, TargetChecked );
			StoreTargetSelection();
		}
		break;
	case VK_HOME:
		if ( !selected && shift )
			selected = highlighted;

		SetFocusHome();
		// Only select items if the shift key is pressed.
		if ( shift )
		{
			SelectRange( selected, highlighted, !control, TargetChecked );
			StoreTargetSelection();
		}
		break;
	case VK_END:
		if ( !selected && shift )
			selected = highlighted;

		SetFocusEnd();
		// Only select items if the shift key is pressed.
		if ( shift )
		{
			SelectRange( selected, highlighted, !control, TargetChecked );
			StoreTargetSelection();
		}
		break;
	case VK_SPACE:
		if ( shift ) 
		{
			// Extend the selection. Clear any other items if the control
			// key is not pressed.
			SelectRange( selected, highlighted, !control, TargetChecked );
		}
		else if ( control )	// toggle.
		{
			// Toggle the selection, but do not clear any other items.
			if ( GetSelectionCheck( highlighted ) == TargetChecked )
			{
				SelectRange( highlighted, highlighted, FALSE, TargetUnChecked );
			}
			else
			{
				SelectRange( highlighted, highlighted, FALSE, TargetChecked );
			}
		}
		else // normal
		{
			// Select only the highlighted item and clear any other.
			SelectRange( highlighted, highlighted, TRUE, TargetChecked );
		}

		ShowFocus();
		StoreTargetSelection();
		break;
	case 'A':
		if ( control )
		{
			SetAllCheck( TargetChecked );
			StoreTargetSelection();
		}
	}
}
Ejemplo n.º 14
0
//
// Single selection keyboard handler for the tree control.
//
void CPageNetwork::KeySingleSel(WORD wVKey)
{
	BOOL shift = GetKeyState(VK_SHIFT) & 0x8000;
	BOOL control = GetKeyState(VK_CONTROL) & 0x8000;

	// Make sure there are interfaces.
	if (!highlighted)
		return;

	switch (wVKey) {
	case VK_UP:
		SetFocusUp();
		// Only select items if the shift key is pressed.
		if (shift) {
			SelectRange(highlighted, highlighted, TRUE, TargetChecked);
			StoreTargetSelection();
		}
		break;
	case VK_DOWN:
		SetFocusDown();
		// Only select items if the shift key is pressed.
		if (shift) {
			SelectRange(highlighted, highlighted, TRUE, TargetChecked);
			StoreTargetSelection();
		}
		break;
	case VK_HOME:
		SetFocusHome();
		// Only select items if the shift key is pressed.
		if (shift) {
			SelectRange(highlighted, highlighted, TRUE, TargetChecked);
			StoreTargetSelection();
		}
		break;
	case VK_END:
		SetFocusEnd();
		// Only select items if the shift key is pressed.
		if (shift) {
			SelectRange(highlighted, highlighted, TRUE, TargetChecked);
			StoreTargetSelection();
		}
		break;
	case VK_SPACE:
		if (control)	// toggle.
		{
			// Toggle the selection, but do not clear any other items.
			if (GetSelectionCheck(highlighted) == TargetChecked) {
				SelectRange(highlighted, highlighted, FALSE, TargetUnChecked);
			} else {
				SelectRange(highlighted, highlighted, FALSE, TargetChecked);
			}
		} else		// normal selection.
		{
			// Extend the selection and clear any other items.
			SelectRange(highlighted, highlighted, TRUE, TargetChecked);
		}

		ShowFocus();
		StoreTargetSelection();
		break;
	}
	ShowSettings();
	EnableWindow();
}
Ejemplo n.º 15
0
  void Text::Draw(OS::DrawInfo* draw,
                  int x, int y, size_t w, size_t h)
  {
    Object::Draw(draw,x,y,w,h);

    if (!OIntersect(x,y,w,h)) {
      return;
    }

    /* --- */

    std::list<Line*>::iterator line;
    int                        xPos,yPos,y2;

    if ((draw->focused || ShowFocus()) &&
        OS::display->GetType()==OS::Display::typeTextual) {
      draw->PushForeground(OS::Display::fillTextColor);
    }
    else {
      draw->PushForeground(GetTextColor(draw,this));
    }

    draw->PushClip(x,y,w,h);

    yPos=this->y;

    if (height>textHeight) {
      yPos+=(height-textHeight) / 2;
    }

    line=text.begin();
    while (line!=text.end()) {

      xPos=this->x; // To make compiler happy
      switch ((*line)->alignment) {
      case left:
        xPos=this->x;
        break;
      case right:
        if (textWidth>width) {
          xPos=this->x+textWidth-(*line)->width;
        }
        else {
          xPos=this->x+width-(*line)->width;
        }
        break;
      case centered:
        xPos=this->x+(width-(*line)->width) / 2;
        break;
      }

      std::list<Part*>::iterator iter;

      iter=(*line)->parts.begin();
      while (iter!=(*line)->parts.end()) {
        Part *part=(*iter);

        draw->PushFont(part->font,part->style);

        y2=yPos+(*line)->ascent;

        if (draw->disabled) {
          draw->PushForeground(OS::Display::textDisabledColor);
          draw->DrawString(xPos-part->hOffset,y2+part->vOffset,part->text);
          draw->PopForeground();
        }
        else if ((part->style & smart) &&
                 OS::display->GetType()!=OS::Display::typeTextual) {
          draw->PushForeground(OS::Display::textSmartAColor);
          draw->DrawString(xPos+1-part->hOffset,y2+part->vOffset,part->text);
          draw->PopForeground();
          draw->PushForeground(OS::Display::textSmartBColor);
          draw->DrawString(xPos-part->hOffset,y2-1+part->vOffset,part->text);
          draw->PopForeground();
        }
        else {
          draw->DrawString(xPos-part->hOffset,y2+part->vOffset,part->text);
        }

        xPos+=part->width;

        draw->PopFont();

        ++iter;
      }

      yPos+=(*line)->height+lineSpace;
      ++line;
    }

    draw->PopClip();
    draw->PopForeground();
  }