22 #ifndef GtkCRNDocument_HEADER
23 #define GtkCRNDocument_HEADER
37 #ifdef CRN_USING_GTKMM3
45 Document(
bool show_views =
true,
bool show_tree =
true);
92 void append_views(
const std::vector<crn::Path> &filenames);
123 #ifdef CRN_USING_GTKMM3
142 Glib::RefPtr<Gio::SimpleActionGroup>&
get_views_actions() {
return views_actions;}
182 #ifdef CRN_USING_GTKMM3
238 crn::SDocument crndoc;
239 crn::SBlock current_block;
241 #ifdef CRN_USING_HARU
250 #ifdef CRN_USING_GTKMM3
251 Glib::RefPtr<Gio::SimpleActionGroup> views_actions;
253 Glib::RefPtr<Gtk::ActionGroup> views_actions;
267 static gboolean tsreloadimage(DVI *data);
269 sigc::signal<void, const crn::String, const std::vector<crn::String> > selection_changed;
270 sigc::signal<void, int, crn::StringUTF8>::iterator droppedin_handle;
271 sigc::signal<bool, const std::vector<crn::String> > may_delete_selection;
275 void moved(std::vector<size_t> to, std::vector<size_t> from);
277 void on_view_selection_changed(Gtk::Widget *last_selected_widget,
const std::vector<Gtk::Widget*> selection);
279 bool boxkeyevents(GdkEventKey *ev);
282 class View:
public Gtk::VBox
286 const crn::String& get_view_id()
const {
return view_id; }
287 void set_show_thumbnail(
bool s) {
if (s) thumb.show();
else thumb.hide(); }
288 void set_thumbnail(
const crn::Path &fname) { thumb.set(fname.
CStr()); }
289 void set_show_label(
bool s) {
if (s) lab.show();
else lab.hide(); }
290 void set_show_index(
bool s) {
if (s) index.show();
else index.hide(); }
291 void set_index(
size_t i) { index.set_text(
crn::StringUTF8(i).CStr()); }
298 SelectionBox view_box;
299 Gtk::Frame view_frame;
300 std::vector<std::shared_ptr<View> > views;
301 bool show_thumbnails, show_labels, show_indexes;
306 Gtk::ScrolledWindow tree_sw;
308 Gtk::Toolbar tree_buttons;
309 #ifdef CRN_USING_GTKMM3
310 Glib::RefPtr<Gio::SimpleActionGroup> tree_actions;
312 Glib::RefPtr<Gtk::ActionGroup> tree_actions;
316 class SubblockColumns :
public Gtk::TreeModelColumnRecord
319 SubblockColumns() { add(name); add(block); add(is_tree); add(coords); }
321 Gtk::TreeModelColumn<Glib::ustring> name;
322 Gtk::TreeModelColumn<crn::SBlock> block;
323 Gtk::TreeModelColumn<bool> is_tree;
324 Gtk::TreeModelColumn<Glib::ustring> coords;
326 SubblockColumns block_columns;
327 Glib::RefPtr<Gtk::TreeStore> block_tree_store;
328 Gtk::TreeView block_tree_view;
329 crn::SBlock blocksel;
336 void tree_add_children(Gtk::TreeModel::iterator &it, crn::SBlock b);
338 void subblock_selection_changed();
344 void configure_subblocks();
354 void show_hide_subblocks_on_image();
357 bool show_subblock_labels;
363 #ifdef CRN_USING_GTKMM3
364 Gtk::Box left_box, right_box;
368 Gtk::VBox left_box, right_box;
372 Gtk::Frame tree_frame;
void set_show_indexes(bool s)
Shall the views show their index.
Displays a crn::Document.
virtual ~Document() override
Destructor.
const crn::SDocument & get_document()
Gets the displayed document.
std::vector< crn::String > get_selected_views_ids()
Gets the selected views' ids.
void set_show_labels(bool s)
Shall the views show a label.
Glib::RefPtr< Gtk::ActionGroup > & get_subblock_actions()
Gets the action group associated to subblock management.
Base class for a progress display.
void set_subblocks_colors(const crn::pixel::RGB8 &col1, const crn::pixel::RGB8 &col2, const crn::pixel::RGB8 &textcol)
Sets the colors of the subblocks on the image.
void select_first()
If selection size is <= 1, then select the first view, else move last_selected to the first selected ...
GtkCRN::Image & get_image()
Gets the image widget.
void set_default_drop_in(bool b)
Shall we use the default handler for dropped elements? (true by default).
void invert_selection()
Inverts the view selection.
void set_show_subblocks_toolbar(bool s)
Shows or hides subblocks toolbar.
void select_all()
Selects all views.
sigc::signal< void, int, crn::StringUTF8 > signal_droppedin()
Signals when something was dropped from another application. Connect to void on_droppedin(int positio...
void select_even()
Selects even views.
sigc::signal< void, int, crn::StringUTF8 > signal_droppedin()
Signals when something was dropped from another application. Connect to void on_droppedin(int positio...
void delete_selection()
Removes all selected views from the document.
bool get_show_subblocks_toolbar() const
Is subblocks toolbar shown?
void select_odd()
Selects odd views.
A UTF32 character string class.
void append_views_dialog()
bool get_show_subblocks() const
Is subblocks tree shown?
void thread_safe_reload_image(const crn::String &view_id)
Refreshes the thumbnail of a view and the Image if needed (thread safe)
const char * CStr() const noexcept
Conversion to UTF8 cstring.
crn::String get_selected_view_id()
Gets the displayed views's id.
A convenience class for file paths.
void refresh_views()
Redraws the view list.
crn::SCBlock get_selected_block() const
Gets the displayed block.
void set_show_subblocks(bool s)
Shows or hides subblocks tree.
Gtk::Box & get_right_panel()
void set_document(const crn::SDocument &doc)
Sets the document to display.
void select_next()
If selection size is 0, the select the first element, if selection size is 1, then select the next vi...
void append_views(const std::vector< crn::Path > &filenames)
Appends new views at the end of the document.
void select_last()
If selection size is <= 1, then select the last view, else move last_selected to the last selected el...
void set_show_subblock_labels(bool s)
Shows or hides subblocks labels on the image.
bool get_show_subblock_labels() const
Are subblocks labels shown on the image?
crn::SCDocument get_document() const
Gets the displayed document.
Glib::RefPtr< Gtk::ActionGroup > & get_views_actions()
Gets the action group associated to views management.
sigc::signal< void, const crn::String, const std::vector< crn::String > > signal_view_selection_changed()
Signal when the selection has changed. Connect to void on_view_selection_changed(const crn::String la...
A widget that holds an image.
Gtk::Box & get_left_panel()
Return the VBox on the left of the image.
void reload_image(const crn::String &view_id)
Refreshes the thumbnail of a view and the Image if needed.
void set_show_thumbnails(bool s)
Shall the views show a thumbnail.
const GtkCRN::Image & get_image() const
Gets the image widget.
MouseMode
State of the mouse activity.
Document(bool show_views=true, bool show_tree=true)
Constructor.
void deselect_all()
Selects all views.
A character string class.
void set_selected_view(const crn::String &view_id)
Sets the one selected view.
void set_selection_colors(const crn::pixel::RGB8 &col1, const crn::pixel::RGB8 &col2)
Sets the colors of the user selection on the image.
const crn::SBlock & get_selected_block()
Gets the displayed block.
sigc::signal< bool, const std::vector< crn::String > > signal_delete_selection()
Signal when the selection is about to be deleted. Connect to bool on_delete_selection(const std::vect...
void select_previous()
If selection size is 0, the select the first element, if selection size is 1, then select the previou...