File: strategyeditor.h

package info (click to toggle)
aoflagger 3.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,000 kB
  • sloc: cpp: 67,891; python: 497; sh: 242; makefile: 22
file content (43 lines) | stat: -rw-r--r-- 982 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef STRATEGY_EDITOR_H
#define STRATEGY_EDITOR_H

#include <gtkmm/scrolledwindow.h>
#include <gtkmm/textview.h>

class StrategyEditor : public Gtk::ScrolledWindow {
 public:
  StrategyEditor();

  void SetText(const std::string& text);
  std::string GetText() const;

  void HighlightLine(size_t index) {
    _highlightLine = index;
    updateHighlighting();
  }

  void ResetChangedStatus() { _isChanged = false; }

  bool IsChanged() { return _isChanged; }

 private:
  struct ParseInfo {
    enum { Clear, FunctionStart } state;
  };
  Gtk::TextView _text;
  Glib::RefPtr<Gtk::TextBuffer::Tag> _tagKeyword, _tagComment, _tagString,
      _tagFunctionName, _tagHighlight;

  void parseWord(ParseInfo& p, Gtk::TextBuffer::iterator start,
                 Gtk::TextBuffer::iterator end);
  void updateChanges() {
    _highlightLine = 0;
    updateHighlighting();
    _isChanged = true;
  }
  void updateHighlighting();
  std::size_t _highlightLine;
  bool _isChanged;
};

#endif