void ProdRestartGridCtrl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
  int index = m_cellActive.m_nRow - 1;

  UnitReal temp(productionRestartUnits, productionRestartTimes[index]);
  if (temp.IsWithinRange(szText, -1.0E+08, 1.0E+08))
  {
    productionRestartTimes[index] = temp.GetMetricVal();
    if (index > productionRestartTimes.UpperBound())
      productionRestartTimes.SetSize(index + 1);
  }
  StopEdit(false);

  UpdateAllRows();


  // if the right key continue editing on next cell
  switch (nLastChar) {
  case VK_TAB:
  case VK_DOWN:
  case VK_UP:
  case VK_RIGHT:
  case VK_LEFT:
  case VK_NEXT:
  case VK_PRIOR:
  case VK_HOME:
  case VK_END:
    OnKeyDown(nLastChar, 0, 0);
    UpdateWindow();
    if (m_cellActive != m_cellActiveOld)
      StartEdit(nLastChar);
    break;
  }
}
Beispiel #2
0
void XYGridControl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
    int nIndex = m_cellActive.m_nRow - 1;

    // Change values in Grid
    CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
    double val;
    switch (m_cellActive.m_nCol) {
    case 1: // X
        if (!IsValidReal(szText, val))
        {
            val = nullReal;
        }
        if (nIndex < xyData.Size())
        {
            xyData[nIndex].x = val;
        }
        else
        {
            xyData.SetAtGrow(nIndex, XYItem(val, 0.0));
        }
        break;
    case 2: // Y
        if (!IsValidReal(szText, val))
        {
            val = nullReal;
        }
        if (nIndex < xyData.Size())
        {
            xyData[nIndex].y = val;
        }
        else
        {
            xyData.SetAtGrow(nIndex, XYItem(0.0, val));
        }
        break;
    }

    ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

    StopEdit(false);

    // if the right key continue editing on next cell
    switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
    }
}
Beispiel #3
0
void ArpIntControl::StartEdit()
{
	// If I've lost the active state while waiting, don't start editing.
	if ( !Window() || !Window()->IsActive() ) return;
	
	StopEdit(false);
	StopTimer();
	
	BRect		b = ControlBounds();
	float		borderL = b.left;
	float		bottomIndent = 0;
	float		stringIndent = 3;
	BPoint		origin( borderL + 3, b.bottom - bottomIndent - stringIndent );
	
	if (!mTextCtrl) {
		BFont font;
		GetFont(&font);
		mTextCtrl = new ArpInlineTextView(BMessenger(this),
										  "text:edit", &font,
										  origin.x, b.right-2, origin.y);
	}
	if (!mTextCtrl) return;
	
	SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	
	mTextCtrl->MoveOver(origin.x, b.right-2, origin.y);
	mTextCtrl->SetViewColor( Prefs().GetColor(ARP_INT_BGF_C));
	mTextCtrl->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
	BString16		str;
	GetValueLabel(Value(), str);
	mTextCtrl->SetText( str.String() );
	AddChild(mTextCtrl);
}
Beispiel #4
0
    void ColorMapGridControl::FinishEdit(const char* szText, int nValue, int nLastChar)
    {
        int rowIndex = m_cellActive.m_nRow - 1;
        int colIndex = m_cellActive.m_nCol - 1;

        double val;
        if ((!IsValidReal(szText, val)) || (val < 0.0) || (val > 1.0))
            val = 0.0;

        SC_ColorSpec& currSpec = gColorMap.colorMapColors[rowIndex];

        switch (colIndex )
            {
            case 0 : {currSpec.RH = val; break;}
            case 1 : {currSpec.GS = val; break;}
            case 2 : {currSpec.BV = val; break;}
            case 3 : {break;}
            }

        if (rowIndex >= gColorMap.ncolorMap)
            {
                for (int i = gColorMap.ncolorMap; i < rowIndex; i++)
                    gColorMap.colorMapColors[i] = SC_ColorSpec(0.0, 0.0, 0.0);
                m_nCurrRow = gColorMap.ncolorMap - 1;
                gColorMap.ncolorMap = rowIndex + 1;
                UpdateModifiedRows();
            }
        else
            {
                for (int j = 1; j < GetColCount(); j++)
                    {
                        CGridCell* pCell = GetCell(rowIndex + 1, j);
                        pCell->UpdateText();
                        InvalidateCell(rowIndex + 1, j);
                    }
            }

        ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

        StopEdit(false);

        // if the right key continue editing on next cell
        switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
        }
    }
Beispiel #5
0
void ArpIntControl::MouseMoved(	BPoint pt,
								uint32 code,
								const BMessage* msg)
{
	BRect	cb = ControlBounds();
	if (!(cb.Contains(pt))) {
		StopEdit();
		StopTimer();
	}

	if (IsEnabled() == false) return;
	if (mMotion) mMotion->MouseMoved(pt, code, msg);
}
Beispiel #6
0
void ArpIntControl::MessageReceived(BMessage *msg)
{
	switch (msg->what) {
		case EDIT_START_MSG:
			StartEdit();
			break;
		case INLINE_FINALUPDATE_MSG:
			StopEdit();
			break;
		default:
			inherited::MessageReceived(msg);
			break;
	}
}
void CQuickEdit::OnKillFocus (CWnd* pNewWnd) 
{
    CEdit::OnKillFocus(pNewWnd);

	//End edit?
	if(!m_isClosing)
	{
		if(m_endOnLostFocus)
		{
			StopEdit(false);
		}
		else
		{
			//Notify list parent
			pListCtrl->GetParent()->SendMessage(	WM_QUICKLIST_EDITINGLOSTFOCUS,
													(WPARAM) pListCtrl->GetSafeHwnd(),
													0);
		}
	}
}
void CQuickEdit::OnChar (UINT nChar, UINT nRepCnt, UINT nFlags) 
{
    BOOL Shift = GetKeyState (VK_SHIFT) < 0;
    switch (nChar)
    {
		case VK_ESCAPE :
		{	
			//GetParent()->SetFocus();
			StopEdit(TRUE, VK_ESCAPE);
			return;
		}
		case VK_RETURN :
		{
			pListCtrl->EditSubItem (Item + 1, SubItem);
			//StopEdit(FALSE, VK_RETURN);
			//bEscape = FALSE;
			//SetListText();
			//GetParent()->SetFocus();
			
			return;
		}
		/*case VK_UP :
		{
			pListCtrl->EditSubItem (Item - 1, SubItem);
			return;
		}
		case VK_DOWN :
		{
			pListCtrl->EditSubItem (Item + 1, SubItem);
			return;
		}*/
    }

    CEdit::OnChar (nChar, nRepCnt, nFlags);
 
}
Beispiel #9
0
void DataCaptureGridCtrl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
  dataCaptureUIChange = true;

  int dCapIndex = m_cellActive.m_nRow - 1;

  bool wasInvalid  = (dataCaptureData.IsNotValid(dCapIndex));

  dataCapture.CheckAndAllocDataCapture(dCapIndex);
  DataCaptureSpec& currRef = dataCaptureData.GetRef(dCapIndex);

  // Change values in Grid
  CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);

  int currCol = m_cellActive.m_nCol;
  if ((!control.IsLayered()) && (currCol > 3))
    currCol++;

  if (control.Is2DRadial() && (currCol == 6))
    currCol = 7;

  switch (currCol) {
  case 1: // desig
  {
    if (!SameString(currRef.dataDesig, szText))
      currRef.makeDefaultDataDesig = false;

    CopyString(currRef.dataDesig, szText, DataCaptureSpec::dataDesigLen);

    if ((dCapIndex == 0) && (currRef.IsWell() && currRef.IsPressure()))
    {
      // changing main well name -- change for flow too
      if (dataCaptureData.IsValid(1))
      {
        DataCaptureSpec& flowRef = dataCaptureData.GetRef(1);
        if (flowRef.IsFlow() && flowRef.IsWell())
        {
          CopyString(flowRef.dataDesig, szText, DataCaptureSpec::dataDesigLen);
          ResetCell(2, 1);
        }
      }
    }
    // adding new -- assume obs well
    if (wasInvalid)
    {
      currRef.captureType = DataCaptureSpec::ctPressure;
      currRef.pressureCapType = DataCaptureSpec::pctRadius;
    }
    break;
  }
  case 2: // Type
  {
    static_cast<CaptureTypeGridCell*>(pCell)->SetDataCaptureType(nValue);
    break;

  }
  case 3: // sub-type
  {
    static_cast<CaptureSubTypeGridCell*>(pCell)->SetDataCaptureSubType(nValue);
    break;
  }
  case 4: // zone
  {
    static_cast<DcapWellboreZoneDesigGridCell*>(pCell)->SetWellboreZone(nValue);
    break;
  }
  case 5: // radii
  {
    if (currRef.UsesRadius())
    {
      if (currRef.IsPressure() && (control.Is2DRadial() || control.IsHorizontalAnisotropic()))
        ResetCell(m_cellActive.m_nRow, 5);
      else
        currRef.radiusData.IsWithinRange(szText, 0.001, 1.0E+05);
    }
    break;
  }
  case 6: // radii units
  {
    if (currRef.UsesRadiusUnits())
    {
      currRef.radiusData.SetConvIndex(nValue);
      if (currRef.UsesRadius())
        ResetCell(m_cellActive.m_nRow, 4);
    }
    break;
  }
  case 7: // output units
  {
    currRef.outputUnits.SetConvIndex(nValue);
    break;
  }

  }

  // update all
  for (int i = 1; i < GetColCount(); i++)
    ResetCell(m_cellActive.m_nRow, i);

  OutputUnitsGridCell* currCell = static_cast<OutputUnitsGridCell*>(GetCell(m_cellActive.m_nRow, GetColCount() - 1));
  currCell->SetUnitType(currRef.outputUnits.unitType);

  if (dataCapture.SetDataCaptureDesigs())
  {
    for (int i = m_cellActive.m_nRow; i < GetRowCount(); i++)
      ResetCell(i, 1);
  }

  StopEdit(false);

  // if the right key continue editing on next cell
  switch (nLastChar) {
  case VK_TAB:
  case VK_DOWN:
  case VK_UP:
  case VK_RIGHT:
  case VK_LEFT:
  case VK_NEXT:
  case VK_PRIOR:
  case VK_HOME:
  case VK_END:
    OnKeyDown(nLastChar, 0, 0);
    UpdateWindow();
    if (m_cellActive != m_cellActiveOld)
      StartEdit(nLastChar);
    break;
  }
}
Beispiel #10
0
void TestZoneCurveGridCtrl::FinishEdit(const char* szText, int nValue, int nLastChar)
{
    int tzcIndex = m_cellActive.m_nRow - 1;

    bool updateAll = (testZoneCurves.IsNotValid(tzcIndex));

    sequence.CheckAndAllocTestZoneCurve(tzcIndex);
    TestZoneCurve& currTZC = testZoneCurves.GetRef(tzcIndex);

    // Change values in Grid
    CGridCell* pCell = GetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
    switch (m_cellActive.m_nCol) {
    case 1: // Type
        {
            static_cast<CurveTypeGridCell*>(pCell)->SetTestZoneCurveType(nValue);
            break;

        }
    case 2: // ID
        {
            if (control.UseCurveFiles())
                static_cast<CurveDesigGridCell*>(pCell)->SetTestZoneCurveDesig(nValue);
            else
                static_cast<CurveFOGridCell*>(pCell)->SetTestZoneCurveFO(nValue);
            break;
        }
    case 3: // start seq
        {
            static_cast<StartSequenceDesigGridCell*>(pCell)->SetStartSequence(nValue);
            ResetCell(m_cellActive.m_nRow, 4);
            break;
        }
    case 4: // end seq
        {
            static_cast<EndSequenceDesigGridCell*>(pCell)->SetEndSequence(nValue);
            break;
        }
    case 5: // seq data or duration status
        {
        }
        break;
    }


    if (updateAll)
    {
        for (int i = 1; i < GetColCount(); i++)
            ResetCell(m_cellActive.m_nRow, i);
    }
    else
    {
        ResetCell(m_cellActive.m_nRow, m_cellActive.m_nCol);
        ResetCell(m_cellActive.m_nRow, 5);
    }


    StopEdit(false);

    // if the right key continue editing on next cell
    switch (nLastChar) {
        case VK_TAB:
        case VK_DOWN:
        case VK_UP:
        case VK_RIGHT:
        case VK_LEFT:
        case VK_NEXT:
        case VK_PRIOR:
        case VK_HOME:
        case VK_END:
            OnKeyDown(nLastChar, 0, 0);
            UpdateWindow();
            if (m_cellActive != m_cellActiveOld)
                StartEdit(nLastChar);
            break;
    }
}