view anagram/vaclgui/trfview.hpp @ 21:1c9dac05d040

Add lint-style FALLTHROUGH annotations to fallthrough cases. (in the parse engine and thus the output code) Document this, because the old output causes warnings with gcc10.
author David A. Holland
date Mon, 13 Jun 2022 00:04:38 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
 * See the file COPYING for license and usage terms.
 *
 * trfview.hpp
 */

#ifndef TRFVIEW_HPP
#define TRFVIEW_HPP

#include "digset.hpp"
#include "fileview.hpp"
#include "ftpar.h"
#include "sparse.h"


class TraceFileView
  : public FileView
{
public:
  TraceFileView(IWindow *owner, text_file &file_, AgString);
  ~TraceFileView();

  int findMaxWidth();
  ISize suggestSize();

  virtual Boolean paintWindow(IPaintEvent &event);

  int tableWidth;
  virtual int charPosition(int xPos, AgString line);
  virtual int xPosition(int charPos, AgString line);

  cint getCursorLocation();

  AgAction desynchAction;
  AgAction resynchAction;

public:
  TraceFileView &turnHighlightOff();
  TraceFileView &turnHighlightOn(unsigned);
  TraceFileView &refreshHighlight(cint oldLoc);
  TraceFileView &step();
  TraceFileView &parse();
  void parseToCursor();
  AgAction parseAction;
  virtual void reload();

  FtParser parser;
  AgSparseIntArray reductionTable;
  virtual Boolean  findNext(AgString);
  virtual Boolean  findPrev(AgString);

protected:
  Boolean mouseClicked(IMouseClickEvent &event);
  Boolean virtualKeyPress(IKeyboardEvent &event);
  Boolean mousePointerChange(IMousePointerEvent &event);
  TraceFileView &parseLine(int ln, AgString, int, int);
  int measureWidth(const char *);
  TraceFileView &doLayout();
  TraceFileView &refreshLines(int, int);

private:
  int clickEnabled;
  int doubleClickEnabled;
  IFont windowFont;
  AgStack<DigSetter::Dig> dig;
  static DigSetter::Style displayStyle[4];
  AgStack<DigSetter::Hole> hole;
  DigSetter setter;
  int  activeHighlight;
  cint beginHighlight;
  cint endHighlight;
  int topLine;
  int margin;
  int measure;
  int enWidth;
  int lineHeight;
  int nDigs;
  int nHoles;
  int painting;
  int charWidth[256];

  AgNotificationAction<TraceFileView> dataColorChange;
  void onColorChange() {refresh();}
  AgNotificationAction<TraceFileView> fontChange;
  void onFontChange();
};

#endif /* TRFVIEW_HPP */