Пример #1
0
void ObsAndViewBox::on_del_view()
{
    using namespace Gtk;
    using namespace vpz;

    Glib::RefPtr<TreeSelection> tree_selection = mTreeViewObs->get_selection();
    TreeSelection::ListHandle_Path lst = tree_selection->get_selected_rows();
    Glib::RefPtr<TreeModel> model = mTreeViewObs->get_model();

    for (TreeSelection::ListHandle_Path::iterator i = lst.begin();
            i != lst.end(); ++i) {
        TreeModel::Row row( *(model->get_iter(*i)));
        std::string data_name(row.get_value(mColumnsObs.m_col_name));
        Base::type type(row.get_value(mColumnsObs.m_col_type));

        if (type == Base::VLE_VPZ_VIEW) {
            TreeModel::Row parent(*(row.parent()));
            std::string port_name(parent.get_value(mColumnsObs.m_col_name));
            if (mObs->exist(port_name)) {
                mObs->get(port_name).del(data_name);
            }
        }
    }
    makeObs();
}
Пример #2
0
Gtk::TreeSelectionAdapter::const_iterator
Gtk::TreeSelectionAdapter::begin() const
{
    if (!sel_ && tree_)
    {
        sel_ = tree_->get_selection();
    }
    assert(sel_);
    TreeSelection::ListHandle_Path path = sel_->get_selected_rows();
    return path.begin();
}
Пример #3
0
void ObsAndViewBox::on_add()
{
    using namespace Gtk;
    using namespace vpz;

    TreeSelection::ListHandle_Path lstDst = mDstSelect->get_selected_rows();
    Glib::RefPtr<TreeModel> modelDst = mTreeViewObs->get_model();

    for (TreeSelection::ListHandle_Path::iterator iDst = lstDst.begin();
            iDst != lstDst.end(); ++iDst) {
        TreeModel::Row rowDst( *(modelDst->get_iter(*iDst)));
        std::string data_name(rowDst.get_value(mColumnsObs.m_col_name));
        Base::type type(rowDst.get_value(mColumnsObs.m_col_type));

        if (type == Base::VLE_VPZ_OBSERVABLEPORT) {

            ObservablePort& port(
                mObs->get(rowDst.get_value(mColumnsObs.m_col_name)));

            TreeSelection::ListHandle_Path lstSrc = mSrcSelect->get_selected_rows();
            Glib::RefPtr<TreeModel> modelSrc = mTreeViewViews->get_model();

            for (TreeSelection::ListHandle_Path::iterator iSrc = lstSrc.begin();
                 iSrc != lstSrc.end(); ++iSrc) {
                TreeModel::Row rowSrc( *(modelSrc->get_iter(*iSrc)));

                std::string view(rowSrc.get_value(mColumnsViews.m_col_name));

                if (not port.exist(view)) {
                    port.add(view);
                }
            }
        }
    }
    makeObs();
}