void ProdRestartGridCtrl::ResetGrid() { static const int maxRestart = 16; productionRestartTimes.ReAlloc(maxRestart); SetRowCount(maxRestart + 1); SetColCount(2); SetCenteredText(0, 1, "Restart Time" ); CString sRowHeader; for (int i = 0; i < maxRestart; i++) { int row = i + 1; sRowHeader.Format("%d", row); SetCenteredText(row, 0, sRowHeader ); if (i > productionRestartTimes.UpperBound()) productionRestartTimes[i] = nullReal; SetCell(row, 1, new ProdRestartTimeGridCell(i)); } SetEditMode(); SetBorderThickness(4); AutoSize(); SetColSize(1, GetColSize(1) + 15); UpdateAllRows(); }
void CReportEntityBox::Copy( CDiagramEntity * obj ) /* ============================================================ Function : CReportEntityBox::Copy Description : Copies the data from "obj" to this object. Access : Public Return : void Parameters : CDiagramEntity * obj - Object to copy from Usage : Call to copy data from "obj" ============================================================*/ { CDiagramEntity::Copy( obj ); CReportEntityBox* copy = static_cast< CReportEntityBox* >( obj ); SetBorderThickness( copy->GetBorderThickness() ); SetBorderStyle( copy->GetBorderStyle() ); SetBorderColor( copy->GetBorderColor() ); SetFill( copy->GetFill() ); SetFillColor( copy->GetFillColor() ); }
BOOL CReportEntityPicture::FromString( const CString& str ) /* ============================================================ Function : CReportEntityPicture::FromString Description : Sets the data of the object from "str". Access : Public Return : BOOL - "TRUE" if the string represents an object of this type. Parameters : const CString& str - String to parse Usage : Call to load objects from a file. ============================================================*/ { BOOL result = FALSE; CString data( str ); if( LoadFromString( data ) ) { CTokenizer tok( data ); double borderthickness; unsigned int borderstyle; unsigned int bordercolor; CString filename; int count = 0; tok.GetAt( count++, borderthickness ); int aaa; tok.GetAt( count++, aaa ); borderstyle=aaa; tok.GetAt( count++, aaa ); bordercolor=aaa; tok.GetAt( count++, filename ); int bt = CUnitConversion::InchesToPixels( borderthickness ); SetBorderThickness( bt ); SetBorderStyle( borderstyle ); SetBorderColor( bordercolor ); UnmakeSaveString( filename ); SetFilename( filename ); int left = CUnitConversion::InchesToPixels( GetLeft() ); int right = CUnitConversion::InchesToPixels( GetRight() ); int top = CUnitConversion::InchesToPixels( GetTop() ); int bottom = CUnitConversion::InchesToPixels( GetBottom() ); CRect rect( left, top, right, bottom ); SetRect( rect ); result = TRUE; } return result; }
void CReportEntityBox::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; } BOX_RESERVE_FIELDS; BOX_RESERVE_FIELDS box_reserve; memset(&box_reserve,0,sizeof(BOX_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int bst = GetBorderStyle( ); ar.Write(&bst,sizeof(unsigned int)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int)); BOOL gf = GetFill(); ar.Write(&gf, sizeof(BOOL)); brC = GetFillColor(); ar.Write(&brC,sizeof(unsigned int)); ar.Write(&box_reserve,sizeof(BOX_RESERVE_FIELDS)); } else { // „итаем double bordhickness; ar.Read(&bordhickness,sizeof(double)); unsigned int bordst; ar.Read(&bordst,sizeof(unsigned int)); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int)); BOOL fil; ar.Read(&fil,sizeof(BOOL)); unsigned int filcolor; ar.Read(&filcolor,sizeof(unsigned int)); ar.Read(&box_reserve,sizeof(BOX_RESERVE_FIELDS)); int bt = CUnitConversion::InchesToPixels( bordhickness ); SetBorderThickness( bt ); SetBorderStyle( bordst ); SetBorderColor( linecolor ); SetFill( fil ); SetFillColor( filcolor ); } }
void CReportEntityPicture::Copy( CDiagramEntity * obj ) /* ============================================================ Function : CReportEntityPicture::Copy Description : Copies data from "obj" to this object. Access : Public Return : void Parameters : CDiagramEntity * obj - Object to copy from Usage : Call to copy data from "obj" to this object. ============================================================*/ { CDiagramEntity::Copy( obj ); CReportEntityPicture* copy = static_cast< CReportEntityPicture* >( obj ); SetBorderThickness( copy->GetBorderThickness() ); SetBorderStyle( copy->GetBorderStyle() ); SetBorderColor( copy->GetBorderColor() ); SetFilename( copy->GetFilename() ); if( m_bitmap ) delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; if (m_image_bits) delete[] m_image_bits; m_image_bits = NULL; if (copy->m_image_size>0 && copy->m_image_bits) { m_image_type = copy->m_image_type; m_image_size = copy->m_image_size; m_image_bits = new BYTE[m_image_size]; memcpy(m_image_bits,copy->m_image_bits,m_image_size); m_bitmap = new CxImage(m_image_bits,m_image_size,m_image_type); if (!m_bitmap->IsValid()) { AfxMessageBox(m_bitmap->GetLastError()); delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; delete[] m_image_bits; m_image_bits = NULL; ASSERT(0); return; } } }
void Initialize() override { __super::Initialize(); SetTitle(L"Test clear edge"); const int count = 3; float x = 0; float width = 100.0f / count; for (int index = 0; index < count; ++index) { auto control = zaf::Create<zaf::Control>(); control->SetBackgroundColor(zaf::Color::White); control->SetBorderColor(zaf::Color::Black); control->SetBorderThickness(1); control->SetRect(zaf::Rect(x, 0, width, 20)); GetRootControl()->AddChild(control); x += width; } }
void ComboBox::Initialize() { __super::Initialize(); SetBorderThickness(1); SetBackgroundColorPicker([](const Control& control) { if (! control.IsEnabled()) { return Color::FromRGB(internal::ControlBackgroundColorRGB); } return Color::FromRGB(internal::ControlContentColorRGB); }); SetBorderColorPicker([](const Control& control) { const auto& combo_box = dynamic_cast<const ComboBox&>(control); if (combo_box.IsPressed() || combo_box.IsHovered()) { return Color::FromRGB(internal::ButtonActivedBorderColorRGB); } return Color::Black; }); SetParagraphAlignment(ParagraphAlignment::Center); drop_down_window_ = Create<internal::ComboBoxDropDownWindow>(); drop_down_window_->SetActivateOption(Window::ActivateOption::NoActivate); drop_down_window_->SetBorderStyle(Window::BorderStyle::None); drop_down_window_->SetInitialRectStyle(Window::InitialRectStyle::Custom); drop_down_list_box_ = Create<DropDownListBox>(); InitializeDropDownListBox(); edit_text_box_ = Create<EditTextBox>(); InitializeEditTextBox(); }
void CReportEntityLine::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; } LINE_RESERVE_FIELDS; LINE_RESERVE_FIELDS line_reserve; memset(&line_reserve,0,sizeof(LINE_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int)); ar.Write(&line_reserve,sizeof(LINE_RESERVE_FIELDS)); } else { // „итаем double linethickness; ar.Read(&linethickness,sizeof(double)); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int)); ar.Read(&line_reserve,sizeof(LINE_RESERVE_FIELDS)); unsigned int lt = CUnitConversion::InchesToPixels( linethickness ); SetBorderThickness( lt ); SetBorderColor( linecolor ); } }
////////////////////////////////////////////////////////////////////////// // high level scripting interface ////////////////////////////////////////////////////////////////////////// HRESULT CPartEmitter::ScCallMethod(CScScript* Script, CScStack* Stack, CScStack* ThisStack, char* Name) { ////////////////////////////////////////////////////////////////////////// // SetBorder ////////////////////////////////////////////////////////////////////////// if(strcmp(Name, "SetBorder")==0) { Stack->CorrectParams(4); int BorderX = Stack->Pop()->GetInt(); int BorderY = Stack->Pop()->GetInt(); int BorderWidth = Stack->Pop()->GetInt(); int BorderHeight = Stack->Pop()->GetInt(); Stack->PushBool(SUCCEEDED(SetBorder(BorderX, BorderY, BorderWidth, BorderHeight))); return S_OK; } ////////////////////////////////////////////////////////////////////////// // SetBorderThickness ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "SetBorderThickness")==0) { Stack->CorrectParams(4); int Left = Stack->Pop()->GetInt(); int Right = Stack->Pop()->GetInt(); int Top = Stack->Pop()->GetInt(); int Bottom = Stack->Pop()->GetInt(); Stack->PushBool(SUCCEEDED(SetBorderThickness(Left, Right, Top, Bottom))); return S_OK; } ////////////////////////////////////////////////////////////////////////// // AddSprite ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "AddSprite")==0) { Stack->CorrectParams(1); char* SpriteFile = Stack->Pop()->GetString(); Stack->PushBool(SUCCEEDED(AddSprite(SpriteFile))); return S_OK; } ////////////////////////////////////////////////////////////////////////// // RemoveSprite ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "RemoveSprite")==0) { Stack->CorrectParams(1); char* SpriteFile = Stack->Pop()->GetString(); Stack->PushBool(SUCCEEDED(RemoveSprite(SpriteFile))); return S_OK; } ////////////////////////////////////////////////////////////////////////// // Start ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "Start")==0) { Stack->CorrectParams(1); m_OverheadTime = Stack->Pop()->GetInt(); Stack->PushBool(SUCCEEDED(Start())); return S_OK; } ////////////////////////////////////////////////////////////////////////// // Stop ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "Stop")==0) { Stack->CorrectParams(0); for(int i=0; i<m_Particles.GetSize(); i++) { delete m_Particles[i]; } m_Particles.RemoveAll(); m_Running = false; Stack->PushBool(true); return S_OK; } ////////////////////////////////////////////////////////////////////////// // Pause ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "Pause")==0) { Stack->CorrectParams(0); m_Running = false; Stack->PushBool(true); return S_OK; } ////////////////////////////////////////////////////////////////////////// // Resume ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "Resume")==0) { Stack->CorrectParams(0); m_Running = true; Stack->PushBool(true); return S_OK; } ////////////////////////////////////////////////////////////////////////// // AddGlobalForce ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "AddGlobalForce")==0) { Stack->CorrectParams(3); char* Name = Stack->Pop()->GetString(); float Angle = Stack->Pop()->GetFloat(); float Strength = Stack->Pop()->GetFloat(); Stack->PushBool(SUCCEEDED(AddForce(Name, CPartForce::FORCE_GLOBAL, 0, 0, Angle, Strength))); return S_OK; } ////////////////////////////////////////////////////////////////////////// // AddPointForce ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "AddPointForce")==0) { Stack->CorrectParams(5); char* Name = Stack->Pop()->GetString(); int PosX = Stack->Pop()->GetInt(); int PosY = Stack->Pop()->GetInt(); float Angle = Stack->Pop()->GetFloat(); float Strength = Stack->Pop()->GetFloat(); Stack->PushBool(SUCCEEDED(AddForce(Name, CPartForce::FORCE_GLOBAL, PosX, PosY, Angle, Strength))); return S_OK; } ////////////////////////////////////////////////////////////////////////// // RemoveForce ////////////////////////////////////////////////////////////////////////// else if(strcmp(Name, "RemoveForce")==0) { Stack->CorrectParams(1); char* Name = Stack->Pop()->GetString(); Stack->PushBool(SUCCEEDED(RemoveForce(Name))); return S_OK; } else return CBObject::ScCallMethod(Script, Stack, ThisStack, Name); }
void DataCaptureGridCtrl::ResetDataCaptureGrid() { // start with a clean slate dataCapture.DataCaptureCleanup(); // set type strings captureTypeStrings.Alloc(5); // always valid captureTypeStrings += "Pressure"; captureTypeStrings += "Flow"; captureTypeStrings += "Production"; if (!control.IsGas()) captureTypeStrings += "Test Zone"; if (control.IsUnconfined()) captureTypeStrings += "Water Table"; pressureCapTypeStrings.Alloc(3); pressureCapTypeStrings += "Test Zone"; pressureCapTypeStrings += "Observation Well"; pressureCapTypeStrings += "Superposition"; flowCapTypeStrings.Alloc(4); flowCapTypeStrings += "Well"; flowCapTypeStrings += "Formation"; flowCapTypeStrings += "Test Zone"; flowCapTypeStrings += "Wellbore Storage"; productionCapTypeStrings.Alloc(4); productionCapTypeStrings += "Well"; productionCapTypeStrings += "Formation"; productionCapTypeStrings += "Test Zone"; productionCapTypeStrings += "Wellbore Storage"; testZoneCapTypeStrings.Alloc(3); testZoneCapTypeStrings += "TZ Temp."; testZoneCapTypeStrings += "TZ Comp."; testZoneCapTypeStrings += "TZ Volume"; waterTableCapTypeStrings.Alloc(1); waterTableCapTypeStrings += "Observation Well"; int maxCol = 6; if (control.IsLayered()) { maxCol++; wellboreZoneStrings.Alloc(layerSpec.GetNWellboreZone()); for (int i = 0; i < wellBoreZones.Size(); i++) { const WellBoreZone& currZone = wellBoreZones[i]; if (!currZone.zoneIsPacker) wellboreZoneStrings += currZone.intervalID; } } if (control.Is1DRadial()) maxCol++; // make sure there are 20 blanks dataCaptureData.ReAlloc(dataCaptureData.Size() + 20); SetRowCount(dataCaptureData.AllocSize() + 1); SetColCount(maxCol); SetCenteredText(0, 1, "Well ID" ); SetCenteredText(0, 2, "Output Type" ); SetCenteredText(0, 3, "Sub-Type" ); int nextCol = 4; if (control.IsLayered()) SetCenteredText(0, nextCol++, "Wellbore Zone" ); SetCenteredText(0, nextCol++, "Radius" ); if (control.Is1DRadial()) SetCenteredText(0, nextCol++, "RadiusUnits" ); SetCenteredText(0, nextCol++, "Output Units" ); CString sRowHeader; for (int i = 0; i < dataCaptureData.AllocSize(); i++) { int row = i + 1; sRowHeader.Format("%d", row); SetCenteredText(row, 0, sRowHeader ); SetCell(row, 1, new DcapDesigGridCell(i)); SetCell(row, 2, new CaptureTypeGridCell(i)); SetCell(row, 3, new CaptureSubTypeGridCell(i)); nextCol = 4; if (control.IsLayered()) SetCell(row, nextCol++, new DcapWellboreZoneDesigGridCell(i)); SetCell(row, nextCol++, new DataCaptureRadiusGridCell(i)); if (control.Is1DRadial()) SetCell(row, nextCol++, new RadUnitsGridCell(i)); SetCell(row, nextCol++, new OutputUnitsGridCell(i)); // reset all data for (int j = 1; j < maxCol; j++) ResetCell(i + 1, j); } SetEditMode(); SetBorderThickness(4); AutoSize(); for (int j = 1; j < maxCol; j++) SetColSize(j, GetColSize(j) + 15); InvalidateAll(); }
void CReportEntityPicture::Serialize(CArchive& ar) { typedef struct { int a_f; int b_f; int c_f; int d_f; } PIC_RESERVE_FIELDS; PIC_RESERVE_FIELDS pic_reserve; memset(&pic_reserve,0,sizeof(PIC_RESERVE_FIELDS)); CDiagramEntity::Serialize(ar); if (ar.IsStoring()) { // —охран¤ем double thickness = CUnitConversion::PixelsToInches( GetBorderThickness() ); ar.Write(&thickness,sizeof(double)); unsigned int bst = GetBorderStyle( ); ar.Write(&bst,sizeof(unsigned int)); unsigned int brC = GetBorderColor( ); ar.Write(&brC,sizeof(unsigned int )); ar.Write(&pic_reserve,sizeof(PIC_RESERVE_FIELDS)); if (m_image_size>0 && m_image_bits) { ar.Write(&m_image_type,sizeof(int)); ar.Write(&m_image_size,sizeof(unsigned int)); ar.Write(m_image_bits,sizeof(BYTE)*m_image_size); } } else { // „итаем double bordhickness; ar.Read(&bordhickness,sizeof(double)); unsigned int bordst; ar.Read(&bordst,sizeof(unsigned int )); unsigned int linecolor; ar.Read(&linecolor,sizeof(unsigned int )); ar.Read(&pic_reserve,sizeof(PIC_RESERVE_FIELDS)); int bt = CUnitConversion::InchesToPixels( bordhickness ); SetBorderThickness( bt ); SetBorderStyle( bordst ); SetBorderColor( linecolor ); if( m_bitmap ) delete m_bitmap; m_bitmap = NULL; m_image_type = -1; m_image_size = 0; if (m_image_bits) delete[] m_image_bits; m_image_bits = NULL; ar.Read(&m_image_type,sizeof(int)); ar.Read(&m_image_size,sizeof(unsigned int)); if (m_image_size==0) return; try { m_image_bits = new BYTE[m_image_size]; } catch (std::bad_alloc) { AfxMessageBox("bad_alloc exception in Serialize function"); ASSERT(0); return; } if (ar.Read(m_image_bits,m_image_size*sizeof(BYTE))!=m_image_size*sizeof(BYTE)) { delete[] m_image_bits; m_image_bits=NULL; m_image_type = -1; m_image_size = 0; ASSERT(0); return; } m_bitmap = new CxImage(m_image_bits, m_image_size, m_image_type); if (!m_bitmap->IsValid()) { AfxMessageBox(m_bitmap->GetLastError()); delete m_bitmap; m_bitmap = NULL; delete[] m_image_bits; m_image_bits=NULL; m_image_type = -1; m_image_size = 0; ASSERT(0); return; } } }
void TestZoneCurveGridCtrl::ResetTestZoneCurveGrid() { // start with a clean slate sequence.SequenceCleanup(); // set type strings curveTypeStrings.Alloc(6); curveTypeMap.Alloc(6); // always valid curveTypeStrings += "Pressure"; curveTypeMap += TestZoneCurve::tzPressure; curveTypeStrings += "Flow"; curveTypeMap += TestZoneCurve::tzFlowRate; if (testZoneTemperatureVaries && control.IsLiquid()) { curveTypeStrings += "Temperature"; curveTypeMap += TestZoneCurve::tzTemperature; } if (testZoneCompressibilityVaries && control.IsLiquid()) { curveTypeStrings += "Compressibility"; curveTypeMap += TestZoneCurve::tzCompressibility; } if (testZoneVolumeVaries) { curveTypeStrings += "Volume Change"; curveTypeMap += TestZoneCurve::tzDeltaVolume; curveTypeStrings += "Volume"; curveTypeMap += TestZoneCurve::tzAbsVolume; } // curve file desigs if (control.UseCurveFiles()) { nsCurveFileStatics::testZoneBCCurveFile.GetIDs(curveFileDesigStrings); } else { curveFOOK = AppMenuC::GetFuncObjList(typeid(DO_Curve), curveFOStrings, curveFOData, " "); } // and sequences sequence.GetSequenceIDs(sequenceDesigStrings); // make sure there are 20 blanks testZoneCurves.ReAlloc(testZoneCurves.Size() + 20); SetRowCount(testZoneCurves.AllocSize() + 1); SetColCount(6); SetCenteredText(0, 1, "Type" ); if (control.UseCurveFiles()) SetCenteredText(0, 2, "Curve ID" ); else SetCenteredText(0, 2, "Curve Object" ); SetCenteredText(0, 3, "Start Sequence" ); SetCenteredText(0, 4, "End Sequence" ); SetCenteredText(0, 5, "Curve Data" ); CString sRowHeader; for (int i = 0; i < testZoneCurves.AllocSize(); i++) { int row = i + 1; sRowHeader.Format("%d", row); SetCenteredText(row, 0, sRowHeader ); SetCell(row, 1, new CurveTypeGridCell(i)); if (control.UseCurveFiles()) SetCell(row, 2, new CurveDesigGridCell(i)); else SetCell(row, 2, new CurveFOGridCell(i)); SetCell(row, 3, new StartSequenceDesigGridCell(i)); SetCell(row, 4, new EndSequenceDesigGridCell(i)); SetCell(row, 5, new TZDataGridCell(i)); // reset all data for (int j = 1; j < 6; j++) ResetCell(i + 1, j); } SetEditMode(); SetBorderThickness(4); AutoSize(); for (int j = 1; j < 6; j++) SetColSize(j, GetColSize(j) + 15); InvalidateAll(); }