Esempio n. 1
0
BOOL OpenChart (HWND hWndGraph,
                HANDLE hFile,
                DWORD dwMajorVersion,
                DWORD dwMinorVersion,
                BOOL bChartFile)
   {  // OpenChart
   PGRAPHSTRUCT   pGraph ;
   DISKCHART      DiskChart ;
   BOOL           bSuccess = TRUE ;

   pGraph = pGraphs ;
   if (!pGraph)
      {
      bSuccess = FALSE ;
      goto Exit0 ;
      }

   if (!FileRead (hFile, &DiskChart, sizeof (DISKCHART)))
      {
      bSuccess = FALSE ;
      goto Exit0 ;
      }


   switch (dwMajorVersion)
      {
      case (1):

         SetHourglassCursor() ;
         
         ResetGraphView (hWndGraph) ;

         OpenChartVer1 (hFile, &DiskChart, pGraph) ;

         // change to chart view if we are opening a 
         // chart file
         if (bChartFile && iPerfmonView != IDM_VIEWCHART)
            {
            SendMessage (hWndMain, WM_COMMAND, (LONG)IDM_VIEWCHART, 0L) ;
            }

         if (iPerfmonView == IDM_VIEWCHART)
            {
            SetPerfmonOptions (&DiskChart.perfmonOptions) ;
            }
         
         SetArrowCursor() ;

         break ;
      }  // switch

Exit0:

   if (bChartFile)
      {
      CloseHandle (hFile) ;
      }

   return (bSuccess) ;
   }  // OpenChart
Esempio n. 2
0
void CChildView::EditObject(CContentObj *obj)
{
  if (obj) {
    switch (obj->GetType()) {
    case otTextLabel:
      CTextProps *tp;
      tp = new CTextProps(this);
      tp->m_DlgCaption = "Edit text label";
      tp->m_EditText = ((CContentText*)obj)->GetText();
      if (tp->DoModal() == IDOK) {
        InvalidateObj(obj);
        ((CContentText*)obj)->SetText(tp->m_EditText);
        InvalidateObj(obj);
        theApp.m_map.Content.Modified = TRUE;
      }
      break;
    case otMark:
      SetArrowCursor();
      CNewMarkDlg *dlg;
      CContentMark *cm;
      cm = (CContentMark*)obj;
      dlg = new CNewMarkDlg(this);
      dlg->m_CategoryIdx = cm->Category;
      dlg->m_ShortText = cm->ShortText;
      dlg->m_LongText = cm->LongText;
      dlg->m_Caption = "Edit mark";
      if (dlg->DoModal() == IDOK) {
        InvalidateObj(cm);
        cm->Category = dlg->m_CategoryIdx;
        cm->ShortText = dlg->m_ShortText;
        cm->LongText = dlg->m_LongText;
        InvalidateObj(cm);
        theApp.m_map.Content.Modified = TRUE;
      }
      break;
    }
  }
}
Esempio n. 3
0
void CChildView::OnSelectMode() 
{
  m_NewObjectType = 0;
  SetArrowCursor();	
}
Esempio n. 4
0
void CChildView::OnLButtonDown(UINT nFlags, CPoint point) 
{
  int i;
  CPoint pt;
  CContentObjects& objs = theApp.m_map.Content.Objects;
  CContentObj *o2;
  BOOL ShiftPressed = nFlags & MK_SHIFT;

  if (theApp.m_map.IsEmpty() || m_InPopup) goto mend;

  SetFocus();

  i = m_NewObjectType;
  m_NewObjectType = 0;
  if (i)
    SelectAll(FALSE);
  switch (i) {
  case otTextLabel:
    SetArrowCursor();
    CTextProps *tp;
    tp = new CTextProps(this);
    if (tp->DoModal() == IDOK) {
      CContentText *ct = new CContentText(theApp.m_map.Content);
      ct->StyleIdx = m_DefStyleIdx;
      ct->SetText(tp->m_EditText);
      pt = ScreenToMap(point);
//      ct->SetPosition(pt.x, pt.y);
      ct->SetPosition(pt.x - ct->BoundsRect.Width()/2, pt.y - ct->BoundsRect.Height()/2);
      ct->Plane = theApp.m_map.m_iLevel;
      ct->Selected = TRUE;
      m_ObjSelCount++;
      theApp.m_map.Content.Objects.Add(ct);
      InvalidateObj(ct);
      theApp.m_map.Content.Modified = TRUE;
    }
    return;
  case otMark:
    SetArrowCursor();
    CNewMarkDlg dlg(this);
    if (dlg.DoModal() == IDOK) {
      CContentMark *cm = new CContentMark(theApp.m_map.Content);
      cm->Category = dlg.m_CategoryIdx;
      cm->ShortText = dlg.m_ShortText;
      cm->LongText = dlg.m_LongText;
      pt = ScreenToMap(point);
      cm->SetPosition(pt.x - cm->BoundsRect.Width()/2, pt.y - cm->BoundsRect.Height()/2);
      cm->Plane = theApp.m_map.m_iLevel;
      cm->Selected = TRUE;
      m_ObjSelCount++;
      theApp.m_map.Content.Objects.Add(cm);
      InvalidateObj(cm);
      theApp.m_map.Content.Modified = TRUE;
    }
    return;
  }

  pt = ScreenToMap(point);
  o2 = theApp.m_map.Content.GetObjectAt(pt, theApp.m_map.m_iLevel);

  if (!m_EditorMode) {
    if (ShiftPressed) {
      i = g_pMainFrame->m_cbZoom.GetCurSel();
      if (nFlags & MK_CONTROL) {
        m_LastZoomIdx = i;
        i = 1;
        keybd_event('~', 0, 0, 0);  // Disables kbd layout switching by Ctrl+Shift
      }
      else 
        m_LastZoomIdx = -1;
      if (i > 0) {
        ChangeZoom(point, i - 1);
      }
    }
    else {
      if (o2 && o2->GetType() == otMark && !(theApp.m_map.Content.DrawOptions & cdoHideAll)) {
        BYTE dm = ((CContentMark*)o2)->DisplayMode;
        HideMarkDescriptions();
        if (dm != dmExpanded) {
          ((CContentMark*)o2)->DisplayMode = dmExpanded;
          o2->Selected = FALSE;
          InvalidateObj(o2);
        }
      }
      else {
        m_Moving = FALSE;
        m_ptClick = point;
        SetViewCursor(m_DragHand2Cur);
        SetCapture();
      }
    }
  }
  else {
    SelClick(point); 
    m_ptClick = point;
    SetCapture();
    m_Moving = FALSE;
    if (!o2) {
      m_Selection.left = m_Selection.right = point.x;
      m_Selection.top = m_Selection.bottom = point.y;
    }
    else 
      m_Selection.SetRectEmpty();
  }
mend:  
	CWnd ::OnLButtonDown(nFlags, point);
}