400
404
Gtk::Grid *grid = manage(new Gtk::Grid);
401
405
int grid_col = 0;
403
m_pin_image = manage(new Gtk::Image);
404
m_pin_button = manage(new Gtk::ToolButton(*m_pin_image, _("Pin")));
406
if(m_note.is_pinned()) {
407
m_pin_image->property_gicon() = get_icon_pin_down();
408
m_pin_button->set_tooltip_text(_("Remove from important notes"));
411
m_pin_image->property_gicon() = get_icon_pin_active();
412
m_pin_button->set_tooltip_text(_("Mark note as important"));
415
m_pin_button->signal_clicked().connect(sigc::mem_fun(*this, &NoteWindow::on_pin_button_clicked));
416
grid->attach(*m_pin_button, grid_col++, 0, 1, 1);
417
notebooks::NotebookManager::obj().signal_note_pin_status_changed
418
.connect(sigc::mem_fun(*this, &NoteWindow::on_pin_status_changed));
420
m_link_button = manage(new Gtk::ToolButton(
421
*manage(new Gtk::Image(Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_SMALL_TOOLBAR)),
423
m_link_button->set_use_underline(true);
424
m_link_button->set_is_important(true);
425
m_link_button->set_sensitive(!m_note.get_buffer()->get_selection().empty());
426
m_link_button->signal_clicked().connect(
427
sigc::mem_fun(*this, &NoteWindow::link_button_clicked));
428
m_link_button->set_tooltip_text(_("Link selected text to a new note (Ctrl-L)"));
429
m_link_button->show_all();
430
grid->attach(*m_link_button, grid_col++, 0, 1, 1);
432
utils::ToolMenuButton *text_button = manage(new utils::ToolMenuButton(
433
*manage(new Gtk::Image(Gtk::Stock::SELECT_FONT, Gtk::ICON_SIZE_SMALL_TOOLBAR)),
434
_("_Text"), m_text_menu));
435
text_button->set_use_underline(true);
436
text_button->set_is_important(true);
407
Gtk::Button *text_button = manage(new Gtk::Button);
408
Gtk::Image *image = manage(new Gtk::Image);
409
image->property_icon_name() = "insert-text-symbolic";
410
image->property_icon_size() = GTK_ICON_SIZE_MENU;
411
text_button->set_image(*image);
412
text_button->signal_clicked()
413
.connect(sigc::mem_fun(*this, &NoteWindow::on_text_button_clicked));
414
text_button->property_margin_left() = 12;
437
415
text_button->show_all();
438
416
grid->attach(*text_button, grid_col++, 0, 1, 1);
439
417
text_button->set_tooltip_text(_("Set properties of text"));
441
grid->attach(*manage(new Gtk::SeparatorToolItem()), grid_col++, 0, 1, 1);
443
m_delete_button = manage(new Gtk::ToolButton(Gtk::Stock::DELETE));
444
m_delete_button->set_use_underline(true);
445
m_delete_button->signal_clicked().connect(
446
sigc::mem_fun(*this, &NoteWindow::on_delete_button_clicked));
447
m_delete_button->show_all();
448
grid->attach(*m_delete_button, grid_col++, 0, 1, 1);
449
m_delete_button->set_tooltip_text(_("Delete this note"));
418
m_text_menu->property_attach_widget() = text_button;
420
m_important_action = utils::CheckAction::create("mark-important");
421
m_important_action->set_label(_("Is Important"));
422
m_important_action->set_tooltip(_("Toggle notes presence in Important Notes notebook"));
423
m_important_action->checked(m_note.is_pinned());
424
m_important_action->signal_activate().connect(sigc::mem_fun(*this, &NoteWindow::on_pin_button_clicked));
425
notebooks::NotebookManager::obj().signal_note_pin_status_changed
426
.connect(sigc::mem_fun(*this, &NoteWindow::on_pin_status_changed));
451
428
// Don't allow deleting the "Start Here" note...
452
if (m_note.is_special()) {
453
m_delete_button->set_sensitive(false);
429
if(!m_note.is_special()) {
430
m_delete_action = Gtk::Action::create("delete-note", _("_Delete"), _("Delete this note"));
431
m_delete_action->signal_activate()
432
.connect(sigc::mem_fun(*this, &NoteWindow::on_delete_button_clicked));
455
grid->attach(*manage(new Gtk::SeparatorToolItem()), grid_col++, 0, 1, 1);
435
grid->property_margin_left() = 12;
457
436
grid->show_all();
994
970
Gdk::CONTROL_MASK,
995
971
Gtk::ACCEL_VISIBLE);
996
m_increase_font.add_accelerator("activate", accel_group,
1000
m_decrease_font.add_accelerator("activate", accel_group,
1003
Gtk::ACCEL_VISIBLE);
972
keybinder.add_accelerator(sigc::mem_fun(*this, &NoteTextMenu::increase_font_clicked),
973
GDK_KEY_plus, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
974
keybinder.add_accelerator(sigc::mem_fun(*this, &NoteTextMenu::decrease_font_clicked),
975
GDK_KEY_minus, Gdk::CONTROL_MASK, Gtk::ACCEL_VISIBLE);
1004
976
m_increase_indent.add_accelerator("activate", accel_group,
1080
1054
m_event_freeze = false;
1057
void NoteTextMenu::link_clicked()
1059
if(m_event_freeze) {
1063
Glib::ustring select = m_buffer->get_selection();
1064
if(select.empty()) {
1068
Glib::ustring body_unused;
1069
Glib::ustring title = NoteManagerBase::split_title_from_content(select, body_unused);
1074
NoteManagerBase & manager(m_buffer->note().manager());
1075
NoteBase::Ptr match = manager.find(title);
1078
match = manager.create(select);
1080
catch(const sharp::Exception & e) {
1081
utils::HIGMessageDialog dialog(dynamic_cast<Gtk::Window*>(m_buffer->note().get_window()->host()),
1082
GTK_DIALOG_DESTROY_WITH_PARENT,
1083
Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK,
1084
_("Cannot create note"), e.what());
1090
Gtk::TextIter start, end;
1091
m_buffer->get_selection_bounds(start, end);
1092
m_buffer->remove_tag(m_buffer->note().get_tag_table()->get_broken_link_tag(), start, end);
1093
m_buffer->apply_tag(m_buffer->note().get_tag_table()->get_link_tag(), start, end);
1096
m_buffer->note().get_window()->host()->embed_widget(*static_pointer_cast<Note>(match)->get_window());
1084
1100
// Font-style menu item activate