Esempio n. 1
0
void listView() {
	///Hide/show items for viewing the board list
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(true);
	boardlist->show();
	
	gtk_widget_destroy(GTK_WIDGET(pWebKitView));
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(false);
	threadview->hide();
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton3", boardback);
	boardback->set_visible(false);
	boardback->hide();
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text("Boards");
	
	Gtk::ToolItem *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(false);
	refresh1->hide();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(false);
	refresh2->hide();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(false);

	Gtk::Grid *post_grid;
	builder->get_widget("grid1", post_grid);
	post_grid->set_visible(false);
	post_grid->hide();
	
	Gtk::ToggleToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(false);
	post_but->hide();
	post_but->set_active(false);
}
Esempio n. 2
0
void on_thread_back_clicked() {
	///To be run when the back button is clicked while viewing a thread
	
	boardView();
	Gtk::TreeView *threadlist = 0;
	pWebKitView = WEBKIT_WEB_VIEW (webkit_web_view_new ());
	Gtk::ScrolledWindow *imgview = 0;
	builder->get_widget("scrolledwindow3", imgview);
	imgview->set_visible(true);
	imgview->show();
	
	gtk_container_add (GTK_CONTAINER (imgview->gobj()), GTK_WIDGET (pWebKitView));
	webkit_web_view_load_uri(pWebKitView, "about:blank");
	webkit_web_view_set_zoom_level(pWebKitView, true);
	gtk_widget_set_can_focus(GTK_WIDGET(pWebKitView), true);
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	builder->get_widget("treeview2", threadlist);
	Glib::RefPtr<Gtk::TreeSelection> thread_selection = threadlist->get_selection();
	thread_selection->signal_changed().connect(sigc::bind<Glib::RefPtr<Gtk::TreeSelection>, WebKitWebView*>(sigc::ptr_fun(&on_selection_changed), thread_selection, pWebKitView));
	
	POST_CLICK_CONNECT.disconnect();
	POST_REFRESH_CONNECT.disconnect();
}
Esempio n. 3
0
void on_button_clicked(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* column, Glib::RefPtr<Gtk::TreeModel> model) {
	Gtk::TreeModel::iterator iter = model->get_iter(path);
	Gtk::TreeModel::Row row = *iter;
	string shortname = row[m_columns.name];
	string longname = row[m_columns.longname];
	
	BOARD = shortname;
	LONGBOARD = longname;
	
	boardView();
	
	Gtk::TreeView *threadlist = 0;
	builder->get_widget("treeview2", threadlist);
	
	pWebKitView = WEBKIT_WEB_VIEW (webkit_web_view_new ());
	
	Gtk::ScrolledWindow *imgview = 0;
	builder->get_widget("scrolledwindow3", imgview);
	imgview->set_visible(true);
	imgview->show();
	
	gtk_container_add (GTK_CONTAINER (imgview->gobj()), GTK_WIDGET (pWebKitView));
	webkit_web_view_load_uri(pWebKitView, "about:blank");
	webkit_web_view_set_zoom_level(pWebKitView, true);
	gtk_widget_set_can_focus(GTK_WIDGET(pWebKitView), true);
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Glib::RefPtr<Gtk::ListStore> m_threads_tree_model;
	m_threads_tree_model = Gtk::ListStore::create(m_thread_list);
	m_threads_tree_model->clear();
	threadlist->set_model(m_threads_tree_model);
	threadlist->set_search_column(1);
	threadlist->get_column(1)->set_visible(false);
	threadlist->get_column(2)->set_visible(false);
	threadlist->get_column(3)->set_visible(false);
	threadlist->get_column(4)->set_visible(false);
	
	threadlist->signal_key_press_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_or_release_event), m_threads_tree_model));
	threadlist->signal_key_release_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_or_release_event), m_threads_tree_model));
	threadlist->add_events(Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
	
	Gtk::CellRendererText* cellRender = dynamic_cast<Gtk::CellRendererText*>(threadlist->get_column_cell_renderer(0));
	cellRender->property_wrap_mode() = Pango::WRAP_WORD;
	cellRender->property_wrap_width() = 400;
	cellRender->set_alignment(0, 0);
	
	Glib::RefPtr<Gtk::TreeSelection> thread_selection = threadlist->get_selection();
	thread_selection->signal_changed().connect(sigc::bind<Glib::RefPtr<Gtk::TreeSelection>, WebKitWebView*>(sigc::ptr_fun(&on_selection_changed), thread_selection, pWebKitView));
	
	getThreadData(m_threads_tree_model);
	
	threadlist->grab_focus();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton5", refresh);
	refresh->set_visible(true);
	refresh->show();
	if(!THREAD_REFRESH_CONNECTED) {
		THREAD_REFRESH_CONNECT = refresh->signal_clicked().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_refresh_threads_clicked), m_threads_tree_model));
	}
	
	THREAD_CLICK_CONNECT = threadlist->signal_row_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeModel>, Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_thread_activated), threadlist->get_model(), m_threads_tree_model));
}
Esempio n. 4
0
void on_thread_activated(Gtk::TreeModel::Path path, Gtk::TreeViewColumn* column, Glib::RefPtr<Gtk::TreeModel> model, Glib::RefPtr<Gtk::ListStore> store) {
	///To be run when a thread is double clicked
	
	Gtk::TreeModel::iterator iter = model->get_iter(path);
	Gtk::TreeModel::Row row = *iter;
	string no = row[m_thread_list.no];
	
	THREAD = no;
	
	cout << THREAD << endl;
	cout << BOARD << endl;
	
	threadView();
	
	Gtk::TreeView *postlist = 0;
	builder->get_widget("treeview4", postlist);
	postlist->set_visible(true);
	postlist->show();
	
	Gtk::ScrolledWindow *imgview = 0;
	builder->get_widget("scrolledwindow3", imgview);
	
	gtk_container_add (GTK_CONTAINER (imgview->gobj()), GTK_WIDGET (pWebKitView));
	webkit_web_view_load_uri(pWebKitView, "about:blank");
	webkit_web_view_set_zoom_level(pWebKitView, true);
	gtk_widget_set_can_focus(GTK_WIDGET(pWebKitView), true);
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Glib::RefPtr<Gtk::ListStore> m_posts_tree_model;
	m_posts_tree_model = Gtk::ListStore::create(m_post_list);
	m_posts_tree_model->clear();
	postlist->set_model(m_posts_tree_model);
	postlist->set_search_column(1);
	postlist->get_column(1)->set_visible(false);
	postlist->get_column(2)->set_visible(false);
	postlist->get_column(3)->set_visible(false);
	postlist->get_column(4)->set_visible(false);
	postlist->get_column(5)->set_visible(false);
	
	postlist->signal_key_press_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_thread), m_posts_tree_model));
	postlist->signal_key_release_event().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_key_press_thread), m_posts_tree_model));
	postlist->add_events(Gdk::KEY_PRESS_MASK | Gdk::KEY_RELEASE_MASK);
	
	Gtk::CellRendererText* cellRender = dynamic_cast<Gtk::CellRendererText*>(postlist->get_column_cell_renderer(0));
	cellRender->property_wrap_mode() = Pango::WRAP_WORD;
	cellRender->property_wrap_width() = 400;
	cellRender->set_alignment(0, 0);
	
	Glib::RefPtr<Gtk::TreeSelection> thread_selection = postlist->get_selection();
	thread_selection->signal_changed().connect(sigc::bind<Glib::RefPtr<Gtk::TreeSelection>, WebKitWebView*>(sigc::ptr_fun(&on_selection_changed_post), thread_selection, pWebKitView));
	
	getPostData(m_posts_tree_model);
	
	postlist->grab_focus();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton6", refresh);
	refresh->set_visible(true);
	refresh->show();
	POST_REFRESH_CONNECT = refresh->signal_clicked().connect(sigc::bind<Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_refresh_posts_clicked), m_posts_tree_model));
	
	Gtk::ScrolledWindow *postwin = 0;
	builder->get_widget("scrolledwindow4", postwin);
	postwin->set_visible(true);
	postwin->show();
	
	POST_CLICK_CONNECT = postlist->signal_row_activated().connect(sigc::bind<Glib::RefPtr<Gtk::TreeModel>, Glib::RefPtr<Gtk::ListStore> >(sigc::ptr_fun(&on_post_activated1), postlist->get_model(), m_posts_tree_model));
}
Esempio n. 5
0
void threadView() {
	///Hide or show widgets for viewing a thread
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton4", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *listback = 0;
	builder->get_widget("toolbutton3", listback);
	listback->set_visible(false);
	listback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button2", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_thread_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(false);
	threadlist->hide();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(true);
	postlist->show();
	postlist->get_vadjustment()->set_value(0);
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text("#"+THREAD+" - "+BOARD+" - "+LONGBOARD);
	
	Gtk::ToolItem *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(false);
	refresh1->hide();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(true);
	refresh2->show();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(true);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
Esempio n. 6
0
void boardView(bool destroy=true) {
	///Show/hide widgets for viewing all of the threads on a board
	
	Gtk::ScrolledWindow *boardlist = 0;
	builder->get_widget("scrolledwindow1", boardlist);
	boardlist->set_visible(false);
	boardlist->hide();
	
	Gtk::Paned *threadview = 0;
	builder->get_widget("paned1", threadview);
	threadview->set_visible(true);
	threadview->show();
	
	if(INIT) { //To be run only the first time a board is viewed
		Gtk::Window *window = 0;
		builder->get_widget("window1", window);
		int w = 0;
		int h = 0;
		window->get_size(w, h);
		threadview->set_position((1-2/(1+sqrt(5)))*w);
		
		Gtk::TextView *view = 0;
		builder->get_widget("textview1", view);
		GtkSpellChecker* spell = gtk_spell_checker_new ();
		gtk_spell_checker_set_language (spell, setlocale(LC_ALL,NULL), NULL);
		gtk_spell_checker_attach (spell, GTK_TEXT_VIEW (view->gobj()));
		
		INIT = false;
	}
	
	Gtk::ToolItem *boardback = 0;
	builder->get_widget("toolbutton3", boardback);
	boardback->set_visible(true);
	boardback->show();
	
	Gtk::ToolItem *threadback = 0;
	builder->get_widget("toolbutton4", threadback);
	threadback->set_visible(false);
	threadback->hide();
	
	Gtk::Button* button;
	builder->get_widget("button1", button);
	button->signal_clicked().connect(sigc::ptr_fun(&on_board_back_clicked));
	button->set_visible(true);
	button->show();
	
	Gtk::ScrolledWindow *threadlist = 0;
	builder->get_widget("scrolledwindow2", threadlist);
	threadlist->set_visible(true);
	threadlist->show();
	
	Gtk::ScrolledWindow *postlist = 0;
	builder->get_widget("scrolledwindow4", postlist);
	postlist->set_visible(false);
	postlist->hide();
	
	Gtk::ScrolledWindow *webview = 0;
	builder->get_widget("scrolledwindow3", webview);
	webview->set_visible(true);
	webview->show();
	
	Gtk::ToolButton* refresh;
	builder->get_widget("toolbutton5", refresh);
	refresh->set_visible(true);
	refresh->show();
	
	gtk_widget_show(GTK_WIDGET(pWebKitView));
	
	Gtk::Label *title = 0;
	builder->get_widget("label2", title);
	title->set_text(BOARD+" - "+LONGBOARD);
	
	Gtk::ToolButton *refresh1 = 0;
	builder->get_widget("toolbutton5", refresh1);
	refresh1->set_visible(true);
	refresh1->show();
	
	Gtk::ToolItem *refresh2 = 0;
	builder->get_widget("toolbutton6", refresh2);
	refresh2->set_visible(false);
	refresh2->hide();
	
	Gtk::MenuItem *item3 = 0;
	builder->get_widget("menuitem3", item3);
	item3->set_sensitive(false);
	
	Gtk::ToolButton *post_but;
	builder->get_widget("toolbutton8", post_but);
	post_but->set_visible(true);
	post_but->show();
}
Esempio n. 7
0
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);
}
ModelFctDetailViewImpl::ModelFctDetailViewImpl(ModelFctDetailColumns& Columns) :
    m_Columns(Columns)
{
    mp_Notebook = Gtk::manage(new Gtk::Notebook());

    mp_InfoPage = new ModelFctDetailInfoPage();

    mp_ParamsTreeView = Gtk::manage(new Gtk::TreeView());
    mp_ParamsTreeView->append_column(_("Name"), m_Columns.m_Name);
    mp_ParamsTreeView->append_column(_("SI Unit"), m_Columns.m_Unit);
    mp_ParamsTreeView->append_column(_("Description"), m_Columns.m_Description);
    mp_ParamsTreeView->set_visible(true);

    mp_VarsTreeView = Gtk::manage(new Gtk::TreeView());
    mp_VarsTreeView->append_column(_("Name"), m_Columns.m_Name);
    mp_VarsTreeView->append_column(_("Type"), m_Columns.m_Type);
    mp_VarsTreeView->append_column(_("SI Unit"), m_Columns.m_Unit);
    mp_VarsTreeView->append_column(_("Unit class"), m_Columns.m_Class);
    mp_VarsTreeView->append_column(_("Description"), m_Columns.m_Description);
    mp_VarsTreeView->set_visible(true);

    mp_IDataTreeView = Gtk::manage(new Gtk::TreeView());
    mp_IDataTreeView->append_column(_("Name"), m_Columns.m_Name);
    mp_IDataTreeView->append_column(_("Unit class"), m_Columns.m_Class);
    mp_IDataTreeView->set_visible(true);

    mp_EventsTreeView = Gtk::manage(new Gtk::TreeView());
    mp_EventsTreeView->append_column(_("Unit class"), m_Columns.m_Class);
    mp_EventsTreeView->set_visible(true);

    mp_ExtraFilesTreeView = Gtk::manage(new Gtk::TreeView());
    mp_ExtraFilesTreeView->append_column(_("Name"), m_Columns.m_Name);
    mp_ExtraFilesTreeView->set_visible(true);

    Gtk::ScrolledWindow* ParamsWin = Gtk::manage(new Gtk::ScrolledWindow());
    ParamsWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    ParamsWin->set_visible(true);
    ParamsWin->add(*mp_ParamsTreeView);

    Gtk::ScrolledWindow* VarsWin = Gtk::manage(new Gtk::ScrolledWindow());
    VarsWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    VarsWin->set_visible(true);
    VarsWin->add(*mp_VarsTreeView);

    Gtk::ScrolledWindow* IDataWin = Gtk::manage(new Gtk::ScrolledWindow());
    IDataWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    IDataWin->set_visible(true);
    IDataWin->add(*mp_IDataTreeView);

    Gtk::ScrolledWindow* EventsWin = Gtk::manage(new Gtk::ScrolledWindow());
    EventsWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    EventsWin->set_visible(true);
    EventsWin->add(*mp_EventsTreeView);

    Gtk::ScrolledWindow* ExtraFilesWin = Gtk::manage(new Gtk::ScrolledWindow());
    ExtraFilesWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    ExtraFilesWin->set_visible(true);
    ExtraFilesWin->add(*mp_ExtraFilesTreeView);

    mp_Notebook->append_page(*mp_InfoPage->asWidget(), _("Information"));
    mp_Notebook->append_page(*ParamsWin, _("Parameters"));
    mp_Notebook->append_page(*VarsWin, _("Variables"));
    mp_Notebook->append_page(*IDataWin, _("Inputdata"));
    mp_Notebook->append_page(*EventsWin, _("Events"));
    mp_Notebook->append_page(*ExtraFilesWin, _("Extra Files"));
    mp_Notebook->set_visible(true);
}