Exemplo n.º 1
0
Gobby::FolderCommands::FolderCommands(const Folder& folder):
	m_folder(folder), m_current_view(NULL)
{
	m_folder.signal_document_added().connect(
		sigc::mem_fun(*this, &FolderCommands::on_document_added));
	m_folder.signal_document_removed().connect(
		sigc::mem_fun(*this, &FolderCommands::on_document_removed));
	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &FolderCommands::on_document_changed));

	const unsigned int n_pages =
		static_cast<unsigned int>(m_folder.get_n_pages());
	for(unsigned int i = 0; i < n_pages; ++i)
	{
		// TODO: Convenience API in Folder to retrieve SessionView,
		// so that we don't need to know about SessionUserView here.
		const SessionUserView* user_view =
			static_cast<const SessionUserView*>(
				m_folder.get_nth_page(i));
		SessionView& view = user_view->get_session_view();

		on_document_added(view);
	}

	on_document_changed(m_folder.get_current_document());
}
Exemplo n.º 2
0
Gobby::TitleBar::TitleBar(Gtk::Window& window, const Folder& folder):
	m_window(window), m_folder(folder), m_current_view(NULL)
{
	folder.signal_document_removed().connect(
		sigc::mem_fun(*this, &TitleBar::on_document_removed));
	folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &TitleBar::on_document_changed));

	on_document_changed(folder.get_current_document());
}
Exemplo n.º 3
0
Gobby::GotoDialog::GotoDialog(Gtk::Window& parent, const Folder& folder):
	Gtk::Dialog(_("Go to line"), parent),
	m_folder(folder),
	m_table(1, 2),
	m_label_line(_("Line _number:"), GtkCompat::ALIGN_LEFT,
	             Gtk::ALIGN_CENTER, true),
	m_current_view(NULL)
{
	m_label_line.set_mnemonic_widget(m_entry_line);
	m_label_line.show();

	m_entry_line.set_increments(1, 10);
	m_entry_line.set_activates_default(true);
	m_entry_line.show();

	m_table.attach(m_label_line, 0, 1, 0, 1, Gtk::FILL, Gtk::FILL);
	m_table.attach(m_entry_line, 1, 2, 0, 1,
	               Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK);
	m_table.set_spacings(12);
	m_table.show();

	get_vbox()->pack_start(m_table, Gtk::PACK_EXPAND_WIDGET);

	add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CLOSE);
	Gtk::Button* button =
		add_button(_("Go To _Line"), Gtk::RESPONSE_ACCEPT);

	button->set_image(*Gtk::manage(new Gtk::Image(
		Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_BUTTON)));

	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &GotoDialog::on_document_changed));

	set_default_response(Gtk::RESPONSE_ACCEPT);
	set_border_width(12);
	set_resizable(false);

	// For initial sensitivity:
	on_document_changed(m_folder.get_current_document());
}
Exemplo n.º 4
0
Gobby::EditCommands::EditCommands(Gtk::Window& parent, Header& header,
                                  const Folder& folder, StatusBar& status_bar,
                                  FileChooser& file_chooser,
                                  Preferences& preferences,
                                  CertificateManager& cert_manager):
	m_parent(parent), m_header(header), m_folder(folder),
	m_status_bar(status_bar), m_file_chooser(file_chooser),
	m_preferences(preferences), m_cert_manager(cert_manager),
	m_current_view(NULL)
{
	m_header.action_edit_undo->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_undo));
	m_header.action_edit_redo->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_redo));
	m_header.action_edit_cut->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_cut));
	m_header.action_edit_copy->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_copy));
	m_header.action_edit_paste->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_paste));
	m_header.action_edit_find->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_find));
	m_header.action_edit_find_next->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_find_next));
	m_header.action_edit_find_prev->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_find_prev));
	m_header.action_edit_find_replace->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_find_replace));
	m_header.action_edit_goto_line->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_goto_line));
	m_header.action_edit_preferences->signal_activate().connect(
		sigc::mem_fun(*this, &EditCommands::on_preferences));
	m_folder.signal_document_removed().connect(
		sigc::mem_fun(*this, &EditCommands::on_document_removed));
	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &EditCommands::on_document_changed));

	// Setup initial sensitivity:
	on_document_changed(m_folder.get_current_document());
}
Exemplo n.º 5
0
Gobby::StatusBar::StatusBar(Gtk::Window& window,
                            const Folder& folder,
                            const Preferences& preferences):
	Gtk::HBox(false, 2), m_folder(folder), m_preferences(preferences),
	m_visible_messages(0), m_current_view(NULL), m_position_context_id(0)
{
	pack_end(m_bar_position, Gtk::PACK_SHRINK);
	m_bar_position.set_size_request(200, -1);
	m_bar_position.show();

	window.signal_window_state_event().connect(
		sigc::mem_fun(*this, &StatusBar::on_window_state_event));

	m_folder.signal_document_removed().connect(
		sigc::mem_fun(*this, &StatusBar::on_document_removed));
	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &StatusBar::on_document_changed));
	m_preferences.appearance.show_statusbar.signal_changed().connect(
		sigc::mem_fun(*this, &StatusBar::on_view_changed));

	// Initial update
	on_document_changed(m_folder.get_current_document());
	on_view_changed();
}
Exemplo n.º 6
0
Gobby::StatusBar::StatusBar(const Folder& folder,
                            const Preferences& preferences):
	m_folder(folder), m_preferences(preferences),
	m_visible_messages(0), m_current_view(NULL)
{
	set_column_spacing(2);

	m_lbl_position.set_halign(Gtk::ALIGN_END);
	m_lbl_position.set_hexpand(true);
	m_lbl_position.set_margin_end(6);
	m_lbl_position.show();
	attach(m_lbl_position, 0, 0, 1, 1);

	m_folder.signal_document_removed().connect(
		sigc::mem_fun(*this, &StatusBar::on_document_removed));
	m_folder.signal_document_changed().connect(
		sigc::mem_fun(*this, &StatusBar::on_document_changed));
	m_preferences.appearance.show_statusbar.signal_changed().connect(
		sigc::mem_fun(*this, &StatusBar::on_view_changed));

	// Initial update
	on_document_changed(m_folder.get_current_document());
	on_view_changed();
}
Exemplo n.º 7
0
Gobby::StatusBar::~StatusBar()
{
	on_document_changed(NULL);
}
Exemplo n.º 8
0
Gobby::FindDialog::~FindDialog()
{
	on_document_changed(NULL);
}
Exemplo n.º 9
0
Gobby::GotoDialog::~GotoDialog()
{
	on_document_changed(NULL);
}
Exemplo n.º 10
0
void Gobby::EditCommands::on_document_removed(SessionView& view)
{
	// TODO: Isn't this emitted by Folder already?
	if(&view == m_current_view)
		on_document_changed(NULL);
}
Exemplo n.º 11
0
Gobby::EditCommands::~EditCommands()
{
	// Disconnect handlers from current document:
	on_document_changed(NULL);
}
Exemplo n.º 12
0
void Gobby::TitleBar::on_document_removed(SessionView& view)
{
	// TODO: Isn't this called by Folder already?
	if(m_current_view == &view)
		on_document_changed(NULL);
}
Exemplo n.º 13
0
Gobby::TitleBar::~TitleBar()
{
	on_document_changed(NULL);
}