libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GtkCRNAltoImage.h
Go to the documentation of this file.
1 /* Copyright 2012-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: GdkCRNAltoImage.h
19  * \author Yann LEYDIER
20  */
21 
22 #ifndef GtkCRNAltoImage_HEADER
23 #define GtkCRNAltoImage_HEADER
24 
25 #include <GtkCRNImage.h>
26 #include <CRNXml/CRNAltoWrapper.h>
27 
28 #ifndef CRN_USING_GTKMM3
29 namespace GtkCRN
30 {
34  class AltoImage: public sigc::trackable
35  {
36  public:
37  AltoImage(Image *image = nullptr);
38  virtual ~AltoImage();
40  void set_image(Image *image);
42  void set_view(const crn::xml::AltoWrapper::View &v, bool display_image);
44  void unset_view(bool clear_image);
45 
46  void set_can_edit_pages(bool e) { can_edit_pages = e; }
47  void set_can_edit_spaces(bool e) { can_edit_spaces = e; }
48  void set_can_edit_blocks(bool e) { can_edit_blocks = e; }
49  void set_can_edit_lines(bool e) { can_edit_lines = e; }
50  void set_can_edit_words(bool e) { can_edit_words = e; }
51 
62  Glib::RefPtr<Gtk::ActionGroup> get_actions() { return actions; }
63 
64  sigc::signal<void, crn::xml::WordPath> signal_word_resized() { return word_resized; }
65  sigc::signal<void, crn::xml::WordPath> signal_word_deleted() { return word_deleted; }
66  sigc::signal<void, crn::xml::WordPath> signal_word_added() { return word_added; }
67  private:
68  void show_hide_pages();
69  void show_hide_spaces();
70  void show_hide_blocks();
71  void show_hide_lines();
72  void show_hide_words();
73  void toggle_edit();
74  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);
75  void on_overlay_changed(crn::String overlay_id, crn::String overlay_item_id, GtkCRN::Image::MouseMode mm);
76  void set_overlays();
77  void delete_word(crn::String spath);
78  void add_word();
79 
80  static const crn::String pageList;
81  static const crn::String spaceList;
82  static const crn::String blockList;
83  static const crn::String lineList;
84  static const crn::String wordList;
85 
86  Glib::RefPtr<Gtk::ActionGroup> actions;
87  Image *img;
88  sigc::connection rmb_connect, overlay_connect;
89  std::unique_ptr<Gtk::Menu> popup;
90 
91  bool showpages, showspaces, showtextblocks, showtextlines, showwords;
92  bool edit_mode;
93  std::unique_ptr<crn::xml::AltoWrapper::View> view;
94  sigc::signal<void, crn::xml::WordPath> word_resized;
95  sigc::signal<void, crn::xml::WordPath> word_deleted;
96  sigc::signal<void, crn::xml::WordPath> word_added;
97  bool can_edit_words, can_edit_lines, can_edit_blocks, can_edit_spaces, can_edit_pages;
98  };
99 }
100 
101 #endif
102 
103 #endif
104 
void set_can_edit_lines(bool e)
sigc::signal< void, crn::xml::WordPath > signal_word_resized()
void set_can_edit_blocks(bool e)
void set_can_edit_spaces(bool e)
void set_view(const crn::xml::AltoWrapper::View &v, bool display_image)
Sets the alto view.
AltoImage(Image *image=nullptr)
void set_image(Image *image)
Sets the Image widget to wrap around.
A UTF32 character string class.
Definition: CRNString.h:61
void set_can_edit_words(bool e)
Displays an alto page.
A widget that holds an image.
Definition: GtkCRNImage.h:43
MouseMode
State of the mouse activity.
Definition: GtkCRNImage.h:116
Glib::RefPtr< Gtk::ActionGroup > get_actions()
Gets the action group associated to the alto wrapper.
sigc::signal< void, crn::xml::WordPath > signal_word_added()
void unset_view(bool clear_image)
Unsets the alto view.
sigc::signal< void, crn::xml::WordPath > signal_word_deleted()
void set_can_edit_pages(bool e)