diff anagram/vaclgui/dvplug.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/vaclgui/dvplug.cpp	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,129 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1997-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * dvplug.cpp
+ */
+
+#include "action.h"
+#include "dvplug.hpp"
+#include "dc.h"
+#include "p.h"
+#include "stacks.h"
+#include "wm1.h"
+
+//#define INCLUDE_LOGGING
+#include "log.h"
+
+
+AgDataViewPlug::~AgDataViewPlug() {
+  LOGSECTION("AgDataViewPlug::~AgDataViewPlug");
+  LOGV((int) this) LCV(displayControl->usage_count);
+}
+
+IColor AgDataViewPlug::color[10] = {
+  IColor::blue, IColor::white,             // table body
+  IColor:: darkRed, IColor::white,         // cursor bar
+  IColor::paleGray, IColor::black,         // head title
+  IColor::white, IColor::darkBlue,         // column head titles
+  IColor::paleGray, IColor::black          // foot title
+};
+
+void AgDataViewPlug::disconnect() {
+  displayControl.discardData();
+}
+
+void AgDataViewPlug::setFocus() {
+  dataView->setFocus();
+}
+
+int AgDataViewPlug::getCursorLine() {
+  //LOGSECTION("AgDataViewPlug::getCursorLine");
+  return dataView->getCursorLine();
+}
+
+unsigned AgDataViewPlug::nColumns() {
+  int *tabs = displayControl->tab_stops;
+  if (tabs == 0) {
+    return 1;
+  }
+  unsigned i = 1;
+  while (*tabs++) {
+    i++;
+  }
+  return i;
+}
+
+void AgDataViewPlug::show() {
+  pop_up_window(displayControl);
+}
+
+AgString AgDataViewPlug::getLine(unsigned k) {
+  extern char *string_base;
+
+  LOGSECTION("AgDataViewPlug::getLine");
+  LOGV((int) (dc *) displayControl);
+  displayControl->getLine(k);
+  LOGV(string_base);
+  return buildAgString();
+}
+
+AgString AgDataViewPlug::findHelpTopic() {
+  displayControl->des->c_loc_doc.y = getCursorLine();
+  return displayControl->findHelpTopic();
+}
+
+int AgDataViewPlug::syntaxDependent() {
+  return displayControl->syntax_dependent;
+}
+
+unsigned AgDataViewPlug::nLines() { return displayControl->des->d_size.y; }
+int AgDataViewPlug::nextChildId() { return ::nextChildId(); }
+
+AgString AgDataViewPlug::fileName() { return simple_file_name; }
+AgString AgDataViewPlug::headTitle() {
+  return displayControl->head_title;
+}
+AgString AgDataViewPlug::columnHeadTitle() {
+  return displayControl->columnHeadTitle;
+}
+AgString AgDataViewPlug::footTitle() {
+  return displayControl->foot_title;
+}
+
+AgArray<AgMenuItem> AgDataViewPlug::auxMenu() {
+  LOGSECTION("AgDataViewPlug::auxMenu");
+  LOGV((int) dataView);
+  LOGV((int) dataView->frameWindow);
+  dc::MenuOption **auxMenu = displayControl->getAuxWinMenu();
+  LOGV((int) auxMenu);
+  int n = 0;
+  int i;
+  if (auxMenu) {
+    while (auxMenu[n]) {
+      n++;
+    }
+  }
+  LOGV(n);
+  LOGV((int) dataView->frameWindow);
+  LOGV((int) (dc *) displayControl);
+  AgArray<AgMenuItem> menu(n);
+  for (i = 0; i < n; i++) {
+    LOGV(i) LCV(auxMenu[i]->option_name);
+    LOGV((int) dataView->frameWindow);
+    menu[i] = AgMenuItem(auxMenu[i]->option_name,
+			 AgClassAction<dc>(*displayControl,
+					   auxMenu[i]->action),
+			 (dc *) displayControl);
+    LOGV((int) menu[i].displayControl);
+    LOGV((int) dataView->frameWindow);
+  }
+  return menu;
+}
+
+void AgDataViewPlug::synchCursor(unsigned ln) {
+  LOGSECTION("AgDataViewPlug::synchCursor");
+  LOGV((int) (dc *) displayControl);
+  displayControl->synchCursor(ln);
+}