Пример #1
0
MainWindow *MainWindow::present_default(const Note::Ptr & note)
{
  if(!note) {
    return NULL;
  }
  MainWindow *win = MainWindow::present_active(note);
  if(win) {
    return win;
  }
  Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_GNOTE);
  if(false == settings->get_boolean(Preferences::OPEN_NOTES_IN_NEW_WINDOW)) {
    win = dynamic_cast<MainWindow*>(note->get_window()->host());
  }
  if(!win) {
    win = &IGnote::obj().new_main_window();
    win->close_on_escape(settings->get_boolean(Preferences::ENABLE_CLOSE_NOTE_ON_ESCAPE));
  }
  win->present_note(note);
  win->present();
  return win;
}
Пример #2
0
  void NoteEditor::update_custom_font_setting()
  {
    Glib::RefPtr<Gio::Settings> settings = Preferences::obj()
      .get_schema_settings(Preferences::SCHEMA_GNOTE);

    if (settings->get_boolean(Preferences::ENABLE_CUSTOM_FONT)) {
      std::string fontString = settings->get_string(Preferences::CUSTOM_FONT_FACE);
      DBG_OUT( "Switching note font to '%s'...", fontString.c_str());
      modify_font_from_string (fontString);
    } 
    else {
      DBG_OUT("Switching back to the default font");
      override_font (get_gnome_document_font_description());
    }
  }
Пример #3
0
  NoteEditor::NoteEditor(const Glib::RefPtr<Gtk::TextBuffer> & buffer)
    : Gtk::TextView(buffer)
  {
    set_wrap_mode(Gtk::WRAP_WORD);
    set_left_margin(default_margin());
    set_right_margin(default_margin());
    property_can_default().set_value(true);

    Glib::RefPtr<Gio::Settings> settings = Preferences::obj().get_schema_settings(Preferences::SCHEMA_GNOTE);
    //Set up the schema to watch the default document font
    Glib::RefPtr<Gio::Settings> desktop_settings = Preferences::obj()
      .get_schema_settings(Preferences::SCHEMA_DESKTOP_GNOME_INTERFACE);
    if(desktop_settings) {
      desktop_settings->signal_changed().connect(
        sigc::mem_fun(*this, &NoteEditor::on_font_setting_changed));
    }

    // Set Font from preference
    if (settings->get_boolean(Preferences::ENABLE_CUSTOM_FONT)) {
      std::string font_string = settings->get_string(Preferences::CUSTOM_FONT_FACE);
      override_font (Pango::FontDescription(font_string));
    }
    else {
      override_font (get_gnome_document_font_description ());
    }

    settings->signal_changed().connect(sigc::mem_fun(*this, &NoteEditor::on_font_setting_changed));

    // Set extra editor drag targets supported (in addition
    // to the default TextView's various text formats)...
    Glib::RefPtr<Gtk::TargetList> list = drag_dest_get_target_list();

    
    list->add ("text/uri-list", (Gtk::TargetFlags)0, 1);
    list->add ("_NETSCAPE_URL", (Gtk::TargetFlags)0, 1);

    signal_key_press_event().connect(sigc::mem_fun(*this, &NoteEditor::key_pressed), false);
    signal_button_press_event().connect(sigc::mem_fun(*this, &NoteEditor::button_pressed), false);
  }