view anagram/vaclgui/ftview.hpp @ 24:a4899cdfc2d6 default tip

Obfuscate the regexps to strip off the IBM compiler's copyright banners. I don't want bots scanning github to think they're real copyright notices because that could cause real problems.
author David A. Holland
date Mon, 13 Jun 2022 00:40:23 -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.
 *
 * ftview.hpp
 */

#ifndef FTVIEW_HPP
#define FTVIEW_HPP

#include <ikeyevt.hpp>
#include <ikeyhdr.hpp>
#include <imcelcv.hpp>
#include <imousevt.hpp>
#include <imoushdr.hpp>
//#include <imphdr.hpp>
#include <ipainevt.hpp>
#include <ipainhdr.hpp>
//#include <isizehdr.hpp>
#include <isplitcv.hpp>
#include <istattxt.hpp>
#include <itbar.hpp>

class AgDataViewPlug; // from dvplug.hpp
struct tsd; // from tsd.h
#include "agstring.h"
#include "brt.h"
#include "conflicttrc.h"
#include "dview.hpp"
#include "frame.hpp"
#include "ftpardc.h"
#include "toolbar.hpp"
#include "trfview.hpp"
#include "vaclgui-res.h"


class FileTraceWindow; // below

class FileTraceView
  : public ICanvas
  , public AgFocusHandler
  , public IMouseHandler
  , public IPaintHandler
{
public:
  FileTraceView(FileTraceWindow*,text_file, AgString);
  ~FileTraceView();

  FileTraceView &refreshRules(int);

  FileTraceWindow *frame;

  ISplitCanvas mainSplitter;
    ISplitCanvas tracePanels;
      IMultiCellCanvas leftPanel;
        AgDataView stackView;
          AgDataViewPlug *stackConnector;
      IMultiCellCanvas rightPanel;
        IStaticText fileTitle;
        TraceFileView fileView;
    ISplitCanvas bottomPanel;
      AgDataView reductionChoiceView;
        DcRef<FtParserReductionDc> reductionMenu;
      AgDataView ruleView;
        AgDataViewPlug *ruleConnector;
  AgString fileName;
  text_file textFile;
  tsd *itemStack;
  DcRef<rule_stack_dc> ruleControl;
  DcRef<FtParserDc> parserDc;

  FileTraceView &completeReduction();
  //FileTraceView &setFocus();
  int focusControl;
  int activePanel;

  void mySetFocus() { setFocus(); }

protected:
  Boolean gotFocus(IEvent &);
  Boolean lostFocus(IEvent &);

  Boolean mouseClicked(IMouseClickEvent &event);
  Boolean paintWindow(IPaintEvent &event);

  AgNotificationAction<FileTraceView> dataColorChange;
  void onColorChange() {fileTitle.refresh();}
  AgNotificationAction<FileTraceView> fontChange;
  void onFontChange() {fileTitle.setFont(FontSpec::columnHead).refresh();}
  HelpDemon fileViewHelp;
};

class FileTraceWindow
  : public AgFrame
  , public AgFocusHandler
/*, public IKeyboardHandler - compiler complains because AgFrame has one */
  , public IMouseHandler
{
public:
  FileTraceWindow(AgString,int);
  ~FileTraceWindow();
  void stackSelect();
  void ruleSelect();
  void tokenSelect();
  void fileEnter();
  virtual AgString copyTitle();
  virtual FileTraceWindow &copyTo(IClipboard &c);

  // otherwise the compiler complains this is hidden
  virtual int showHelp(IEvent &e) { return AgFrame::showHelp(e); }

  void synchRules(unsigned sn, unsigned token);

  Boolean windowResize(IResizeEvent &event);
  Boolean gotFocus(IEvent&);

  Boolean characterKeyPress(IKeyboardEvent &);
  Boolean virtualKeyPress(IKeyboardEvent &);
  Boolean mouseClicked(IMouseClickEvent &event);

  void doStep();
  void parseFile();
  void resetParser();
  void reload();
  void showHelp();

  FileTraceWindow &setLocationField(cint loc);
  FileTraceWindow &setStatusField(const char *msg);

  FileTraceWindow &showReductionSelection();
  void reductionChoiceEnter();
  void onActivate();
  FileTraceWindow &setFocus();

public:
  ToolBar toolBar;
  IStaticText locationField;
  HelpDemon   locationFieldHelp;
  IStaticText statusField;
  HelpDemon   statusFieldHelp;
  FileTraceView canvas;
  AgString fileName;
  ToolBar buttonGroup;
  ToolButton stepButton;
  ToolButton parseButton;
  ToolButton resetButton;
  ToolButton reloadButton;
  ToolButton helpButton;

  virtual Boolean  findNext(AgString s);
  virtual Boolean  findPrev(AgString s);

  void onDesynch();
  void onResynch();

  class TabControl {
  public:
    int enabled;
    char *helpTopic;
    AgAction action;
    IWindow *window;

    TabControl() {}
    TabControl(IWindow *window_,
	       char *helpTopic_,
	       AgAction action_ = AgAction())
      : enabled(1)
      , helpTopic(helpTopic_)
      , action(action_)
      , window(window_)
      {}
    TabControl(const TabControl &x)
      : enabled(x.enabled)
      , helpTopic(x.helpTopic)
      , action(x.action)
      , window(x.window)
      {}
  };

  enum {
    stackTab,
    fileTab,
    choiceTab,
    ruleTab,
    stepTab,
    parseTab,
    resetTab,
    reloadTab,
    helpTab,
    nTabs
  };
  TabControl tabControl[nTabs];
};


#endif /* FTVIEW_HPP */