Cadabra
Computer algebra system for field theory problems
TeXView.hh
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <gtkmm/eventbox.h>
5 #include <gtkmm/box.h>
6 #include <gtkmm/drawingarea.h>
7 #if GTKMM_MINOR_VERSION>=10
8 #include <gtkmm/revealer.h>
9 #endif
10 
11 #include "DataCell.hh"
12 #include "../common/TeXEngine.hh"
13 
14 namespace cadabra {
15 
19 
20  class TeXView : public Gtk::EventBox {
21  public:
22  TeXView(TeXEngine&, DTree::iterator, int hmargin=25);
23  virtual ~TeXView();
24 
25  std::shared_ptr<TeXEngine::TeXRequest> content;
26 
27  sigc::signal1<bool, DTree::iterator> show_hide_requested;
28 
29  DTree::iterator datacell;
30 #if GTKMM_MINOR_VERSION>=10
31  Gtk::Revealer rbox;
32 #endif
33  Gtk::VBox vbox;
34  Gtk::HBox hbox;
35 
36  class TeXArea : public Gtk::DrawingArea {
37  public:
38  virtual bool on_draw(const Cairo::RefPtr<Cairo::Context>& cr) override;
39 
43 
44  void update_image(std::shared_ptr<TeXEngine::TeXRequest>, double scale);
45 
49 
50  Glib::RefPtr<Gdk::Pixbuf> pixbuf;
51  double scale_;
52  };
53 
55 
57  void update_image();
58 
61 
62  void dim(bool);
63 
64  sigc::signal1<bool, std::string> tex_error;
65 
66  protected:
67  virtual bool on_button_release_event(GdkEventButton *) override;
68  virtual void on_show() override;
69  // virtual bool on_configure_event(GdkEventConfigure *) override;
70 
71  void convert();
72 
73  private:
75  };
76 
77  }
78 
TeXEngine is used to convert LaTeX strings into PNG images.
Definition: TeXEngine.hh:23
Definition: TeXView.hh:36
double scale_
Definition: TeXView.hh:51
virtual bool on_draw(const Cairo::RefPtr< Cairo::Context > &cr) override
Definition: TeXView.cc:116
Glib::RefPtr< Gdk::Pixbuf > pixbuf
The actual image is stored in the image referenced by pixbuf.
Definition: TeXView.hh:50
void update_image(std::shared_ptr< TeXEngine::TeXRequest >, double scale)
Update the visible image from the pixbuf.
Definition: TeXView.cc:90
TeXView is a widget which knows how to turn a string into a LaTeX-rendered image and display that.
Definition: TeXView.hh:20
Gtk::VBox vbox
Definition: TeXView.hh:33
TeXView(TeXEngine &, DTree::iterator, int hmargin=25)
Definition: TeXView.cc:11
virtual bool on_button_release_event(GdkEventButton *) override
Definition: TeXView.cc:79
TeXEngine & engine
Definition: TeXView.hh:74
void dim(bool)
Dim the output to indicate that the result is no longer guaranteed to be correlated with the input ce...
Definition: TeXView.cc:73
virtual ~TeXView()
Definition: TeXView.cc:34
TeXArea image
Definition: TeXView.hh:54
DTree::iterator datacell
Definition: TeXView.hh:29
void update_image()
Update the TeX image.
Definition: TeXView.cc:85
virtual void on_show() override
Definition: TeXView.cc:39
std::shared_ptr< TeXEngine::TeXRequest > content
Definition: TeXView.hh:25
Gtk::HBox hbox
Definition: TeXView.hh:34
void convert()
Definition: TeXView.cc:53
sigc::signal1< bool, DTree::iterator > show_hide_requested
Definition: TeXView.hh:27
sigc::signal1< bool, std::string > tex_error
Definition: TeXView.hh:64
Functions to handle the exchange properties of two or more symbols in a product.
Definition: Adjform.cc:83