view anagram/guisupport/wm1.cpp @ 12:aab9ff6af791

Strengthen the build hack for non-DOS targets.
author David A. Holland
date Tue, 31 May 2022 00:58:42 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * AnaGram, A System for Syntax Directed Programming
 * Copyright 1993-1999 Parsifal Software. All Rights Reserved.
 * See the file COPYING for license and usage terms.
 *
 * wm1.cpp - Window Management Module
 */

#include "ctrlpanel.hpp"
#include "dpanel.hpp"
#include "dspar.hpp"
#include "dvplug.hpp"
#include "fileview.hpp"
#include "gtview.hpp"
#include "rule.h"
#include "wm1.h"

//#define INCLUDE_LOGGING
#include "log.h"    //LOG


void set_text_line(int line, int col , int right) {
  LOGSECTION("set_text_line");
  LOGV(syntaxFileId);
  if (syntaxFileId == 0) return;

  FileWindow *syntaxWindow =
    (FileWindow *) AgFrame::windowRegistry.find(syntaxFileId);
  LOGV((int) syntaxWindow);
  if (syntaxWindow == 0) return;
  LOGV(line);
  LOGV(col);
  line--;
  col--;
  cint whereNow = syntaxWindow->getCursorLocation();
  LOGV(whereNow);
  if (whereNow.y < line) {
    syntaxWindow->setCursorLocation(cint(col, line+4));
  }
  if (whereNow.y > line) {
    syntaxWindow->setCursorLocation(cint(col, line-4));
  }
  syntaxWindow->setCursorLocation(cint(col,line));
  LOGS("setCursorLocation returned");
}

void set_rule_line(unsigned fn) {
  LOGSECTION("set_rule_line");
  LOGV(fn);
  if (fn == 0 || fn > nforms_base) {
    return;
  }
  Rule rule(fn);

  set_text_line(rule->line, rule->col, 0);
  LOGS("set_text_line returned");
}


void pop_up_window(dc_ref window) {
  LOGSECTION("pop_up_window(dc_ref)");
  if (!window.exists()) {
    return;
  }
  LOGV(window->head_title) LCV(window->foot_title);

  AgFrame *newPanel;
  if (window->head_title == "Auxiliary Trace"
     || window->head_title == "Conflict Trace"
     || window->head_title == "Error Trace"
     || window->head_title == "Keyword Anomaly Trace"
      || window->head_title == "Reduction Trace") {
    newPanel = new GTWindow((trace_window_dc *) (dc *) window);
  }
  else {
    LOGS("ready to construct data panel");
    AgDataViewPlug *connector = new AgDataViewPlug(window);
    LOGS("connector built");
    window->windowConnector = connector;
    newPanel = new AgDataPanel(connector);
    LOGS("newPanel built");
    newPanel->syntaxDependent = connector->syntaxDependent();
    newPanel->show();
    LOGS("window showing");
  }
  newPanel->setAutoDeleteObject();
  LOGS("set autodelete");
  newPanel->setFocus();
  LOGS("succeeded in setting focus");
}

/* End WM1.C */