void ResViewerViewImpl::setFileContentsByName(std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> > FileContents) { Glib::ustring ExistingTabSelection = ""; if (mp_Notebook->get_current()) ExistingTabSelection = mp_Notebook->get_current()->get_tab_label_text(); int TabToSelect = 0; while (mp_Notebook->get_n_pages() > 1) mp_Notebook->remove_page(1); for (std::map<std::string, Glib::RefPtr<Gtk::TextBuffer> >::iterator it = FileContents.begin(); it != FileContents.end(); ++it) { Gtk::TextView* TextView = Gtk::manage(new Gtk::TextView(it->second)); TextView->set_editable(false); TextView->set_visible(true); Gtk::ScrolledWindow* Win = Gtk::manage(new Gtk::ScrolledWindow()); Win->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); Win->set_visible(true); Win->set_shadow_type(Gtk::SHADOW_ETCHED_IN); Win->add(*TextView); Gtk::Label* TabLabel = Gtk::manage(new Gtk::Label(it->first)); Gtk::Label* MenuLabel = Gtk::manage(new Gtk::Label(it->first, Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER)); Gtk::Button* SingleGNUplotButton = Gtk::manage(new Gtk::Button( _("Plot file with GNUplot\n(All-in-one window)"))); Gtk::Button* MultiGNUplotButton = Gtk::manage(new Gtk::Button( _("Plot file with GNUplot\n(Multiple windows)"))); Gtk::VBox* RightButtonsBox = Gtk::manage(new Gtk::VBox()); RightButtonsBox->pack_start(*SingleGNUplotButton, Gtk::PACK_SHRINK); RightButtonsBox->pack_start(*MultiGNUplotButton, Gtk::PACK_SHRINK, 5); RightButtonsBox->show_all_children(true); RightButtonsBox->set_visible(true); #if WIN32 SingleGNUplotButton->set_sensitive(false); MultiGNUplotButton->set_sensitive(false); #else if (ViewWithGNUplot::IsGNUplotAvailable()) { SingleGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr< Gtk::TextBuffer>, std::string, std::string, std::string, bool>( sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked), (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep, m_CommentChar, true)); SingleGNUplotButton->set_sensitive(true); MultiGNUplotButton->signal_clicked().connect(sigc::bind<Glib::RefPtr< Gtk::TextBuffer>, std::string, std::string, std::string, bool>( sigc::mem_fun(*this, &ResViewerViewImpl::onGNUplotClicked), (Glib::RefPtr<Gtk::TextBuffer>) (it->second), m_DateFormat, m_ColSep, m_CommentChar, false)); MultiGNUplotButton->set_sensitive(true); } else { SingleGNUplotButton->set_sensitive(false); MultiGNUplotButton->set_sensitive(false); } #endif Gtk::HBox* MainHBox = Gtk::manage(new Gtk::HBox()); MainHBox->pack_start(*Win, Gtk::PACK_EXPAND_WIDGET, 5); MainHBox->pack_start(*RightButtonsBox, Gtk::PACK_SHRINK, 5); MainHBox->set_border_width(8); MainHBox->set_visible(true); int PageNum = mp_Notebook->append_page(*MainHBox, *TabLabel, *MenuLabel); if (it->first == ExistingTabSelection) TabToSelect = PageNum; mp_Notebook->set_tab_reorderable(*Win, true); } mp_Notebook->set_current_page(TabToSelect); }