Beispiel #1
0
void CStartupView::OnSize(UINT nType, int cx, int cy)
{
   BOOL bHBar, bVBar;
   CheckScrollBars(bHBar, bVBar);
   CScrollView::OnSize(nType, cx, cy);

   int iNewWidth = cx < VIEW_DEFAULT_WIDTH ? VIEW_DEFAULT_WIDTH : cx;
   int iNewHeight = cy < VIEW_DEFAULT_HEIGHT ? VIEW_DEFAULT_HEIGHT : cy;
   
   int nVOffset = 0;
   int nHOffset = 0;
   DWORD dwStyle = AfxGetApp()->GetMainWnd()->GetStyle();
   CRect rcMainWnd;
   AfxGetApp()->GetMainWnd()->GetWindowRect(&rcMainWnd);
   if((dwStyle & WS_MAXIMIZE) != 0 || m_bIsRetFromEditMode)
   {
      nVOffset =  bVBar? 17: 0;
      nHOffset =  bHBar? 17: 0;
   }
   CSize siTotal = GetTotalSize();
   CRect rcClient(0, 0, siTotal.cx, siTotal.cy);

   if (!m_bIsRetFromEditMode || ! m_rcLastMainWndRect.EqualRect(&rcMainWnd)) {
       SetScrollSizes(MM_TEXT, CSize(iNewWidth + nHOffset, iNewHeight + nVOffset));
   } else {
       SetScrollSizes(MM_TEXT, m_szLastSize);
   }

   RepositionButtons();
   UpdateBars();
}
Beispiel #2
0
bool CDComView::IsScrollBarAtBottom()
{
    BOOL bVert, bHorz;
    CheckScrollBars(bHorz, bVert);
    if ((GetScrollPos(SB_VERT) >= GetScrollLimit(SB_VERT)) || (bVert == false))
    {
        return true;
    }
    return false;
}
Beispiel #3
0
void SkeinWindow::SkeinShowNode(Skein::Node* node, Skein::Show why)
{
  if (GetSafeHwnd() == 0)
    return;

  switch (why)
  {
  case Skein::JustShow:
  case Skein::ShowSelect:
  case Skein::ShowNewLine:
    {
      // Work out the position of the node
      int x = (GetTotalSize().cx/2)+node->GetX();
      int y = m_fontSize.cy*((5*node->GetDepth())-1);
      if (y < 0)
        y = 0;

      // Centre the node horizontally
      CRect client;
      GetClientRect(client);
      x -= client.Width()/2;

      // Only change the co-ordinates if there are scrollbars
      BOOL horiz, vert;
      CheckScrollBars(horiz,vert);
      if (horiz == FALSE)
        x = 0;
      if (vert == FALSE)
        y = 0;

      ScrollToPosition(CPoint(x,y));
    }
    break;
  case Skein::ShowNewTranscript:
    break;
  default:
    ASSERT(FALSE);
    break;
  }
}
Beispiel #4
0
void PG_ListBox::EnsureVisible(PG_ListBoxBaseItem *a_poItem)
{
	my_scrollarea->EnsureVisible(a_poItem);
	CheckScrollBars();
}
Beispiel #5
0
void SkeinWindow::OnDraw(CDC* pDC)
{
  // Clear out any previous node positions
  m_nodes.clear();

  // Get the dimensions of the window
  CRect client;
  GetClientRect(client);

  // Create a memory device context
  CDC dc;
  dc.CreateCompatibleDC(pDC);

  // Create a memory bitmap
  CDibSection bitmap;
  if (bitmap.CreateBitmap(pDC->GetSafeHdc(),client.Width(),client.Height()) == FALSE)
    return;
  CBitmap* oldBitmap = CDibSection::SelectDibSection(dc,&bitmap);
  CFont* oldFont = dc.SelectObject(theApp.GetFont(InformApp::FontDisplay));
  CPoint origin = pDC->GetViewportOrg();

  // Clear the background
  dc.FillSolidRect(client,theApp.GetColour(InformApp::ColourBack));

  if (m_skein->IsActive())
  {
    // Redo the layout if needed
    m_skein->Layout(dc,&m_labelFont,m_fontSize.cx*10,false);

    // Work out the position of the centre of the root node
    CPoint rootCentre(origin);
    rootCentre.y += (int)(m_fontSize.cy*2.2);

    // If there is no horizontal scrollbar, centre the root node
    BOOL horiz, vert;
    CheckScrollBars(horiz,vert);
    if (horiz)
      rootCentre.x += GetTotalSize().cx/2;
    else
      rootCentre.x += client.Width()/2;

    // Get the end node of the transcript
    Skein::Node* transcriptEnd = (Skein::Node*)
      GetParentFrame()->SendMessage(WM_TRANSCRIPTEND);

    // Draw all nodes
    DrawNodeTree(m_skein->GetRoot(),transcriptEnd,dc,bitmap,client,
      CPoint(0,0),rootCentre,m_fontSize.cy*5);

    // If the edit window is visible, exclude the area under it to reduce flicker
    if (m_edit.IsWindowVisible())
    {
      CRect editRect;
      m_edit.GetWindowRect(&editRect);
      ScreenToClient(&editRect);
      editRect -= pDC->GetViewportOrg();
      pDC->ExcludeClipRect(editRect);
    }
  }

  // Draw the memory bitmap on the window's device context
  pDC->BitBlt(-origin.x,-origin.y,client.Width(),client.Height(),&dc,0,0,SRCCOPY);

  // Restore the original device context settings
  dc.SelectObject(oldFont);
  dc.SelectObject(oldBitmap);
}
Beispiel #6
0
void PG_WidgetList::PageDown() {
	my_scrollarea->ScrollTo(my_scrollarea->GetScrollPosX(), my_scrollarea->GetScrollPosY() + my_height );
	CheckScrollBars();
}
Beispiel #7
0
void PG_WidgetList::ScrollTo(Uint16 ypos) {
	my_scrollarea->ScrollTo(my_scrollarea->GetScrollPosX(), ypos);
	CheckScrollBars();
}