[gnote] Remove direction from NoteTag



commit d03bf472a32b321dd9ded10d12b4da97f55f81c0
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Sep 22 22:51:08 2019 +0300

    Remove direction from NoteTag

 src/notebuffer.cpp | 13 +++----------
 src/notetag.cpp    | 20 ++++++--------------
 src/notetag.hpp    |  5 ++---
 3 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/src/notebuffer.cpp b/src/notebuffer.cpp
index cb33493d..88101634 100644
--- a/src/notebuffer.cpp
+++ b/src/notebuffer.cpp
@@ -989,7 +989,7 @@ namespace gnote {
         NoteTagTable::Ptr note_table = NoteTagTable::Ptr::cast_dynamic(get_tag_table());
 
         // Get the depth tag for the given direction
-        Glib::RefPtr<Gtk::TextTag> new_tag = note_table->get_depth_tag (tag->get_depth(), direction);
+        Glib::RefPtr<Gtk::TextTag> new_tag = note_table->get_depth_tag(tag->get_depth());
 
         Gtk::TextIter next = iter;
         next.forward_char ();
@@ -1006,7 +1006,7 @@ namespace gnote {
   {
     NoteTagTable::Ptr note_table = NoteTagTable::Ptr::cast_dynamic(get_tag_table());
 
-    DepthNoteTag::Ptr tag = note_table->get_depth_tag (depth, direction);
+    DepthNoteTag::Ptr tag = note_table->get_depth_tag(depth);
 
     Glib::ustring bullet =
       Glib::ustring(1, s_indent_bullets [depth % NUM_INDENT_BULLETS]) + " ";
@@ -1504,14 +1504,7 @@ namespace gnote {
           } 
           else if (xml.get_name() == "list-item") {
             if (curr_depth >= 0) {
-              if (xml.get_attribute ("dir") == "rtl") {
-                tag_start.tag =
-                  note_table->get_depth_tag (curr_depth, Pango::DIRECTION_RTL);
-              } 
-              else {
-                tag_start.tag =
-                  note_table->get_depth_tag (curr_depth, Pango::DIRECTION_LTR);
-              }
+              tag_start.tag = note_table->get_depth_tag(curr_depth);
               list_stack.push_front (false);
             } 
             else {
diff --git a/src/notetag.cpp b/src/notetag.cpp
index 08de7a8a..4f453d1d 100644
--- a/src/notetag.cpp
+++ b/src/notetag.cpp
@@ -341,11 +341,10 @@ namespace gnote {
     }
   }
   
-  DepthNoteTag::DepthNoteTag(int depth, Pango::Direction direction)
+  DepthNoteTag::DepthNoteTag(int depth)
     : NoteTag("depth:" + TO_STRING(depth) 
-              + ":" + TO_STRING((int)direction))
+              + ":" + TO_STRING((int)Pango::DIRECTION_LTR))
     , m_depth(depth)
-    , m_direction(direction)
   {
   }
 
@@ -563,23 +562,16 @@ namespace gnote {
   }
   
 
-  DepthNoteTag::Ptr NoteTagTable::get_depth_tag(int depth, Pango::Direction direction)
+  DepthNoteTag::Ptr NoteTagTable::get_depth_tag(int depth)
   {
-    Glib::ustring name = "depth:" + TO_STRING(depth) + ":" + TO_STRING((int)direction);
+    Glib::ustring name = "depth:" + TO_STRING(depth) + ":" + TO_STRING((int)Pango::DIRECTION_LTR);
 
     DepthNoteTag::Ptr tag = DepthNoteTag::Ptr::cast_dynamic(lookup(name));
 
     if (!tag) {
-      tag = DepthNoteTag::Ptr(new DepthNoteTag (depth, direction));
+      tag = DepthNoteTag::Ptr(new DepthNoteTag(depth));
       tag->property_indent().set_value(-14);
-
-      if (direction == Pango::DIRECTION_RTL) {
-        tag->property_right_margin().set_value((depth+1) * 25);
-      }
-      else {
-        tag->property_left_margin().set_value((depth+1) * 25);
-      }
-
+      tag->property_left_margin().set_value((depth+1) * 25);
       tag->property_pixels_below_lines().set_value(4);
       tag->property_scale().set_value(Pango::SCALE_MEDIUM);
       add (tag);
diff --git a/src/notetag.hpp b/src/notetag.hpp
index 8a92253a..99b81bf0 100644
--- a/src/notetag.hpp
+++ b/src/notetag.hpp
@@ -222,7 +222,7 @@ class DepthNoteTag
 public:
   typedef Glib::RefPtr<DepthNoteTag> Ptr;
 
-  DepthNoteTag(int depth, Pango::Direction direction);
+  DepthNoteTag(int depth);
 
   int get_depth() const
     { 
@@ -235,7 +235,6 @@ public:
   virtual void write(sharp::XmlWriter &, bool) const override;
 private:
   int            m_depth;
-  Pango::Direction m_direction;
 };
 
 
@@ -294,7 +293,7 @@ public:
   /// <returns>ChangeType to save this NoteTag</returns>
   ChangeType get_change_type(const Glib::RefPtr<Gtk::TextTag> &tag);
 
-  DepthNoteTag::Ptr get_depth_tag(int depth, Pango::Direction direction);
+  DepthNoteTag::Ptr get_depth_tag(int depth);
   DynamicNoteTag::Ptr create_dynamic_tag(const Glib::ustring & );
   void register_dynamic_tag(const Glib::ustring & tag_name, const Factory & factory);
   bool is_dynamic_tag_registered(const Glib::ustring &);


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