diff anagram/guisupport/wm1.cpp @ 0:13d2b8934445

Import AnaGram (near-)release tree into Mercurial.
author David A. Holland
date Sat, 22 Dec 2007 17:52:45 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/anagram/guisupport/wm1.cpp	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,92 @@
+/*
+ * 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 */