Commit 31d370ec authored by Aleksandr Bakhshiev's avatar Aleksandr Bakhshiev
Browse files

Gui/Bcb: Fixed new graphs bugs

--HG--
branch : DataSrcs
parent 3fa993768f1c
......@@ -161,6 +161,7 @@ void TUComponentsListFrame::AClearInterface(void)
CurrentPath.clear();
SelectedComponentOutput.clear();
SelectedComponentInput.clear();
SelectedComponentPropertyName.clear();
SelectedId=-1;
......@@ -201,6 +202,7 @@ void TUComponentsListFrame::ALoadParameters(RDK::USerStorageXML &xml)
SelectedComponentParameterName.clear();
SelectedComponentStateName.clear();
CurrentPath.clear();
SelectedComponentPropertyName.clear();
}
......@@ -400,78 +402,6 @@ __finally
UpdateInterfaceFlag=false;
}
//
void TUComponentsListFrame::UpdateParametersList(void)
{
/* if(PageControl1->ActivePage != TabSheet4)
return;
UpdateInterfaceFlag=true;
std::string xml_data=Model_GetComponentParametersEx(GetSelectedComponentLongName().c_str());
RDK::USerStorageXML xml;
xml.Load(xml_data,"");
xml.SelectNode("Parameters");
int num=xml.GetNumNodes();
ParametersListStringGrid->RowCount=1+num;
ParametersListStringGrid->ColCount=1+3;
if(ParametersListStringGrid->RowCount>1)
ParametersListStringGrid->FixedRows=1;
ParametersListStringGrid->Cells[0][0]="#";
ParametersListStringGrid->Cells[1][0]="Name";
ParametersListStringGrid->Cells[2][0]="Value";
ParametersListStringGrid->Cells[3][0]="Description";
for(int i=1;i<ParametersListStringGrid->ColCount;i++)
ParametersListStringGrid->ColWidths[i]=10;
for(int i=0;i<num;i++)
{
ParametersListStringGrid->Cells[0][i+1]=IntToStr(i);
xml.SelectNode(i);
ParametersListStringGrid->Cells[1][i+1]=xml.GetNodeName().c_str();
if(xml.GetNumNodes() == 0)
ParametersListStringGrid->Cells[2][i+1]=xml.GetNodeText().c_str();
else
{
std::string value;
xml.SaveFromNode(value);
ParametersListStringGrid->Cells[2][i+1]=value.c_str();
}
int global_width=ParametersListStringGrid->ColWidths[0];
ParametersListStringGrid->Cells[3][i+1]=xml.GetNodeAttribute("Header").c_str();
int width=ParametersListStringGrid->Canvas->TextWidth(ParametersListStringGrid->Cells[1][i+1])+10;
if(width>ParametersListStringGrid->Width/2)
width=ParametersListStringGrid->Width/2;
if(ParametersListStringGrid->ColWidths[1]<width)
ParametersListStringGrid->ColWidths[1]=width;
global_width+=ParametersListStringGrid->ColWidths[1];
width=ParametersListStringGrid->Canvas->TextWidth(ParametersListStringGrid->Cells[2][i+1])+10;
if(width>ParametersListStringGrid->Width/2)
width=ParametersListStringGrid->Width/2;
if(ParametersListStringGrid->ColWidths[2]<width)
ParametersListStringGrid->ColWidths[2]=width;
global_width+=ParametersListStringGrid->ColWidths[2];
width=ParametersListStringGrid->Canvas->TextWidth(ParametersListStringGrid->Cells[3][i+1])+10;
if(width < ParametersListStringGrid->Width-global_width)
width=ParametersListStringGrid->Width-global_width;
if(ParametersListStringGrid->ColWidths[3]<width)
ParametersListStringGrid->ColWidths[3]=width;
xml.SelectUp();
}
SelectedComponentParameterName=AnsiString(ParametersListStringGrid->Cells[1][1]).c_str();
ParameterValueRichEdit->Text=ParametersListStringGrid->Cells[2][ParametersListStringGrid->Row];
UpdateInterfaceFlag=false; */
}
//
void TUComponentsListFrame::UpdateNiceParamsList(TEnchancedSG *frame)
{
......@@ -715,76 +645,6 @@ __finally
UpdateInterfaceFlag=false;
}
//
void TUComponentsListFrame::UpdateStatesList(void)
{
/* if(PageControl1->ActivePage != TabSheet5)
return;
UpdateInterfaceFlag=true;
std::string xml_data=Model_GetComponentState(GetSelectedComponentLongName().c_str());
RDK::USerStorageXML xml;
xml.Load(xml_data,"");
xml.SelectNode("State");
int num=xml.GetNumNodes();
StatesListStringGrid->RowCount=1+num;
StatesListStringGrid->ColCount=1+3;
if(StatesListStringGrid->RowCount>1)
StatesListStringGrid->FixedRows=1;
StatesListStringGrid->Cells[0][0]="#";
StatesListStringGrid->Cells[1][0]="Name";
StatesListStringGrid->Cells[2][0]="Value";
StatesListStringGrid->Cells[3][0]="Description";
for(int i=1;i<StatesListStringGrid->ColCount;i++)
StatesListStringGrid->ColWidths[i]=10;
for(int i=0;i<num;i++)
{
StatesListStringGrid->Cells[0][i+1]=IntToStr(i);
xml.SelectNode(i);
StatesListStringGrid->Cells[1][i+1]=xml.GetNodeName().c_str();
if(xml.GetNumNodes() == 0)
StatesListStringGrid->Cells[2][i+1]=xml.GetNodeText().c_str();
else
{
std::string value;
xml.SaveFromNode(value);
StatesListStringGrid->Cells[2][i+1]=value.c_str();
}
int global_width=StatesListStringGrid->ColWidths[0];
StatesListStringGrid->Cells[3][i+1]=xml.GetNodeAttribute("Header").c_str();
int width=StatesListStringGrid->Canvas->TextWidth(StatesListStringGrid->Cells[1][i+1])+10;
if(width>StatesListStringGrid->Width/2)
width=StatesListStringGrid->Width/2;
if(StatesListStringGrid->ColWidths[1]<width)
StatesListStringGrid->ColWidths[1]=width;
global_width+=StatesListStringGrid->ColWidths[1];
width=StatesListStringGrid->Canvas->TextWidth(StatesListStringGrid->Cells[2][i+1])+10;
if(width>StatesListStringGrid->Width/2)
width=StatesListStringGrid->Width/2;
if(StatesListStringGrid->ColWidths[2]<width)
StatesListStringGrid->ColWidths[2]=width;
global_width+=StatesListStringGrid->ColWidths[2];
width=StatesListStringGrid->Canvas->TextWidth(StatesListStringGrid->Cells[3][i+1])+10;
if(width < StatesListStringGrid->Width-global_width)
width=StatesListStringGrid->Width-global_width;
if(StatesListStringGrid->ColWidths[3]<width)
StatesListStringGrid->ColWidths[3]=width;
xml.SelectUp();
}
SelectedComponentStateName=AnsiString(StatesListStringGrid->Cells[1][1]).c_str();
UpdateInterfaceFlag=false; */
}
//
void TUComponentsListFrame::UpdateSelectedComponentInfo(void)
{
......@@ -910,6 +770,13 @@ const std::string& TUComponentsListFrame::GetSelectedComponentInput(void) const
return SelectedComponentInput;
}
// ( )
const std::string& TUComponentsListFrame::GetSelectedComponentPropertyName(void) const
{
return SelectedComponentPropertyName;
}
// - xml
bool TUComponentsListFrame::GetShowXMLComponentParameters(void) const
{
......@@ -1152,7 +1019,7 @@ void __fastcall TUComponentsListFrame::StateHeaderControlSectionClick(THeaderCon
void __fastcall TUComponentsListFrame::OutputsStringGridClick(TObject *Sender)
{
SelectedComponentOutput=AnsiString(OutputsStringGrid->Cells[0][OutputsStringGrid->Row]).c_str();
SelectedComponentPropertyName=SelectedComponentOutput=AnsiString(OutputsStringGrid->Cells[0][OutputsStringGrid->Row]).c_str();
}
//---------------------------------------------------------------------------
......@@ -1184,7 +1051,7 @@ void __fastcall TUComponentsListFrame::InputsStringGridDblClick(TObject *Sender)
void __fastcall TUComponentsListFrame::InputsStringGridClick(TObject *Sender)
{
SelectedComponentInput=AnsiString(InputsStringGrid->Cells[0][InputsStringGrid->Row]).c_str();
SelectedComponentPropertyName=SelectedComponentInput=AnsiString(InputsStringGrid->Cells[0][InputsStringGrid->Row]).c_str();
}
//---------------------------------------------------------------------------
......@@ -1635,7 +1502,7 @@ void __fastcall TUComponentsListFrame::EnchancedSG1BasicStringGridSelectCell(TOb
TProperty p;
EnchancedSG1->m_storage.GetPropertyByIndex(ARow-1, &p);
NiceParamValRichEdit->Text = p.GetString();
SelectedComponentParameterName=AnsiString(EnchancedSG1->BasicStringGrid->Cells[1][ARow]).c_str();
SelectedComponentPropertyName=SelectedComponentParameterName=AnsiString(EnchancedSG1->BasicStringGrid->Cells[1][ARow]).c_str();
}
}
......@@ -1650,7 +1517,7 @@ void __fastcall TUComponentsListFrame::EnchancedSG2BasicStringGridSelectCell(TOb
TProperty p;
EnchancedSG2->m_storage.GetPropertyByIndex(ARow-1, &p);
NiceStateValRichEdit->Text = p.GetString();
SelectedComponentStateName=AnsiString(EnchancedSG2->BasicStringGrid->Cells[1][ARow]).c_str();
SelectedComponentPropertyName=SelectedComponentStateName=AnsiString(EnchancedSG2->BasicStringGrid->Cells[1][ARow]).c_str();
}
}
//---------------------------------------------------------------------------
......
......@@ -30,6 +30,8 @@ inherited UComponentsListFrame: TUComponentsListFrame
TabOrder = 0
TabPosition = tpBottom
OnChange = PageControl1Change
ExplicitLeft = -2
ExplicitTop = 2
object TabSheet6: TTabSheet
Caption = 'Parameters List'
ImageIndex = 5
......
......@@ -204,6 +204,9 @@ protected: // User declarations
//
std::string SelectedComponentInput;
// ( )
std::string SelectedComponentPropertyName;
// true
bool TreeReadOnlyFlag;
......@@ -283,6 +286,9 @@ public:
//
const std::string& GetSelectedComponentInput(void) const;
// ( )
const std::string& GetSelectedComponentPropertyName(void) const;
// - xml
bool GetShowXMLComponentParameters(void) const;
......@@ -346,12 +352,6 @@ void UpdateState(void);
// -
void UpdateIO(void);
//
void UpdateParametersList(void);
//
void UpdateStatesList(void);
//
void UpdateNiceParamsList(TEnchancedSG *frame);
......
......@@ -169,7 +169,11 @@ void __fastcall TUWatchForm::DeletePage1Click(TObject *Sender)
void __fastcall TUWatchForm::RenamePage1Click(TObject *Sender)
{
// RenamePage(PageControl->ActivePageIndex);
String value = InputBox("Rename page", "Please enter new name", PageControl->Pages[PageControl->ActivePageIndex]->Caption);
if(value.Length()==0)
return;
PageControl->Pages[PageControl->ActivePageIndex]->Caption=value;
}
//---------------------------------------------------------------------------
......
......@@ -3,29 +3,25 @@ object UWatchForm: TUWatchForm
Top = 232
BorderIcons = [biSystemMenu, biMinimize, biMaximize, biHelp]
Caption = 'Watch'
ClientHeight = 433
ClientWidth = 684
ClientHeight = 346
ClientWidth = 547
Color = clBtnFace
DoubleBuffered = True
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Height = -10
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
OnPaint = FormPaint
PixelsPerInch = 120
TextHeight = 16
PixelsPerInch = 96
TextHeight = 13
object PageControl: TPageControl
Left = 0
Top = 0
Width = 684
Height = 433
Margins.Left = 4
Margins.Top = 4
Margins.Right = 4
Margins.Bottom = 4
Width = 547
Height = 346
Align = alClient
DoubleBuffered = True
HotTrack = True
......
......@@ -463,8 +463,7 @@ int __fastcall TUWatchFrame::GetNumWatches(void)
int __fastcall TUWatchFrame::Add(TUWatchInfo& wd)
{
SelectedSeriesIndex=-1;
if(wd.XOutputIndex.empty() || wd.YOutputIndex.empty())
{
// ,
int seriesindex=-1;
......@@ -473,13 +472,10 @@ int __fastcall TUWatchFrame::Add(TUWatchInfo& wd)
int i=0;
while(I != NameList.end())
{
if((wd.Type != 0x200 && wd.Type !=0x400) ||
(I->XDataSourceName == wd.XDataSourceName &&
I->YDataSourceName == wd.YDataSourceName))
if(I->YDataSourceName == wd.YDataSourceName &&
I->YOutputIndex == wd.YOutputIndex && I->MCol == wd.MCol && I->MRow == I->MRow)
return i;
if(wd.Type == 0x400 && I->YDataSourceName == wd.YDataSourceName && wd.MVectorName == I->MVectorName && wd.MVectorIndexX == I->MVectorIndexX && wd.MVectorIndexY == I->MVectorIndexY)
return i;
++I; ++i;
}
......@@ -487,8 +483,6 @@ int __fastcall TUWatchFrame::Add(TUWatchInfo& wd)
seriesindex=NameList.size()-1;
NameList[seriesindex]=wd;
if(wd.Type == 0x200)
{
RDK::UELockPtr<RDK::UEnvironment> env=RDK::GetEnvironmentLock();
RDK::UControllerDataReader * data=env->RegisterDataReader(wd.YDataSourceName,wd.YOutputIndex,wd.MRow,wd.MCol);
......@@ -496,54 +490,6 @@ int __fastcall TUWatchFrame::Add(TUWatchInfo& wd)
{
data->SetTimeInterval(wd.WatchInterval);
}
}
//
TFastLineSeries *ser;
ser=new TFastLineSeries(Chart1);
ser->ParentChart=Chart1;
ser->Title=wd.Legend.c_str();
ser->ColorSource=wd.Color;
ser->SeriesColor=wd.Color;
ser->Pen->Style=wd.Style;
ser->Pen->Width=wd.LineWidth;
// ...
StepUpdate();
// AddSeries(NameList.size()-1);
// ... ...
ModifyState=true;
return seriesindex;
}
else
{
// ,
int seriesindex=-1;
vector<TUWatchInfo>::iterator I;
I=NameList.begin();
int i=0;
while(I != NameList.end())
{
if((wd.Type != 0x200 && wd.Type !=0x400 &&
((I->XDataSourceName == wd.XDataSourceName && I->XOutputIndex == wd.XOutputIndex &&
I->YDataSourceName == wd.YDataSourceName && I->YOutputIndex == wd.YOutputIndex))) ||
(wd.Type == 0x200 && I->YDataSourceName == wd.YDataSourceName && wd.MRow == I->MRow && wd.MCol == I->MCol && wd.Y == I->Y))
return i;
if(wd.Type == 0x400 && I->YDataSourceName == wd.YDataSourceName && wd.MVectorName == I->MVectorName && wd.MVectorIndexX == I->MVectorIndexX && wd.MVectorIndexY == I->MVectorIndexY)
return i;
++I; ++i;
}
NameList.resize(NameList.size()+1);
seriesindex=NameList.size()-1;
NameList[seriesindex]=wd;
//
TFastLineSeries *ser;
......@@ -565,7 +511,6 @@ int __fastcall TUWatchFrame::Add(TUWatchInfo& wd)
ModifyState=true;
return seriesindex;
}
}
//
......@@ -587,20 +532,13 @@ int __fastcall TUWatchFrame::Add(int type, const string &xname, const string &yn
if(wd.Type == 0x200)
{
if(!yname.empty())
{
wd.Legend=yname+std::string(":")+youtput;
wd.Legend+=string("(")+RDK::sntoa(mrow)+string(",");
wd.Legend+=RDK::sntoa(mcol)+string(")");
}
}
else
{
if(!xname.empty())
{
wd.Legend=xname;
wd.Legend+=string(":")+RDK::sntoa(xoutput);
}
wd.Legend=yname+std::string(":")+youtput;
}
if(color == 0) //
......@@ -756,6 +694,9 @@ void __fastcall TUWatchFrame::StepUpdate(void)
//
wd=&NameList[seriesindex];
if(Chart1->SeriesCount()<=seriesindex)
continue;
TChartSeries* series=Chart1->Series[seriesindex];
if(!series)
......@@ -766,8 +707,6 @@ void __fastcall TUWatchFrame::StepUpdate(void)
if(!wd->Visible)
continue;
if(wd->Type == 0x200)
{
std::list<double>::iterator buffIX, buffIY;
RDK::UControllerDataReader* data=env->GetDataReader(wd->YDataSourceName.c_str(), wd->YOutputIndex, wd->MRow, wd->MCol);
if(!data)
......@@ -788,7 +727,6 @@ void __fastcall TUWatchFrame::StepUpdate(void)
}
wd->XYSize=data_size;
}
// ...
static_cast<TFastLineSeries*>(series)->AutoRepaint=false;
......@@ -1311,18 +1249,19 @@ void __fastcall TUWatchFrame::AddTimeMatrixWatch1Click(TObject *Sender)
if(UComponentsListForm->ShowIOSelect() != mrOk)
return;
const RDK::MDMatrix<double> *ym=0;
ym=(const RDK::MDMatrix<double>*)(Model_GetComponentOutputAsMatrix(UComponentsListForm->ComponentsListFrame1->GetSelectedComponentLongName().c_str(), UComponentsListForm->ComponentsListFrame1->GetSelectedComponentOutput().c_str()));
if(!ym)
return;
if(!MatrixForm->SelectMatrix(UComponentsListForm->ComponentsListFrame1->GetSelectedComponentLongName(),
UComponentsListForm->ComponentsListFrame1->GetSelectedComponentOutput()))
return;
// const RDK::MDMatrix<double> *ym_double=0;
// const RDK::MDMatrix<int> *ym_int=0;
// ym_double=(const RDK::MDMatrix<double>*)(Model_GetComponentOutputAsMatrix(UComponentsListForm->ComponentsListFrame1->GetSelectedComponentLongName().c_str(), UComponentsListForm->ComponentsListFrame1->GetSelectedComponentOutput().c_str()));
if(MatrixForm->ShowModal() != mrOk)
return;
int type=0x0;
if(MatrixForm->SelectMatrix(UComponentsListForm->ComponentsListFrame1->GetSelectedComponentLongName(),
UComponentsListForm->ComponentsListFrame1->GetSelectedComponentPropertyName()))
{
type=0x200;
if(MatrixForm->ShowModal() != mrOk)
return;
}
/*
UListInputForm->PresentSelect=true;
UListInputForm->MustInput=true;
......@@ -1346,8 +1285,8 @@ void __fastcall TUWatchFrame::AddTimeMatrixWatch1Click(TObject *Sender)
int col=MatrixForm->SelectedCol;
int row=MatrixForm->SelectedRow;
std::string componentName = UComponentsListForm->ComponentsListFrame1->GetSelectedComponentLongName();
std::string componentOutput = UComponentsListForm->ComponentsListFrame1->GetSelectedComponentOutput();
Add(0x200, "",componentName,"",componentOutput,row,col);
std::string componentOutput = UComponentsListForm->ComponentsListFrame1->GetSelectedComponentPropertyName();
Add(type, "",componentName,"",componentOutput,row,col);
}
//---------------------------------------------------------------------------
......
......@@ -57,12 +57,13 @@ inherited UWatchFrame: TUWatchFrame
Left = 72
Top = 16
object AddTimeMatrixWatch1: TMenuItem
Caption = 'Add Time-Matrix Watch'
Caption = 'Add'
OnClick = AddTimeMatrixWatch1Click
end
object AddXPulseWatch1: TMenuItem
Caption = 'Add X-Pulse Watch'
Enabled = False
Visible = False
OnClick = AddXPulseWatch1Click
end
object DeleteActiveWatch1: TMenuItem
......
......@@ -45,10 +45,8 @@ class TUWatchInfo
{
public: //
//
// 0 - ( )
// 0x100 - X(Y)
// 0 - double int
// 0x200 - MDMatrix
// 0x400 - MDMatrix
int Type;
//
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment