- Mantain expanded state of TreeView rows while History updates.
It isn't elegant, but it's the best I can come up with in 10 minutes before having dinner. git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@944 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
231662825d
commit
aa608a1cc2
|
@ -19,7 +19,6 @@
|
|||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "schedulables_tree_widget.hh"
|
||||
#include "templates/sequences.tcc"
|
||||
#include "backend/history.hh"
|
||||
#include "backend/simulation.hh"
|
||||
#include "backend/process.hh"
|
||||
|
@ -27,6 +26,8 @@
|
|||
#include "backend/resource.hh"
|
||||
#include "add_request_dialog.hh"
|
||||
|
||||
#include "sequences.tcc"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@ -262,6 +263,15 @@ SchedulablesTreeWidget::on_button_press_event(GdkEventButton* event)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SchedulablesTreeWidget::_update_expanded_vector(Gtk::TreeView* treeview,
|
||||
const Gtk::TreeModel::Path& path)
|
||||
{
|
||||
_expanded_rows.push_back(path.to_string());
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SchedulablesTreeWidget::update(const History& history)
|
||||
{
|
||||
|
@ -272,8 +282,13 @@ SchedulablesTreeWidget::update(const History& history)
|
|||
const Environment::Processes& processes =
|
||||
Simulation::get_instance().get_history().get_last_environment().get_processes();
|
||||
|
||||
|
||||
// Save expanded rows (FIXME: find a better way?)
|
||||
map_expanded_rows(sigc::mem_fun(*this, &SchedulablesTreeWidget::_update_expanded_vector));
|
||||
|
||||
_model->clear();
|
||||
|
||||
|
||||
for(Iseq<ProcessIt> pit = const_iseq(processes); pit; ++pit)
|
||||
{
|
||||
Process& p = *(*pit);
|
||||
|
@ -330,6 +345,14 @@ SchedulablesTreeWidget::update(const History& history)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Restore expanded rows
|
||||
for(vector<Glib::ustring>::iterator it = _expanded_rows.begin(); it != _expanded_rows.end(); ++it)
|
||||
expand_row(Gtk::TreeModel::Path(*it), false);
|
||||
|
||||
// We can clear it now, since until next update we won't need it.
|
||||
_expanded_rows.clear();
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -40,6 +40,8 @@ namespace sgpem
|
|||
|
||||
#include "backend/history_observer.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
/**
|
||||
|
@ -118,6 +120,10 @@ namespace sgpem
|
|||
Gtk::Dialog* _add_thread_dialog;
|
||||
AddRequestDialog* _add_request_dialog;
|
||||
CellRendererTextMarkup _cell_renderer;
|
||||
|
||||
void _update_expanded_vector(Gtk::TreeView* tree_view, const Gtk::TreeModel::Path& path);
|
||||
|
||||
std::vector<Glib::ustring> _expanded_rows;
|
||||
};
|
||||
|
||||
} //~ namespace sgpem
|
||||
|
|
Loading…
Reference in New Issue