diff anagram/guisupport/redmenudc.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/redmenudc.cpp	Sat Dec 22 17:52:45 2007 -0500
@@ -0,0 +1,62 @@
+/*
+ * AnaGram, A System for Syntax Directed Programming
+ * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
+ * See the file COPYING for license and usage terms.
+ *
+ * redmenudc.cpp
+ */
+
+#include "cint.h"
+#include "dc.h"
+#include "q1glbl.h"
+#include "redmenudc.h"
+#include "stacks.h"
+#include "token.h"
+#include "ut.h"
+
+//#define INCLUDE_LOGGING
+#include "log.h"
+
+
+static int reduction_menu_tabs[] = {7,0};
+
+reduction_menu_dc::reduction_menu_dc(unsigned rn)
+  : dc("Select Reduction Token", AgString::format("Rule %d", rn))
+{
+  int length;
+  int i, dw;
+  rule_number = rn;
+  //des->c_size = cursor_bar_size;
+
+  if (rn == 0) {
+    length = 0;
+  }
+  else {
+    length = ibnfn[rn];
+  }
+
+  for (i = dw = 0; i < length; i++) {
+    int tn = ibnfs[ibnfb[rn] + i];
+    int k;
+    ics();
+    atkn(tn);
+    k = reduction_menu_tabs[0] + rcs();
+    if (k > dw) {
+      dw = k;
+    }
+  }
+  tab_stops = reduction_menu_tabs;
+  des->d_size = cint(dw, length);
+  //manual_resize = 0;
+  //resize_window();
+}
+
+void reduction_menu_dc::getLine(unsigned ln) const {
+  unsigned tn;
+
+  tn = ibnfs[ibnfb[rule_number] + ln];
+  //ssprintf("T%03u: ", tn);
+  ssprintf("T%03u:\t", tn);
+  atkn(tn);
+}
+