Пример #1
0
void CCustomHeadersDlg::OnAddHeader() 
{
	
	CEditHeadersDlg EditDlg( " ",this);
	if (IDOK == EditDlg.DoModal())
	{
		if ( !EditDlg.m_strHeader.IsEmpty())
		{
			m_lbHeaderList.AddString(EditDlg.m_strHeader);
		}
		else
		{
			return;
		}
	}
	else
	{
		return;
	}

	CWnd *pWnd = (CWnd*) GetDlgItem(IDC_ADD_HEADER);

	if (pWnd)
	{
		pWnd->SetFocus();
	}
	UpdateData();	
}
Пример #2
0
//
// Pops up an edit form for the currently selected item in the global list.
//
BOOL CPageAccess::Edit()
{
	// Get currently selected spec.
	int item_index = m_LGlobalAccess.GetNextItem( FIND_FIRST, LVNI_SELECTED );
	if ( item_index == NOTHING || item_index == IDLE_SPEC )
		return FALSE;

	Test_Spec *spec = (Test_Spec*)m_LGlobalAccess.GetItemData( item_index );

	// Create access spec edit dialog and pass currently selected item's index.
	CAccessDialog EditDlg( spec );

	if ( EditDlg.DoModal() == IDCANCEL )
		return FALSE;

	// Display the correct default assignment icon for the new access spec.
	m_LGlobalAccess.SetItem( item_index, 0, LVIF_IMAGE, NULL,
							 spec->default_assignment, NULL, NULL, NULL );

	// Update a name change
	m_LGlobalAccess.SetItemText( item_index, 0, spec->name );
	ShowAssignedAccess();

	return TRUE;
}
Пример #3
0
void CSVObsParamsWidget::editSet()
{
  int CurrentRow = ui->SetsTableWidget->currentRow();

  if (CurrentRow >= 0)
  {
    QString EditedSet = ui->SetsTableWidget->item(CurrentRow,0)->text();

    QStringList SetNames;
    for (auto& Set : m_Sets)
    {
      QString CurrentSet = QString::fromStdString(Set.first);
      if (CurrentSet != EditedSet)
        SetNames << CurrentSet;
    }

    QStringList FormatNames;
    for (auto& Format : m_Formats)
      FormatNames << QString::fromStdString(Format.first);

    QStringList ClassNames = openfluid::tools::toQStringList(mp_Desc->spatialDomain().getClassNames());

    EditSetDialog EditDlg(SetNames,FormatNames,ClassNames,this);

    QString SetStr = "set."+EditedSet+".";


    EditDlg.initialize(EditedSet,
                       getParamValue(SetStr+"format",""),
                       getParamValue(SetStr+"unitsclass",""),
                       getParamValue(SetStr+"unitsIDs","*"),
                       getParamValue(SetStr+"vars","*"));


    if (EditDlg.exec() == QDialog::Accepted)
    {
      removeParamsStartingWith(SetStr);

      openfluid::ware::WareParams_t Params = EditDlg.getSetParams();

      mp_Params->insert(Params.begin(),Params.end());

      update();
      emit changed();
    }
  }
}
Пример #4
0
void CSVObsParamsWidget::editFormat()
{
  int CurrentRow = ui->FormatsTableWidget->currentRow();

  if (CurrentRow >= 0)
  {
    QString EditedFormat = ui->FormatsTableWidget->item(CurrentRow,0)->text();

    QStringList FormatNames;

    for (auto& Format : m_Formats)
    {
      QString CurrentFormat = QString::fromStdString(Format.first);
      if (CurrentFormat != EditedFormat)
        FormatNames << CurrentFormat;
    }

    EditFormatDialog EditDlg(FormatNames,this);

    QString FormatStr = "format."+EditedFormat+".";


    EditDlg.initialize(EditedFormat,
                       getParamValue(FormatStr+"header","colnames-as-comment"),
                       getParamValue(FormatStr+"colsep",";"),
                       getParamValue(FormatStr+"date","ISO"),
                       getParamValue(FormatStr+"precision","5"),
                       getParamValue(FormatStr+"commentchar","#"));


    if (EditDlg.exec() == QDialog::Accepted)
    {
      removeParamsStartingWith(FormatStr);

      openfluid::ware::WareParams_t Params = EditDlg.getFormatParams();

      mp_Params->insert(Params.begin(),Params.end());

      update();
      emit changed();
    }
  }
}
Пример #5
0
void CCustomHeadersDlg::OnEditHeader() 
{
	int iSel = m_lbHeaderList.GetCurSel();
	CString strHeader;

	if (iSel >= 0)
	{
		m_lbHeaderList.GetText(iSel,strHeader);
	}
	else
	{
		return;
	}

	CEditHeadersDlg EditDlg( strHeader,this);
	if (IDOK == EditDlg.DoModal())
	{
		if ( !EditDlg.m_strHeader.IsEmpty() && !(EditDlg.m_strHeader.Compare(strHeader) == 0) )
		{
			m_lbHeaderList.DeleteString(iSel);
			m_lbHeaderList.AddString(EditDlg.m_strHeader);
		}
		else
		{
			return;
		}
	}
	else
	{
		return;
	}

	CWnd *pWnd = (CWnd*) GetDlgItem(IDC_ADD_HEADER);

	if (pWnd)
	{
		pWnd->SetFocus();
	}
	UpdateData();	
}