Cadabra
Computer algebra system for field theory problems
DiffViewer.hh
Go to the documentation of this file.
1 #pragma once
2 
3 #include <gtkmm.h>
4 #include <gtkmm/frame.h>
5 #include <string>
6 #include <istream>
7 
8 class DiffTextView : public Gtk::TextView {
9  public:
10  DiffTextView();
11  };
12 
13 class CellDiff : public Gtk::Frame {
14  public:
15  CellDiff(const std::string& a, const std::string& b);
16 
17  protected:
18  void compare(const std::string& a_str, const std::string& b_str);
19  Gtk::Grid grid;
21  Gtk::ScrolledWindow sw_lhs, sw_rhs;
22  };
23 
24 class DiffViewer : public Gtk::Dialog {
25  public:
26  DiffViewer(std::istream& a, std::istream& b, Gtk::Window& parent);
27  void run_noblock();
28  protected:
29  using Cells = std::pair<std::vector<std::string>, std::vector<std::string>>;
30 
31  void populate(std::istream& a, std::istream& b);
32  Cells make_cells(std::istream& stream);
33 
34  Gtk::Box box;
35  Gtk::ScrolledWindow scrolled_window;
36  std::vector<CellDiff> cells;
37  };
Definition: DiffViewer.hh:13
DiffTextView tv_lhs
Definition: DiffViewer.hh:20
void compare(const std::string &a_str, const std::string &b_str)
Definition: DiffViewer.cc:51
Gtk::Grid grid
Definition: DiffViewer.hh:19
Gtk::ScrolledWindow sw_rhs
Definition: DiffViewer.hh:21
DiffTextView tv_rhs
Definition: DiffViewer.hh:20
Gtk::ScrolledWindow sw_lhs
Definition: DiffViewer.hh:21
CellDiff(const std::string &a, const std::string &b)
Definition: DiffViewer.cc:24
Definition: DiffViewer.hh:8
DiffTextView()
Definition: DiffViewer.cc:12
Definition: DiffViewer.hh:24
void populate(std::istream &a, std::istream &b)
Definition: DiffViewer.cc:153
std::pair< std::vector< std::string >, std::vector< std::string > > Cells
Definition: DiffViewer.hh:29
Gtk::Box box
Definition: DiffViewer.hh:34
std::vector< CellDiff > cells
Definition: DiffViewer.hh:36
DiffViewer(std::istream &a, std::istream &b, Gtk::Window &parent)
Definition: DiffViewer.cc:125
Cells make_cells(std::istream &stream)
Definition: DiffViewer.cc:181
void run_noblock()
Definition: DiffViewer.cc:144
Gtk::ScrolledWindow scrolled_window
Definition: DiffViewer.hh:35