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  };
CellDiff::sw_lhs
Gtk::ScrolledWindow sw_lhs
Definition: DiffViewer.hh:21
DiffViewer::run_noblock
void run_noblock()
Definition: DiffViewer.cc:144
DiffViewer::cells
std::vector< CellDiff > cells
Definition: DiffViewer.hh:36
DiffViewer::populate
void populate(std::istream &a, std::istream &b)
Definition: DiffViewer.cc:153
CellDiff
Definition: DiffViewer.hh:13
DiffViewer::make_cells
Cells make_cells(std::istream &stream)
Definition: DiffViewer.cc:181
DiffViewer
Definition: DiffViewer.hh:24
CellDiff::tv_rhs
DiffTextView tv_rhs
Definition: DiffViewer.hh:20
DiffTextView
Definition: DiffViewer.hh:8
CellDiff::compare
void compare(const std::string &a_str, const std::string &b_str)
Definition: DiffViewer.cc:51
CellDiff::sw_rhs
Gtk::ScrolledWindow sw_rhs
Definition: DiffViewer.hh:21
DiffViewer::box
Gtk::Box box
Definition: DiffViewer.hh:34
CellDiff::tv_lhs
DiffTextView tv_lhs
Definition: DiffViewer.hh:20
CellDiff::grid
Gtk::Grid grid
Definition: DiffViewer.hh:19
DiffViewer::scrolled_window
Gtk::ScrolledWindow scrolled_window
Definition: DiffViewer.hh:35
DiffViewer::DiffViewer
DiffViewer(std::istream &a, std::istream &b, Gtk::Window &parent)
Definition: DiffViewer.cc:125
DiffTextView::DiffTextView
DiffTextView()
Definition: DiffViewer.cc:12
DiffViewer::Cells
std::pair< std::vector< std::string >, std::vector< std::string > > Cells
Definition: DiffViewer.hh:29
CellDiff::CellDiff
CellDiff(const std::string &a, const std::string &b)
Definition: DiffViewer.cc:24