[gnote] Add menu items for increasing and decreasing the font size. (Tomboy bug #488822)
- From: Hubert Figuière <hub src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnote] Add menu items for increasing and decreasing the font size. (Tomboy bug #488822)
- Date: Sun, 19 Jul 2009 03:30:36 +0000 (UTC)
commit dd333e402d01fdc132f6d40e2cb719dad3d77a06
Author: Hubert Figuiere <hub figuiere net>
Date: Fri Jul 17 17:36:25 2009 -0400
Add menu items for increasing and decreasing the font size. (Tomboy bug #488822)
(tb-backport)
src/notewindow.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++
src/notewindow.hpp | 4 +++
2 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index f8bd1da..d3af732 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -1092,6 +1092,8 @@ namespace gnote {
, m_bullets(_("Bullets"))
, m_increase_indent(Gtk::Stock::INDENT)
, m_decrease_indent(Gtk::Stock::UNINDENT)
+ , m_increase_font(_("Increase Font Size"), true)
+ , m_decrease_font(_("Decrease Font Size"), true)
{
m_undo = manage(new Gtk::ImageMenuItem (Gtk::Stock::UNDO));
// m_undo->set_accel_group(accel_group);
@@ -1187,6 +1189,22 @@ namespace gnote {
m_hidden_no_size.hide();
+ m_increase_font.add_accelerator ("activate",
+ accel_group,
+ GDK_plus,
+ Gdk::CONTROL_MASK,
+ Gtk::ACCEL_VISIBLE);
+ m_increase_font.signal_activate()
+ .connect(sigc::mem_fun(*this, &NoteTextMenu::increase_font_clicked));
+
+ m_decrease_font.add_accelerator ("activate",
+ accel_group,
+ GDK_minus,
+ Gdk::CONTROL_MASK,
+ Gtk::ACCEL_VISIBLE);
+ m_decrease_font.signal_activate()
+ .connect(sigc::mem_fun(*this, &NoteTextMenu::decrease_font_clicked));
+
Gtk::SeparatorMenuItem *spacer2 = manage(new Gtk::SeparatorMenuItem());
m_bullets_clicked_cid = m_bullets.signal_activate()
@@ -1222,6 +1240,8 @@ namespace gnote {
append(m_normal);
append(m_large);
append(m_huge);
+ append(m_increase_font);
+ append(m_decrease_font);
append(*spacer2);
append(m_bullets);
append(m_increase_indent);
@@ -1344,6 +1364,48 @@ namespace gnote {
m_buffer->set_active_tag(tag);
}
+ void NoteTextMenu::increase_font_clicked ()
+ {
+ if (m_event_freeze)
+ return;
+
+ if (m_buffer->is_active_tag ("size:small")) {
+ m_buffer->remove_active_tag ("size:small");
+ }
+ else if (m_buffer->is_active_tag ("size:large")) {
+ m_buffer->remove_active_tag ("size:large");
+ m_buffer->set_active_tag ("size:huge");
+ }
+ else if (m_buffer->is_active_tag ("size:huge")) {
+ // Maximum font size, do nothing
+ }
+ else {
+ // Current font size is normal
+ m_buffer->set_active_tag ("size:large");
+ }
+ }
+
+ void NoteTextMenu::decrease_font_clicked ()
+ {
+ if (m_event_freeze)
+ return;
+
+ if (m_buffer->is_active_tag ("size:small")) {
+// Minimum font size, do nothing
+ }
+ else if (m_buffer->is_active_tag ("size:large")) {
+ m_buffer->remove_active_tag ("size:large");
+ }
+ else if (m_buffer->is_active_tag ("size:huge")) {
+ m_buffer->remove_active_tag ("size:huge");
+ m_buffer->set_active_tag ("size:large");
+ }
+ else {
+// Current font size is normal
+ m_buffer->set_active_tag ("size:small");
+ }
+ }
+
void NoteTextMenu::undo_clicked ()
{
if (m_undo_manager.get_can_undo()) {
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 0c8c89f..3a76142 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -64,6 +64,8 @@ private:
void toggle_bullets_clicked();
void increase_indent_clicked();
void decrease_indent_clicked();
+ void increase_font_clicked();
+ void decrease_font_clicked();
Glib::RefPtr<NoteBuffer> m_buffer;
UndoManager &m_undo_manager;
@@ -85,6 +87,8 @@ private:
Gtk::CheckMenuItem m_bullets;
Gtk::ImageMenuItem m_increase_indent;
Gtk::ImageMenuItem m_decrease_indent;
+ Gtk::MenuItem m_increase_font;
+ Gtk::MenuItem m_decrease_font;
sigc::connection m_bullets_clicked_cid;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]