view anagram/guisupport/redmenudc.cpp @ 18:562c313f14f4

some minor updates for 2022
author David A. Holland
date Tue, 31 May 2022 02:03:50 -0400
parents 13d2b8934445
children
line wrap: on
line source

/*
 * 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);
}