[gnote] Fix bullet indentation when printing



commit c1df5f9afa1aaf12c7b9dc762b99e85d017c5d6c
Author: Aurimas Äernius <aurisc4 gmail com>
Date:   Tue May 1 13:13:53 2012 +0300

    Fix bullet indentation when printing
    
    When printing notes with multiple levels of bullets, all bullet points
    are equally indented.
    Fixes bug 674904.
    Thanks Tim Jackson.

 src/addins/printnotes/printnotesnoteaddin.cpp |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/src/addins/printnotes/printnotesnoteaddin.cpp b/src/addins/printnotes/printnotesnoteaddin.cpp
index 294c187..d72b1cc 100644
--- a/src/addins/printnotes/printnotesnoteaddin.cpp
+++ b/src/addins/printnotes/printnotesnoteaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2011 Aurimas Cernius
+ * Copyright (C) 2010-2012 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -30,6 +30,7 @@
 
 #include "sharp/datetime.hpp"
 #include "debug.hpp"
+#include "notetag.hpp"
 #include "notewindow.hpp"
 #include "printnotesnoteaddin.hpp"
 #include "utils.hpp"
@@ -245,14 +246,13 @@ namespace printnotes {
     int start_index = p_start.get_line_index();
     indentation = 0;
 
+    double dpiX = context->get_dpi_x();
     {
       Pango::AttrList attr_list;
 
       Gtk::TextIter segm_start = p_start;
       Gtk::TextIter segm_end;
 
-      double dpiX = context->get_dpi_x();
-
       while (segm_start.compare (p_end) < 0) {
         segm_end = segm_start;
         std::list<Pango::Attribute> attrs;
@@ -276,6 +276,10 @@ namespace printnotes {
       layout->set_attributes(attr_list);
     }
 
+    gnote::DepthNoteTag::Ptr depth = get_buffer()->find_depth_tag(p_start);
+    if(depth != 0) {
+        indentation += ((int) (dpiX / 3)) * depth->get_depth();
+    }
     layout->set_width(pango_units_from_double((int)context->get_width() -
                                               m_margin_left - m_margin_right - indentation));
     layout->set_wrap (Pango::WRAP_WORD_CHAR);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]