libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GtkCRNAltoDisplay.h
Go to the documentation of this file.
1 /* Copyright 2011-2016 CoReNum, INSA-Lyon
2  *
3  * This file is part of libgtkcrnmm.
4  *
5  * libgtkcrnmm is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * libgtkcrnmm is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libgtkcrnmm. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * file: GdkCRNAltoDisplay.h
19  * \author Yann LEYDIER
20  */
21 
22 #ifndef GtkCRNAltoDisplay_HEADER
23 #define GtkCRNAltoDisplay_HEADER
24 
25 #include <CRNXml/CRNAltoWrapper.h>
26 #include <GtkCRNDocument.h>
27 
28 #ifndef CRN_USING_GTKMM3
29 namespace GtkCRN
30 {
36  class Alto: public Gtk::HBox
37  {
38  public:
39  Alto();
40  virtual ~Alto() override {}
41 
42  void set_wrapper(const crn::xml::SAltoWrapper &w);
43 
54  Glib::RefPtr<Gtk::ActionGroup> get_actions() { return actions; }
55 
56  GtkCRN::Document& get_document() { return doc; }
57 
58  private:
60  // Callbacks
62  void on_view_changed();
63  void update_boxes();
64  void show_hide_pages();
65  void show_hide_spaces();
66  void show_hide_blocks();
67  void show_hide_lines();
68  void show_hide_words();
69  void toggle_edit();
70  void on_rmb_clicked(guint mouse_button, guint32 time, std::vector<std::pair<crn::String, crn::String> > overlay_items_under_mouse, int x, int y);
71  static void add_to_group(std::set<crn::xml::Id> *group, const crn::xml::Id &id) { group->insert(id); }
72  static void clear_group(std::set<crn::xml::Id> *group) { group->clear(); }
73  void add_page();
74  void delete_page(const crn::xml::Id &id);
75  void split_page(const crn::xml::Id &id, int x);
76  void merge_pages();
77  void edit_word(const crn::xml::Id &id);
78  void edit_line(const crn::xml::Id &id);
79  void on_overlay_changed(crn::String overlay_id, crn::String overlay_item_id, GtkCRN::Image::MouseMode mm);
80 
82  // Widgets
84  Glib::RefPtr<Gtk::ActionGroup> actions;
85  std::unique_ptr<Gtk::Menu> popup;
86 
88  // Attributes
90  GtkCRN::Document doc;
91  crn::xml::SAltoWrapper alto;
92  std::shared_ptr</*const*/ crn::xml::Alto> current_alto; // read only alto of the page
93  bool showpages, showspaces, showtextblocks, showtextlines, showwords;
94  bool edit_mode;
95  std::set<crn::xml::Id> pagegroup, spacegroup, textblockgroup, textlinegroup, wordgroup;
96 
97  static const crn::String pageList;
98  static const crn::String spaceList;
99  static const crn::String blockList;
100  static const crn::String lineList;
101  static const crn::String wordList;
102  };
103 }
104 #endif
105 
106 #endif
107 
Displays a crn::Document.
void set_wrapper(const crn::xml::SAltoWrapper &w)
GtkCRN::Document & get_document()
virtual ~Alto() override
XML Alto file wrapper.
Definition: CRNAlto.h:40
A UTF32 character string class.
Definition: CRNString.h:61
Glib::RefPtr< Gtk::ActionGroup > get_actions()
Gets the action group associated to the display.
XML Alto display.
MouseMode
State of the mouse activity.
Definition: GtkCRNImage.h:116
A character string class.
Definition: CRNStringUTF8.h:49