Пример #1
0
void bild()
{
char datum[9], zeit[9], s[80];
  MFORE=WHITE; MBACK=BLUE;
  _clearscreen(0);
  for(i=0;i<80;i++) printf("-");
  colored(); _settextposition(2,1);
  for(i=0;i<14;i++)
  {
    sprintf(s,"%c",0xf9);
    _outtext(s);
  }
  sprintf(s,"STOMA%cVersion%c%1.1f%c-%cCopyright%c(C)%c1993,94%cRalf%cBensmann\
",0xf9,0xf9,stoma_ver,0xf9,0xf9,0xf9,0xf9,0xf9,0xf9);
  _outtext(s);
  for(i=0;i<11;i++) { sprintf(s,"%c",0xf9); _outtext(s); }
  uncolored();
  for(i=0;i<80;i++) printf("-");
  _strdate(datum); _strtime(zeit);
  _settextposition(6,1); printf("Datum: %s",datum);
  _settextposition(6,67); printf("Zeit: %s",zeit);
  _settextposition(7,1); printf("MS-DOS: %s",dosversion());
  MFORE=WHITE; MBACK=RED;
}
Пример #2
0
int destroy_windows( void ) {

#ifdef DIAGNOSTICS
   fprintf(stderr, "entering DESTROY_WINDOWS\n");
#endif

   _settextwindow ( 1, 1, 24, 80 );
   _settextposition ( 24, 1 );

#ifdef DIAGNOSTICS
   fprintf(stderr, "exit DESTROY_WINDOWS\n");
#endif

   return ( 0 ) ;
}
Пример #3
0
void clear_region(struct rccoord start, int num_cells) {
    struct rccoord oldpos = _gettextposition();
    DWORD cCharsWritten;
    CONSOLE_SCREEN_BUFFER_INFO record;

    GetConsoleScreenBufferInfo(STDCONSOLE, &record);

    // fill with blanks
    FillConsoleOutputCharacter(STDCONSOLE, ' ', num_cells, rccoord_to_COORD(start), &cCharsWritten);

    // reset attributes
    FillConsoleOutputAttribute(STDCONSOLE, record.wAttributes, num_cells, rccoord_to_COORD(start), &cCharsWritten);

    _settextposition(oldpos.row, oldpos.col);
    return;
}
void Ausg_Punkt_Inv(char nr,char maxbr,char *basisadr,char x,char y)
{
   char memstr[40];
   short oldtxtcol=_gettextcolor();
   long  oldbkcol =_getbkcolor();

   _settextposition(y,x);
   strcpy(memstr,basisadr+nr*maxbr);
   _settextcolor((short)oldbkcol); /*0*/
   _setbkcolor((long)oldtxtcol);	/*15*/
   /* TM_Prot(); */
   _outtext(memstr);
   /* TM_Prot(); */
   _settextcolor(oldtxtcol);
   _setbkcolor(oldbkcol);
}
Пример #5
0
main()
{
    int i, j, rows;
    char buf[ 80 ];

    for( i = 0; i < 8; ++i ) {
	rows = valid_rows[ i ];
	if( _settextrows( rows ) == rows ) {
	    for( j = 1; j <= rows; ++j ) {
		sprintf( buf, "Line %d", j );
		_settextposition( j, 1 );
		_outtext( buf );
	    }
	    getch();
	}
    }
    _setvideomode( _DEFAULTMODE );
}
Пример #6
0
void displayEditShopBooleansMenu(shop *shp, const char *mobName,
                                 const long mobNumb)
{
  char newName[256], *strn;


  strn = new char[4096];
  if (!strn)
  {
    _outtext("\n\nout of memory - cannot alloc strn in displayEditShopBooleansMenu\n\n");
    return;
  }

  _clearscreen(7, 0);

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixMobName(mobName, newName);

  sprintf(strn, "&+gEditing shop toggles for mob #&+c%d&+w, &+L\"&n%s&+L\"&n\n\n",
          mobNumb, newName);

  displayColorString(strn);

  sprintf(strn,
  "   &+YA&+L.&n &+wDoes shop roam?                            %s\n"
  "   &+YB&+L.&n &+wIs shop's room NO_MAGIC?                   %s\n"
  "   &+YC&+L.&n &+wAllow shopkeeper to be killed?             %s\n"
  "\n"
  MENU_COMMON
  "\n"
  "%s", getYesNoStrn(shp->roaming),
        getYesNoStrn(shp->noMagic),
        getYesNoStrn(shp->killable),

        getMenuPromptName());

  displayColorString(strn);

  delete[] strn;
}
Пример #7
0
void cwindow::onctrl_home()
{           
	int	i;
	
	_settextwindow(m_nrow1 + 1, m_ncol1 + 1, m_nrow2 - 1, m_ncol2 - 1);
	_clearscreen(_GWINDOW);   
	m_pitemactive = m_pitemhead;
	for(i = 1; i <= m_nmaxrows; i ++)
	{                
		if(i > m_nitemcount) break;
		_settextposition(i, 2);
		_outtext(m_pitemactive->szitemtext);
		if(m_pitemactive->pnext != NULL) 
			m_pitemactive = m_pitemactive->pnext;
	}                                 
	m_pitemactive = m_pitemhead;
	m_nactiverow = 1;
	modifyattrib(m_npage, m_nactiverow + m_nrow1, 1 + m_ncol1, SELCOLOR, WHITE, m_nmaxcols);
	_settextwindow(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);
}
Пример #8
0
static int
iqc_setpos( void )
   {
   union REGS ibm_registers;

   /* call the BDOS function 0x10 to read the current cursor position */

   ibm_registers.h.ah = 3;
   ibm_registers.h.bh = (unsigned char) _getvisualpage();
   int86( 0x10, &ibm_registers, &ibm_registers );

   /* set text to this position */

   _settextposition( ibm_registers.h.dh, ibm_registers.h.dl );

   /* and move down one position */

   prn_xprintf( stdout, "\n" );

   return TRUE;
   }
/* Grafikbildschirm einrichten */
void SimBildschirmmaske(void)
{
  char buf_l[20],buf_d[20];

  sprintf(buf_l,"%6.2f",(float)laenge/100.0F);
  sprintf(buf_d,"%6.2f",(float)durchm/100.0F);

  _setcolor(7);
  _moveto(0,431);
  _lineto(640,431);
  _settextposition(1,1);

   _outtext(" Simulator:   � Pausefunktion: Stop stArt � Trace: troN troFf | Ende: ESC\n");
  _moveto(0,7);
  _lineto(640,7);
  _outtext("X-Drm �:                  Werkzeug: T01 (Ref)        Koordinaten:INC \n");
  _outtext("Z-Pos  :                  Trace   : Aus \n");
  _outtext("\nWerkst�ck: l=");
  _outtext(buf_l);
  _outtext("mm  �=");
  _outtext(buf_d);
  _outtext("mm            Status:\nMeldung  :");

  _moveto(0,7);
  _lineto(640,7);
  _moveto(0,48);
  _lineto(640,48);
  _moveto(0,175);
  _lineto(640,175);

  /* Graphicfenster */
  _setviewport(0,49,639,174);
  _setvieworg(0,50);

  Zeichne_stueck();

  /* Maschinen-NP */
  _ellipse(_GFILLINTERIOR,2,2,-2,-2);
}
Пример #10
0
void cwindow::onctrl_end()
{
	int	i, j;
	
	_settextwindow(m_nrow1 + 1, m_ncol1 + 1, m_nrow2 - 1, m_ncol2 - 1);
	_clearscreen(_GWINDOW);   
	m_pitemactive = m_pitemend;
	for(i = 1; i < m_nmaxrows; i ++)
	{
		if(m_pitemactive->ppre == NULL) break;
		m_pitemactive = m_pitemactive->ppre;   
	}
	for(j = 1; j <= i; j ++)//from next page'end to head outtext
	{   
		_settextposition(j, 2);
		_outtext(m_pitemactive->szitemtext);
		if(m_pitemactive->pnext != NULL) 
			m_pitemactive = m_pitemactive->pnext;
	}                                 
	m_pitemactive = m_pitemend;
	m_nactiverow = i;
	modifyattrib(m_npage, m_nactiverow + m_nrow1, 1 + m_ncol1, SELCOLOR, WHITE, m_nmaxcols);
	_settextwindow(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);
}
Пример #11
0
char jumpObj(const dikuObject *obj, ulong *numb)
{
  struct rccoord coords;
  char strn[128], numbStrn[64];
  ulong numb2;


  coords = _gettextposition();
//  coords.row -= 2;

  _settextposition(coords.row, 1);
  clrline(coords.row);

  while (TRUE)
  {
    sprintf(strn, "&+CJump to which object (%u-%u, ? for list, $ to search): &n",
            getLowestObjNumber(), getHighestObjNumber());
    displayColorString(strn);

    itoa(obj->objNumber, numbStrn, 10);

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strcmp(strn, "?"))
    {
      displayObjectTypeList();
    }
    else
    if (!strcmp(strn, "$"))
    {
      strn[0] = 0;

      _setbkcolor(0);
      displayColorString("\n&+CEnter substring to search object list for: &n");
      getStrn(strn, 25, 1, 7, '°', strn, FALSE, FALSE);
      upstrn(strn);

      displayObjectTypeList(strn, FALSE);
    }
    else
    {
      numb2 = strtoul(strn, NULL, 10);

      if ((!strnumer(strn)) || (numb2 >= numbLookupEntries) ||
          (!findObj(numb2)))
      {
        clrline(coords.row, 7, 0);
        _settextposition(coords.row, 1);
        _setbkcolor(0);

        displayColorString(getMenuPromptName());

        return MENU_JUMP_ERROR;
      }
      else
      {
        *numb = numb2;
        return MENU_JUMP_VALID;
      }
    }
  }
}
Пример #12
0
void displayEditObjTypeMenu(dikuObject *obj)
{
  char strn[512], newName[256], *outStrn = new char[4096];


  _clearscreen(7, 0);

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixObjName(obj->objShortName, newName);

  sprintf(strn, "&n&+gEditing object type #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
          obj->objNumber, newName);

  displayColorString(strn);

  if (getShowMenuInfoVal())
  {
    sprintf(outStrn,
  " &+YA/B&+L.&n &+wEdit object short/long name&n\n"
  "   &+YC&+L.&n &+wEdit object keywords &+c(%s)&n\n"
  " &+YD/E&+L.&n &+wEdit object extra/extra2 flags &+c(%u/%u)&n\n"
  "   &+YF&+L.&n &+wEdit object wear flags &+c(%u)&n\n"
  " &+YG/H&+L.&n &+wEdit object anti/anti2 flags &+c(%u/%u)&n\n"
  "   &+YI&+L.&n &+wEdit type &+c(%s)&n, values &+c(%d %d %d %d %d %d %d %d)&n,\n"
  "      and applies &+c(%s %d, %s %d)&n\n"
  "   &+YJ&+L.&n &+wEdit material &+c(%s&+c)&n, weight &+c(%d)&n, craftsmanship &+c(%d)&n\n"
  "   &+YK&+L.&n &+wEdit object extra descs &+c(%u)&n\n"
  "   &+YM&+L.&n &+wEdit object trap info &+c(%s&+c %s&+c [%d charge%s, level %u])&n\n",

    getReadableKeywordStrn(obj->keywordListHead, strn),

    obj->extraBits.longIntFlags,
    obj->extra2Bits.longIntFlags,
    obj->wearBits.longIntFlags,
    obj->antiBits.longIntFlags,
    obj->anti2Bits.longIntFlags,

    getObjTypeStrnShort(obj->objType),
    obj->objValues[0], obj->objValues[1], obj->objValues[2],
    obj->objValues[3], obj->objValues[4], obj->objValues[5],
    obj->objValues[6], obj->objValues[7],
      getObjApplyStrnShort(obj->objApply[0].applyWhere),
      obj->objApply[0].applyModifier,
      getObjApplyStrnShort(obj->objApply[1].applyWhere),
      obj->objApply[1].applyModifier,

    getMaterialStrn(obj->material),
    obj->weight,
    obj->craftsmanship,

    getNumbExtraDescs(obj->extraDescHead),

    getObjTrapAffStrn(obj->trapAff, newName), getObjTrapDamStrn(obj->trapDam),
      obj->trapCharge, plural(obj->trapCharge), obj->trapLevel);


    if (getObjAffectVal())
    {
      sprintf(strn,
  " &+YN/O&+L.&n &+wEdit object affect1/affect2 flags &+c(%u/%u)&n\n",
            obj->affect1Bits.longIntFlags,
            obj->affect2Bits.longIntFlags);

      strcat(outStrn, strn);

      sprintf(strn,
  " &+YP/Q&+L.&n &+wEdit object affect3/affect4 flags &+c(%u/%u)&n\n",
            obj->affect3Bits.longIntFlags,
            obj->affect4Bits.longIntFlags);

      strcat(outStrn, strn);
    }

    sprintf(strn,
  "\n"
  "   &+YL&+L.&n &+wSet limit of loads for all objs of type &+c(%u/%u)&n\n"
  "   &+YR&+L.&n &+wSet mud-wide object load limit &+c(%u) (0=no limit)&n\n"
  "   &+YV&+L.&n &+wChange object's vnum&n\n"
  "\n"
  MENU_COMMON
//  "\n"
  "\n", getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE),
        obj->maxload, obj->globalmaxload );

    strcat(outStrn, strn);

    strcat(outStrn, getMenuPromptName());
  }
  else  // no extra info
  {
    strcpy(outStrn,
  " &+YA/B&+L.&n &+wEdit object short/long name&n\n"
  "   &+YC&+L.&n &+wEdit object keywords&n\n"
  "   &+YD&+L.&n &+wEdit object extra flags&n\n"
  "   &+YE&+L.&n &+wEdit object extra2 flags&n\n"
  "   &+YF&+L.&n &+wEdit object wear flags&n\n"
  "   &+YG&+L.&n &+wEdit object anti flags&n\n"
  "   &+YH&+L.&n &+wEdit object anti2 flags&n\n"
  "   &+YI&+L.&n &+wEdit object type, values, and applies\n"
  "   &+YJ&+L.&n &+wEdit object material, weight, craftsmanship&n\n"
  "   &+YK&+L.&n &+wEdit object extra descs\n"
  "   &+YM&+L.&n &+wEdit object trap info\n");

    if (getObjAffectVal())
    {
    strcat(outStrn,
  "   &+YN&+L.&n &+wEdit object affect1 flags&n\n"
  "   &+YO&+L.&n &+wEdit object affect2 flags&n\n");
    strcat(outStrn,
  "   &+YP&+L.&n &+wEdit object affect3 flags&n\n"
  "   &+YQ&+L.&n &+wEdit object affect4 flags&n\n");
    }

    strcat(outStrn,
  "\n"
  "   &+YL&+L.&n &+wSet limit of loads for all objs of type&n\n"
  "   &+YV&+L.&n &+wChange object's vnum&n\n"
  "\n"
  MENU_COMMON
//  "\n"
  "\n");

    strcat(outStrn, getMenuPromptName());
  }

  displayColorString(outStrn);

  delete[] outStrn;
}
Пример #13
0
char interpEditObjTypeMenu(usint ch, dikuObject *obj, dikuObject *origObj,
                           char *addedIdentKeyword)
{
  struct rccoord coords;
  char strn[256], numbStrn[32], newName[256];
  stringNode *strnN;
  ulong i;


 // edit obj short name

  if (ch == 'A')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object short name: &n");

   // length - 1 - 1 because we gotta allow space for the tilde at the end

    getStrn(obj->objShortName, MAX_OBJSNAME_LEN - 1 - 1 - 1, 1, 7, '°',
            obj->objShortName, FALSE, FALSE);

    remTrailingSpaces(obj->objShortName);
    remLeadingSpaces(obj->objShortName);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj long name

  if (ch == 'B')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object long name: &n");

   // length - 1 - 1 because we gotta allow space for the tilde at the end

    getStrn(obj->objLongName, MAX_OBJLNAME_LEN - 1 - 1 - 1, 1, 7, '°',
            obj->objLongName, FALSE, FALSE);

    remTrailingSpaces(obj->objLongName);
    remLeadingSpaces(obj->objLongName);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj keywords

  if (ch == 'C')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString("&+CNew object keywords: &n");

    createKeywordString(obj->keywordListHead, strn);
    strn[strlen(strn) - 1] = '\0';  // get rid of tilde

    getStrn(strn, MAX_OBJKEY_LEN - 1, 1, 7, '°', strn, FALSE, FALSE);

    remTrailingSpaces(strn);
    remLeadingSpaces(strn);
    strcat(strn, "~");

    deleteStringNodes(obj->keywordListHead);
    obj->keywordListHead = createKeywordList(strn);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra flags

  if (ch == 'D')
  {
    editObjExtraFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra2 flags

  if (ch == 'E')
  {
    editObjExtra2Flags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj wear flags

  if (ch == 'F')
  {
    editObjWearFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj anti flags

  if (ch == 'G')
  {
    editObjAntiFlags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj anti2 flags

  if (ch == 'H')
  {
    editObjAnti2Flags(obj, origObj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj type, applies, values

  if (ch == 'I')
  {
    editObjMisc(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj weight, dam bonus, etc

  if (ch == 'J')
  {
    editObjMisc2(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj extra descs

  if (ch == 'K')
  {
    if (editObjExtraDesc(obj, addedIdentKeyword))
    {
     // user aborted, check for _id_ keyword and remove it

      if (*addedIdentKeyword)
      {
        strnN = obj->keywordListHead;
        while (strnN)
        {
          if (!strcmp(strnN->string, "_ID_"))
          {
            if (!strnN->Last) // head of list
            {
              obj->keywordListHead = obj->keywordListHead->Next;
              obj->keywordListHead->Last = NULL;

              delete strnN;
            }
            else
            {
              strnN->Last->Next = strnN->Next;
              strnN->Next->Last = strnN->Last;

              delete strnN;
            }
          }

          strnN = strnN->Next;
        }
      }
    }

    displayEditObjTypeMenu(obj);
  }
  else

 // edit obj trap info

  if (ch == 'M')
  {
    editObjTrapInfo(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // if allowed, edit aff1 flag

  if (getObjAffectVal() && (ch == 'N'))
  {
    editObjAffect1Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff2 flag

  if (getObjAffectVal() && (ch == 'O'))
  {
    editObjAffect2Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff3 flag

  if (getObjAffectVal() && (ch == 'P'))
  {
    editObjAffect3Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // ditto for aff4 flag

  if (getObjAffectVal() && (ch == 'Q'))
  {
    editObjAffect4Flags(obj);

    displayEditObjTypeMenu(obj);
  }
  else

 // change limit

  if (ch == 'L')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString(
"&+CNew limit on loads for this object type (0 = no limit): &n");

    itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10);
//    strn[0] = '\0';

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strnumer(strn))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);
    if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0))
    {
      _settextposition(coords.row, 1);
      clrline(coords.row, 7, 0);
      _setbkcolor(0);

      displayColorString(
"&+CError: Limit being set lower than or equal to the number loaded - press any key&n");

      getkey();

      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    setEntityOverride(ENTITY_OBJECT, obj->objNumber, i, obj->globalmaxload);
    obj->maxload = i;

    madeChanges = TRUE;

    displayEditObjTypeMenu(obj);
  }
  else
  if (ch == 'R')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    displayColorString(
"&+CNew MUD-wide limit on loads for this object type (0 = no limit): &n");

    itoa(getNumbEntities(ENTITY_OBJECT, obj->objNumber, TRUE), numbStrn, 10);
//    strn[0] = '\0';

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if (!strnumer(strn))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);
    if ((i <= getNumbEntities(ENTITY_OBJECT, obj->objNumber, FALSE)) && (i != 0))
    {
      _settextposition(coords.row, 1);
      clrline(coords.row, 7, 0);
      _setbkcolor(0);

      displayColorString(
"&+CError: Limit being set lower than or equal to the number loaded - press any key&n");

      getkey();

      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    setEntityOverride(ENTITY_OBJECT, obj->objNumber, obj->maxload, i);
    obj->globalmaxload = i;

    madeChanges = TRUE;

    displayEditObjTypeMenu(obj);
  }

  else

 // change vnum

  if ((ch == 'V') && !obj->defaultObj)
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);

    clrline(coords.row);
    sprintf(strn, "&+YNew object vnum (highest allowed %u): &n",
            numbLookupEntries - 1);
    displayColorString(strn);

    itoa(obj->objNumber, numbStrn, 10);

    getStrn(strn, 6, 1, 7, '°', numbStrn, FALSE, FALSE);

   // check user input

    if ((!strnumer(strn)) || (atoi(strn) >= numbLookupEntries) ||
        (findObj(atoi(strn))))
    {
      clrline(coords.row, 7, 0);
      _settextposition(coords.row, 1);
      _setbkcolor(0);

      displayColorString(getMenuPromptName());

      return FALSE;
    }

    i = atoi(strn);

    resetAllObjHere(obj->objNumber, i, roomHead);
    resetNumbLoaded(ENTITY_OBJECT, obj->objNumber, i);

    checkAndFixRefstoObj(obj->objNumber, i);

    objLookup[i] = origObj;
    objLookup[obj->objNumber] = NULL;

    obj->objNumber = i;

    resetEntityPointersByNumb(TRUE, FALSE);

    _settextposition(1, 1);

    clrline(1, 0, 0);
    fixObjName(obj->objShortName, newName);

    _setbkcolor(0);
    sprintf(strn, "&n&+gEditing object type #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
            obj->objNumber, newName);

    displayColorString(strn);

    clrline(coords.row, 7, 0);
    _settextposition(coords.row, 1);

    displayColorString(getMenuPromptName());
  }
  else

 // quit

  if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE;

  return FALSE;
}
Пример #14
0
char showdelparwin()
{   
	int				nWidth;
	int				i;
	char			ch;
	char			szResult = 'c';
	char			szdrv[40],szStrCheck[65];
	char			*str[] = {"[V]iew Partition","Delete [M]ethod" ,"[D]elete ","[C]ancel"};
	static point	ptvpar, ptoption,ptdelpardel,ptdelparcancel;
	_itemnode 		*pitemHD;
	char			*szMethod[] = {"00 overwrite","FF overwrite",
						"random data","NSA method",
						"Old NSA method","DoD STD method",
						"NATO method","Gutmann method"};
	             

	_setvisualpage(PAGE_DELPAR);  
	_setactivepage(PAGE_DELPAR);  
    
	ptvpar.row = 23;
	ptvpar.col = 5;

    drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);
    
	_settextposition(2, 4);          
	_outtext("Select the partition to be deleted");
	
	_settextposition(4, 5);          
	_outtext("PhysicalDisk:        Drive            Type   Size(MB)  Active    Pri/Log");
	
	_settextposition(12, 4);

	// 2004.08.03 huapage modify begin
	// _outtext("Selected partition");  
	_outtext("Partition information:");
	// 2004.08.03 huapage modify end
	//Add&Init Disk select window
	g_pDelParDiskWin = new cwindow(PAGE_DELPAR, 5, 4, 11, 20);

	for(i = 0; i < g_nDiskNum; i++)   // no A: B:
	{            
		sprintf(szdrv, DRIVEFORMAT, i + 1);
		g_pDelParDiskWin->additemNotSort(szdrv,i); 
	}
	g_pDelParDiskWin->enabledscroll();    
	if(!g_delparinfo.nseldisk)
		g_delparinfo.nseldisk = g_pDelParDiskWin->m_pitemactive->btItem+DISKBASE;    
	SetDelParDiskSel(g_delparinfo.nseldisk-DISKBASE);
    
    //Add&Init Partition select window
	g_pDelParPartWin = new cwindow(PAGE_DELPAR, 5, 22, 11, 78);
	writedriveletter(g_pDelParDiskWin, g_pDelParPartWin);
	
	//Add show selected partition information window
	g_pDelParSelWin = new cwindow(PAGE_DELPAR, 13, 4, 18, 78);
	
	//show delete method
	sprintf(szdrv,"Delete partition with %s",szMethod[g_nMethod]);
	_settextposition(19, 4);
	_outtext(szdrv);  
	
	// Add function box
	nWidth = strlen(str[0]);	                                 
	_settextposition(ptvpar.row, ptvpar.col);
	_outtext(str[0]);  
	drawbox(ptvpar.row - 1, ptvpar.col - 1, ptvpar.row + 1, ptvpar.col + nWidth);

	ptoption.row = ptvpar.row;
	ptoption.col = ptvpar.col + nWidth + 2;
	nWidth = strlen(str[1]);
	_settextposition(ptoption.row, ptoption.col);
	_outtext(str[1]);  
	drawbox(ptoption.row - 1, ptoption.col - 1, ptoption.row + 1, ptoption.col + nWidth);

	nWidth = strlen(str[3]);
	ptdelparcancel.row = ptvpar.row;
	ptdelparcancel.col = g_SysInfo.nmaxcols - 2 - nWidth;	           
	_settextposition(ptdelparcancel.row, ptdelparcancel.col);
	_outtext(str[3]);  
	drawbox(ptdelparcancel.row - 1, ptdelparcancel.col - 1, ptdelparcancel.row + 1, ptdelparcancel.col + nWidth);

	nWidth = strlen(str[2]);
	ptdelpardel.row = ptdelparcancel.row;
	ptdelpardel.col = ptdelparcancel.col - 2 -nWidth;	           
	_settextposition(ptdelpardel.row, ptdelpardel.col);
	_outtext(str[2]);  
	drawbox(ptdelpardel.row - 1, ptdelpardel.col - 1, ptdelpardel.row + 1, ptdelpardel.col + nWidth);
	
	SetDelParSelDisk();
	
	showtarparinfo();

	winproc(g_pDelParPartWin, WM_INACTIVE);
	switch(g_delparinfo.nselect)
	{
	case 0:
		winproc(g_pDelParDiskWin, WM_ACTIVE);
		break;
	case 1:
		winproc(g_pDelParPartWin, WM_ACTIVE);
		break;
	case 2:
		selectstr(str[0], ptvpar.row, ptvpar.col, SELCOLOR);
		break;
	case 3:
		selectstr(str[1], ptoption.row, ptoption.col, SELCOLOR);
		break;
	case 4:
		selectstr(str[2], ptdelpardel.row, ptdelpardel.col, SELCOLOR);
		break;
	case 5:
		selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, SELCOLOR);
		break;
	}
	while(1)
	{                                               
	  	ch = _getch();
		switch(ch)
		{
		case 'm':
		case 'M':
			_clearscreen(_GCLEARSCREEN); 
			DeleteDelParWin();
		    return 'm';
		case 'v':
		case 'V':
			// if(g_delparinfo.nselpar == -1)
			if( SEL_PAR_INIT_VALUE == g_delparinfo.nselpar )
			{
				ErrorMessageBox(NO_SELPAR);
				break;
			}
			_clearscreen(_GCLEARSCREEN); 
			DeleteDelParWin();
			return 'v';
		case 'd':
		case 'D':
			// 2004.08.03 huapage modify begin
			// if(g_delparinfo.nselpar == -1)
			if( SEL_PAR_INIT_VALUE == g_delparinfo.nselpar)
			// 2004.08.03 huapage modify end
			{
				ErrorMessageBox(NO_SELPAR);
				break;
			}
			_clearscreen(_GCLEARSCREEN); 
			DeleteDelParWin();
		    return 'd';
		case 'C':
		case 'c':
		case ESC :
			_clearscreen(_GCLEARSCREEN); 
			DeleteDelParWin();
			return 'c';
		case SPACE :

			if( 1 == g_delparinfo.nselect) // if the tab stop is in the proper window
			{
				pitemHD = g_pDelParPartWin->m_pitemhead;
				while(pitemHD!=NULL)
				{
				    if(pitemHD->szitemtext[SELPOINT] == SELFLAG)//no selected
					{
					    pitemHD->szitemtext[SELPOINT] = ' ';     	
					}
					pitemHD = pitemHD->pnext;
				}
				i=1;
				while(i<6)
				{  
					g_pDelParPartWin->gettext(szStrCheck,i);
					szStrCheck[0]=0x20;
					if(szStrCheck[2]=='X')		
					{
						writestr(PAGE_DELPAR, 5 + i, 23 + SELPOINT, " "); 
					}
					i++;
				}

				if( g_delparinfo.nselpar !=  ( g_pDelParPartWin->m_pitemactive->btItem -1) )
				{
					g_pDelParPartWin->m_pitemactive->szitemtext[SELPOINT] = SELFLAG; 
					writestr(PAGE_DELPAR, 5 + g_pDelParPartWin->m_nactiverow, 23 + SELPOINT, SELFLAG_STRING); 
				
					// 2004.08.02 huapage added begin
					// now we add select all, so nselpar should minus one
					g_delparinfo.nselpar = g_pDelParPartWin->m_pitemactive->btItem - 1;
					// 2004.08.02 huapage added end
				}
				else //already selected
				{
					// 2004.08.03 huapage comment begin
					// g_delparinfo.nselpar  =-1;  
					// 2004.08.03 huapage comment end
					
					g_delparinfo.nselpar = SEL_PAR_INIT_VALUE;

				}
				showtarparinfo();
			}
			else
			{
				// do nothing if the focus is not 
				// in the proper window and
				// user press space
			}

			break;
		case 0:
			switch(ch = _getch())
			{
			case SHIFT_TAB:
				switch(g_delparinfo.nselect)
				{
				case 0:
					g_delparinfo.nselect = 5;  
					selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, SELCOLOR);
					winproc(g_pDelParDiskWin, WM_INACTIVE);
					break;
				case 1:
					g_delparinfo.nselect = 0;
					winproc(g_pDelParDiskWin, WM_ACTIVE);
					winproc(g_pDelParPartWin, WM_INACTIVE);                                        
					break;
				case 2:
					g_delparinfo.nselect = 1;
					selectstr(str[0], ptvpar.row, ptvpar.col, TEXTCOLOR);
					winproc(g_pDelParPartWin, WM_ACTIVE);                                        
					//showtarparinfo();
					break;
				case 3:
					g_delparinfo.nselect = 2;
					selectstr(str[0], ptvpar.row, ptvpar.col, SELCOLOR); 
					selectstr(str[1], ptoption.row, ptoption.col, TEXTCOLOR);
					break;
				case 4:
					g_delparinfo.nselect = 3;
					selectstr(str[1], ptoption.row, ptoption.col, SELCOLOR);
					selectstr(str[2], ptdelpardel.row, ptdelpardel.col, TEXTCOLOR);
					break;
				case 5:
					g_delparinfo.nselect = 4;
					selectstr(str[2], ptdelpardel.row, ptdelpardel.col, SELCOLOR);
					selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, TEXTCOLOR);
					break;
				}
				break;
			case PAGEDOWN:
			case PAGEUP:
			case CTRL_END:
			case CTRL_HOME:  
			case UP:
			case DOWN:
				if(g_delparinfo.nselect == 0)
				{
					g_pDelParDiskWin->m_pitemactive->szitemtext[1] = ' ';
					writestr(PAGE_DELPAR, 5+g_pDelParDiskWin->m_nactiverow , 6, " ");
					winproc(g_pDelParDiskWin, WM_KEY, ch);
					g_pDelParDiskWin->m_pitemactive->szitemtext[1] = '*';
					writestr(PAGE_DELPAR, 5+g_pDelParDiskWin->m_nactiverow , 6, "*");
					g_delparinfo.nseldisk = g_pDelParDiskWin->m_pitemactive->btItem+DISKBASE;

					writedriveletter(g_pDelParDiskWin, g_pDelParPartWin);
					
					// 2004.08.03 huapage modify begin
					// g_delparinfo.nselpar = -1;
					g_delparinfo.nselpar = SEL_PAR_INIT_VALUE;
					// 2004.08.03 huapage modify end
					
					showtarparinfo();
				}
				if(g_delparinfo.nselect == 1)
				{
					winproc(g_pDelParPartWin, WM_KEY, ch);
					//showtarparinfo();
				}
				break;
			}
			break;
		case TAB:
			switch(g_delparinfo.nselect)
			{
			case 0:
				g_delparinfo.nselect = 1;  
				winproc(g_pDelParDiskWin, WM_INACTIVE);
				winproc(g_pDelParPartWin, WM_ACTIVE);                                        
				//showtarparinfo();
				break;
			case 1:
				g_delparinfo.nselect = 2;
				selectstr(str[0], ptvpar.row, ptvpar.col, SELCOLOR);
				winproc(g_pDelParPartWin, WM_INACTIVE);                                        
				break;
			case 2:
				g_delparinfo.nselect = 3;
				selectstr(str[0], ptvpar.row, ptvpar.col, TEXTCOLOR); 
				selectstr(str[1], ptoption.row, ptoption.col, SELCOLOR);
				break;
			case 3:
				g_delparinfo.nselect = 4;
				selectstr(str[1], ptoption.row, ptoption.col, TEXTCOLOR);
				selectstr(str[2], ptdelpardel.row, ptdelpardel.col, SELCOLOR);
				break;
			case 4:
				g_delparinfo.nselect = 5;
				selectstr(str[2], ptdelpardel.row, ptdelpardel.col, TEXTCOLOR);
				selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, SELCOLOR);
				break;
			case 5:
				g_delparinfo.nselect = 0;
				selectstr(str[3], ptdelparcancel.row, ptdelparcancel.col, TEXTCOLOR);
				winproc(g_pDelParDiskWin, WM_ACTIVE);
				break;
			}
			break;
		case CR:
			switch(g_delparinfo.nselect)
			{
			case 2:
				// if(g_delparinfo.nselpar == -1)
				if(SEL_PAR_INIT_VALUE == g_delparinfo.nselpar)
				{
					ErrorMessageBox(NO_SELPAR);
					break;
				}
				_clearscreen(_GCLEARSCREEN); 
				DeleteDelParWin();
				return 'v';
			case 3:
				_clearscreen(_GCLEARSCREEN); 
				DeleteDelParWin();
			    return 'm';
			case 4:
				// 2004.08.03 huapage modify begin
				// if(g_delparinfo.nselpar == -1)
				if(SEL_PAR_INIT_VALUE == g_delparinfo.nselpar)
				// 2004.08.03 huapage modify end
				{
					ErrorMessageBox(NO_SELPAR);
					break;
				}
				_clearscreen(_GCLEARSCREEN); 
				DeleteDelParWin();
				return 'd';
			case 5:
				_clearscreen(_GCLEARSCREEN); 
				DeleteDelParWin();
				return 'c';
			}
		default:break;
		}
	}
}
Пример #15
0
void Terrain()
{
    // Allocate the offscreen bitmap
    offMap = CreateBitmap(256, 200);
    if (!offMap) return;

    // Allocate the surface maps
    if (!ISurface()) return;

	// Build tables
	BuildProjectionTable();
                
    // Attempt to randomize
    gSeed = time(NULL) + clock();
        
    // Generate the fractal surface
    Fractify(0, 0, 256, 256);
	Smoothify();
	
    // Build obelisk
    for (int j=-3; j<4; j++)
    	for (int i=-3; i<4; i++)
        	Point(128+i, 128+j) = 240;
        
    // Generate the palette
    BuildPalette();
    // Colorize the surface (w/ sealevel  parameter)
    Colorize(80);

    // Initialize values
	int elev = 10 << (YFIX+FIX);
    gX = gY = gZ = 0;
   	gY = HeightAt(gX, gZ) + elev;

    // Do some display
    int  mx, my;
    char q = 0, clr=0;
    int  c, f = 0;
    char msg[80];
	
    clock_t clk = clock();
    while (!q)
    {
		// Count the frame
        f++;

        //------------Refresh the display-------------
        // Clear the offmap
        ClearScreen(254, 256, 200, offMap);
        // Draw the surface
		Caster();
        // Copy the offmap to the screen                
        Display(offMap, 256, 200);

        //------------Handle user input-------------
        MouseMove(&mx, &my);
        if (mx || my)
        {
            gZ -= my;
            gZ = gZ & 4095;
                        
            gX += mx;
            gX = gX & 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }
        else if (kbhit())
        {
            c = getch();
            switch (c)
            {
                case 0:
                	c = getch();
                    switch (c)
                    {
                        case UP_ARROW_KEY:
                                gZ += 1;
                                break;

                        case DN_ARROW_KEY:
                                gZ -= 1;
                                break;
                                        
                        case LF_ARROW_KEY:
                                gX -= 1;
                                break;

                        case RT_ARROW_KEY:
                                gX += 1;
                            break;
                    }   
                    break;
                                
                case 'w':
                	elev += 8;
                	break;

                case 'x':
                	elev -= 8;
                	 break;

                case ESC_KEY:
                	q = 1;
               		break;
            }

            gZ &= 4095;
            gX &= 4095;
        	gY = HeightAt(gX, gZ) + elev;
        }                                   
    }
    clk = clock() - clk;
    
    _settextposition(1, 2);
    _settextcolor(255);
    sprintf(msg, "Frames: %ld,  Time: %5.2fs,  FPS: %5.2f\n", f, clk/(float)CLOCKS_PER_SEC, f * (float)CLOCKS_PER_SEC / clk);
    _outtext(msg);
}
char TW_Open_Window (char x,char y,char br,char ho,char rahmen,
		     char titelart,char ofs,char *titel)
{
   unsigned char _far *adr;
   char ret=0,z,zw,
	rstr[11];

   /* TM_Prot(); */
   _settextwindow(1,1,25,80);
   adr=SaveWindow((char)(x-1),(char)(y-1),(char)(br+2),(char)(ho+2));
   if (adr!=NULL)
     {
       TW_anz_fenster++;
       ret=1;
       fenster[TW_anz_fenster].x=x;
       fenster[TW_anz_fenster].y=y;
       fenster[TW_anz_fenster].ho=ho;
       fenster[TW_anz_fenster].br=br;
       fenster[TW_anz_fenster].adr=adr;

       switch(rahmen)
	 {
	   case  TW_RAHMEN_S1:strcpy(rstr,"дЁз©ыю╢цаб");
			      break;
	   case  TW_RAHMEN_D1:strcpy(rstr,"м╨и╩╪х╣фпр");
			      break;
	   case  TW_RAHMEN_D2:strcpy(rstr,"мЁу╦╬т╢цаб");
			      break;
	   default:strcpy(rstr,"          ");
	 }

       _settextposition(y-1,x-1);
       printchar(rstr[2]);
       _settextposition(y-1,x+br);
       printchar(rstr[3]);
       _settextposition(y+ho,x+br);
       printchar(rstr[4]);
       _settextposition(y+ho,x-1);
       printchar(rstr[5]);
       for (z=x;z<x+br;z++)
	 {
	    _settextposition(y-1,z);
	    printchar(rstr[0]);
	    _settextposition(y+ho,z);
	    printchar(rstr[0]);
	 }
       for (z=y;z<y+ho;z++)
	 {
	    _settextposition(z,x-1);
	    printchar(rstr[1]);
	    for (zw=1;zw<=br;zw++)
		_outtext(" ");
	    printchar(rstr[1]);
	 }

       /* Titel setzten */
	if (strcmp(titel,""))
	{
	  switch (titelart)
	    {
	      case TW_TITEL_OBEN:
		   {
		     _settextposition(y-1,x+ofs);
		     printchar(rstr[6]);
		     _outtext(titel);
		     printchar(rstr[7]);
		   }
		   break;
	      case TW_TITEL_UNTEN:
		   {
		     _settextposition(y+ho,x+ofs);
		     printchar(rstr[6]);
		     _outtext(titel);
		     printchar(rstr[7]);
		   }
		   break;
	      case TW_TITEL_RECHTS:
		   {
		     _settextposition(y+ofs,x-1);
		     printchar(rstr[8]);
		     for (z=1;(size_t)z<strlen(titel);z++)
			{
			  _settextposition(y+ofs+z,x-1);
			  printchar(titel[z]);
			}
		     _settextposition(y+ofs+z,x-1);
		     printchar(rstr[9]);
		   }
		   break;
	      case TW_TITEL_LINKS:
		   {
		     _settextposition(y+ofs,x+br);
		     printchar(rstr[8]);
		     for (z=1;(size_t)z<strlen(titel);z++)
			{
			  _settextposition(y+ofs+z,x+br);
			  printchar(titel[z]);
			}
		     _settextposition(y+ofs+z,x+br);
		     printchar(rstr[9]);
		   }
		   break;
	    }  /*von SWITCH */
	}   /*von IF*/

       _settextwindow((short)y,
		       (short)x,
		       (short)(y+ho-1),
		       (short)(x+br-1));
     }

   /* TM_Prot(); */
   return(ret);
 }
Пример #17
0
void displayEditObjMiscMenu(const dikuObject *obj)
{
  char strn[256], newName[256], *outStrn = new char[2048],
       vstrn1[256], vstrn2[256], vstrn3[256], vstrn4[256],
       vstrn5[256], vstrn6[256], vstrn7[256], vstrn8[256],
       v2strn1[256], v2strn2[256], v2strn3[256], v2strn4[256],
       v2strn5[256], v2strn6[256], v2strn7[256], v2strn8[256];


  _clearscreen(7, 0);

  if (!outStrn)
  {
    _outtext("\n\nError allocating outStrn in displayblah()...\n\n");

    return;
  }

  _settextposition(1, 1);
  _settextcolor(7);
  _setbkcolor(0);

  fixObjName(obj->objShortName, newName);

  sprintf(strn, "&+gEditing miscellany for obj #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
          obj->objNumber, newName);

  displayColorString(strn);

  sprintf(outStrn,
"   &+YA&+L.&n &+wObject type                       %u (%s)&n\n"
"\n"
"   &+YB&+L.&n &+wObject value #1                   %d (%s)&n\n"
"   &+YC&+L.&n &+wObject value #2                   %d (%s)&n\n"
"   &+YD&+L.&n &+wObject value #3                   %d (%s)&n\n"
"   &+YE&+L.&n &+wObject value #4                   %d (%s)&n\n"
"   &+YF&+L.&n &+wObject value #5                   %d (%s)&n\n"
"   &+YG&+L.&n &+wObject value #6                   %d (%s)&n\n"
"   &+YH&+L.&n &+wObject value #7                   %d (%s)&n\n"
"   &+YI&+L.&n &+wObject value #8                   %d (%s)&n\n"
"\n"
"   &+YJ&+L.&n &+wObject apply #1 - what            %u (%s)&n\n"
"   &+YK&+L.&n &+wObject apply #1 - value           %d&n\n"
"\n"
"   &+YL&+L.&n &+wObject apply #2 - what            %u (%s)&n\n"
"   &+YM&+L.&n &+wObject apply #2 - value           %d&n\n"
"\n"
MENU_COMMON
"\n"
"%s",
                   obj->objType, getObjTypeStrn(obj->objType),

                   obj->objValues[0],
                    getObjValueStrn(obj->objType, 0, obj->objValues[0],
                                    vstrn1, v2strn1, TRUE, obj),
                   obj->objValues[1],
                    getObjValueStrn(obj->objType, 1, obj->objValues[1],
                                    vstrn2, v2strn2, TRUE, obj),
                   obj->objValues[2],
                    getObjValueStrn(obj->objType, 2, obj->objValues[2],
                                    vstrn3, v2strn3, TRUE, obj),
                   obj->objValues[3],
                    getObjValueStrn(obj->objType, 3, obj->objValues[3],
                                    vstrn4, v2strn4, TRUE, obj),
                   obj->objValues[4],
                    getObjValueStrn(obj->objType, 4, obj->objValues[4],
                                    vstrn5, v2strn5, TRUE, obj),
                   obj->objValues[5],
                    getObjValueStrn(obj->objType, 5, obj->objValues[5],
                                    vstrn6, v2strn6, TRUE, obj),
                   obj->objValues[6],
                    getObjValueStrn(obj->objType, 6, obj->objValues[6],
                                    vstrn7, v2strn7, TRUE, obj),
                   obj->objValues[7],
                    getObjValueStrn(obj->objType, 7, obj->objValues[7],
                                    vstrn8, v2strn8, TRUE, obj),

                   obj->objApply[0].applyWhere,
                    getObjApplyStrn(obj->objApply[0].applyWhere),
                   obj->objApply[0].applyModifier,

                   obj->objApply[1].applyWhere,
                    getObjApplyStrn(obj->objApply[1].applyWhere),
                   obj->objApply[1].applyModifier,

                   getMenuPromptName());

  displayColorString(outStrn);

  delete[] outStrn;
}
char Execute_G(char *ok,char *esc)
{
  char endprg=0,
       zw_buf1,buf[20];

  int  g_wert,
       xi_wert,
       zk_wert,
       flkt_wert,
       h_wert,
       taste;

  short P1x,P1z,P2x,P2z, steigung,
	step,Xpos,Zpos,za;
  struct dostime_t time;


  Status("Simulation");
  Meldung("Bearbeite G-Befehl.");

  /* eventuell test ob nicht G00 -> dann darf g_wert nicht 0 sein -> Err */

  /* Werte feststellen */

  g_wert=atoi(cncprg[ip].GM);

  strcpy(buf,cncprg[ip].XI);
  ElimSpaces(buf);
  ElimSpaces(buf);
  if (isdigit((int)buf[0]) || buf[0]=='-')
     xi_wert=atoi(buf);
    else xi_wert=atoi(buf+1);

  strcpy(buf,cncprg[ip].ZK);
  ElimSpaces(buf);
  ElimSpaces(buf);
  if (isdigit((int)buf[0]) || buf[0]=='-')
     zk_wert=atoi(buf);
    else zk_wert=atoi(buf+1);

  strcpy(buf,cncprg[ip].FLKT);
  ElimSpaces(buf);
  ElimSpaces(buf);
  if (isdigit((int)buf[0]) || buf[0]=='-')
     flkt_wert=atoi(buf);
    else flkt_wert=atoi(buf+1);

  h_wert=atoi(cncprg[ip].H);

  /* G-Befehle verzweigen */
  switch(g_wert)
  {
     /**************** G00 *******************/
     case 00:if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		if (inkrementell)
		   { /* G00 INCR */
		     endprg=Ziehe_Gerade(xrad,zpos,xrad+xi_wert,zpos+zk_wert,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
		     if (endprg) { *ok=1; *esc=1; }
		     xrad=xrad+xi_wert;
		     zpos=zpos+zk_wert;
		   } else
		   { /* G00 ABS */
		     endprg=Ziehe_Gerade(xrad,zpos,(short)(xi_wert/2)+xcorr,zk_wert+zcorr,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
		     if (endprg) { *ok=1; *esc=1; }
		     xrad=(short)(xi_wert/2)+xcorr;
		     zpos=zk_wert+zcorr;
		   }
	      }
	       else { *ok=0; endprg=1; }
	     break;
     /**************** G01 *******************/
     case 01:if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		if (inkrementell)
		   { /* G01 INCR */
		     endprg=Ziehe_Gerade(xrad,zpos,xrad+xi_wert,zpos+zk_wert,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
		     if (endprg) { *ok=1; *esc=1; }
		     xrad=xrad+xi_wert;
		     zpos=zpos+zk_wert;
		   } else
		   { /* G01 ABS */
		     endprg=Ziehe_Gerade(xrad,zpos,(short)(xi_wert/2)+xcorr,zk_wert+zcorr,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
		     if (endprg) { *ok=1; *esc=1; }
		     xrad=(short)(xi_wert/2)+xcorr;
		     zpos=zk_wert+zcorr;
		   }
	      }
	      else { *ok=0; endprg=1; }
	     break;
     /**************** G02 *******************/
     case 02:if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		/* test ob == | != 90 */
		if (!strcmp(cncprg[ip+1].GM,"M99 "))
		    {
		      /* Mittelpunkt bestimmen */
		      Xpos=atoi(cncprg[ip+1].XI+1);
		      Zpos=atoi(cncprg[ip+1].ZK+1);
		      if (cncprg[ip+1].ZK[0]!='K' || cncprg[ip+1].XI[0]!='I')
			{
			  Meldung("Error in M99-Anweisung!"); Status("Fehler");
			  getch();
			  endprg=1; *ok=0;
			} else
			{
			  /* Kreisbogen(X1,Z1,X2,Z2,XM,ZM,1=G03 0=G02 */
			  if (inkrementell)
			    {
			      endprg=Ziehe_KreisNO90(xrad,zpos,xrad+xi_wert,zpos+zk_wert,xrad+Xpos,zpos+Zpos,0);
			      /*xrad=xrad+xi_wert;
			      zpos=zk_wert;*/
			    }
			    else {
				   endprg=Ziehe_KreisNO90(xrad,zpos,(short)(xi_wert/2),zk_wert,xrad+Xpos,zpos+Zpos,0);
				   /*xrad=(short)(xi_wert/2);
				   zpos=zk_wert;*/
				 }
			  ip++;
			}
		    }
		 else
		 {
		   /* kreisbogen a=90� */
		   if (inkrementell)
		     { /* G02 INC */
		       endprg=Ziehe_Kreis02(xrad,zpos,xrad+xi_wert,zpos+zk_wert,
							     prgconfig.wait_g01);
		       if (endprg) { *ok=1; *esc=1; }
		       xrad=xrad+xi_wert;
		       zpos=zpos+zk_wert;

		     } else
		     { /* G02 ABS */
		       endprg=Ziehe_Kreis02(xrad,zpos,(short)(xi_wert/2)+xcorr,zk_wert+zcorr,prgconfig.wait_g01);
		       if (endprg) { *ok=1; *esc=1; }
		       xrad=(short)(xi_wert/2)+xcorr;
		       zpos=zk_wert+zcorr;
		     }
		  } /* von if ==/!=90 */
	      } else { *ok=0; endprg=1; } /*von if !I & !K */
	     break;
     /**************** G03 *******************/
     case 03:if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		/* test ob == | != 90 */
		if (!strcmp(cncprg[ip+1].GM,"M99 "))
		    {
		      /* Mittelpunkt bestimmen */
		      Xpos=atoi(cncprg[ip+1].XI+1);
		      Zpos=atoi(cncprg[ip+1].ZK+1);
		      if (cncprg[ip+1].ZK[0]!='K' || cncprg[ip+1].XI[0]!='I')
			{
			  Meldung("Error in M99-Anweisung!"); Status("Fehler");
			  getch();
			  endprg=1; *ok=0;
			} else
			{
			  /* Kreisbogen(X1,Z1,X2,Z2,XM,ZM,1=G03 0=G02 */
			  if (inkrementell)
			    endprg=Ziehe_KreisNO90(xrad,zpos,xrad+xi_wert,zpos+zk_wert,xrad+Xpos,zpos+Zpos,1);
			    else endprg=Ziehe_KreisNO90(xrad,zpos,(short)(xi_wert/2),zk_wert,xrad+Xpos,zpos+Zpos,1);
			  ip++;
			}
		    }
		 else
		 {
		   /* kreisbogen a=90� */
		   if (inkrementell)
		     { /* G03 INC */
		       endprg=Ziehe_Kreis03(xrad,zpos,xrad+xi_wert,zpos+zk_wert,
							     prgconfig.wait_g01);
		       if (endprg) { *ok=1; *esc=1; }
		       xrad=xrad+xi_wert;
		       zpos=zpos+zk_wert;

		     } else
		     { /* G03 ABS */
		       endprg=Ziehe_Kreis03(xrad,zpos,(short)(xi_wert/2)+xcorr,zk_wert+zcorr,prgconfig.wait_g01);
		       if (endprg) { *ok=1; *esc=1; }
		       xrad=(short)(xi_wert/2)+xcorr;
		       zpos=zk_wert+zcorr;
		     } /* von inkr | abs */
		 } /* von if a==90 */

	      } else { *ok=0; endprg=1; } /*von if !I & !K */
	     break;
     /**************** G04 *******************/
     case 4 :/* Verweilzeit */
	     if (cncprg[ip].XI[0]!='I')
	      {
		 za=0;
		 step=0;
		 do {
		      _dos_gettime(&time);
		      if (kbhit()) taste=getch();
		      if ((short)time.second!=za) { za=(short)time.second; step++; }
		    } while (step<(short)(xi_wert/100) && taste!=27);
	      }
	      break;
     /**************** G21 *******************/
     case 21:break; /* rem */
     /**************** G25 *******************/
     case 25: /* Unterprgr */
	     if (cncprg[ip].FLKT[0]=='L' && flkt_wert<max_line && sp<4)
	     {
	       stack[sp++]=ip;
	       ip=--flkt_wert;
	     } else
	     {
		Status("Error!");
		Meldung("Fehler im GOSUB-G27-Befehl!");
		*ok=0; endprg=1;
	     }break;
     /**************** G26 *******************/
     case 26: /* werkzeugwechsel */
	     if (cncprg[ip].FLKT[0]=='T' && flkt_wert>0 && flkt_wert<=max_tools)
	     {
	       _settextposition(3,37);
	       _outtext(cncprg[ip].FLKT);
	       _outtext("        ");

	       Setzte_Stahl(xrad,zpos,(char)flkt_wert);
	       endprg=Ziehe_Gerade(xrad,zpos,xrad+xi_wert,zpos+zk_wert,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
	       xrad=xrad+xi_wert;
	       zpos=zpos+zk_wert;
	       xcorr=xi_wert;	    /* Korrekturwerte des Stahles muessen */
	       zcorr=zk_wert;	    /* in Abs. mit einberechnet werden	  */
	     } else { *ok=0; endprg=1; }
	     break;
     /**************** G27 *******************/
     case 27: /* goto */
	     if (cncprg[ip].FLKT[0]=='L' && flkt_wert<max_line)
		ip=--flkt_wert;
		else { *ok=0; endprg=1; }
	     break;
     /**************** G33 *******************/
     case 33: /* gewinde schneiden */
	     if (cncprg[ip].FLKT[0]=='K' && flkt_wert>=2 && flkt_wert<500)
	      {
		steigung=flkt_wert;
		if (inkrementell)
		   { /* INCR */
		     endprg=Gewinde(xrad,zpos,zpos+zk_wert,steigung,prgconfig.wait_g01+10000);
		     if (endprg) { *ok=1; *esc=1; }
		     zpos=zpos+zk_wert;
		   } else
		   { /* ABS */
		     endprg=Gewinde(xrad,zpos,zcorr+zk_wert,steigung,prgconfig.wait_g01+10000);
		     if (endprg) { *ok=1; *esc=1; }
		     zpos=zk_wert+zcorr;
		   }
	      }
	      else { *ok=0; endprg=1; }
	      break;
     /**************** G78 *******************/
     case 78: /* Gewindezyklus */
	     if (cncprg[ip].FLKT[0]=='K' && flkt_wert>=2 && flkt_wert<500)
	      {
		/* Start & Zielkoord */
		P1x=xrad; P1z=zpos;
		if (inkrementell)
		    {
		      P2x=xrad+xi_wert;
		      P2z=zpos+zk_wert;
		    } else {
			     P2x=(short)(xi_wert/2)+xcorr;
			     P2z=zk_wert+zcorr;
			   }
		/* Schritt & Steigung */
		step=h_wert;
		steigung=flkt_wert;

		/* Anfahren */
		if (step!=0)
		 if (P1x>P2x)
		    for (Xpos=P1x;Xpos-step>P2x && !endprg;Xpos-=step)
			{
			  endprg=Ziehe_Gerade(P1x,P1z,Xpos-step,P1z,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Gewinde(Xpos-step,P1z,P2z,steigung,prgconfig.wait_g01+10000);
			  if (!endprg)
			    endprg=Ziehe_Gerade(xrad,zpos,P1x,P2z,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P1x,P2z,P1x,P1z,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			}
		  else for (Xpos=P1x;Xpos+step<P2x && !endprg;Xpos+=step)
			{
			  endprg=Ziehe_Gerade(P1x,P1z,Xpos+step,P1z,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Gewinde(Xpos+step,P1z,P2z,steigung,prgconfig.wait_g01+10000);
			  if (!endprg)
			    endprg=Ziehe_Gerade(xrad,zpos,P1x,P2z,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P1x,P2z,P1x,P1z,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			 }

		/* letzter Schritt oder Schritt ohne Aufteilung*/
		if (!endprg)
		  endprg=Ziehe_Gerade(P1x,P1z,P2x,P1z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		   endprg=Gewinde(P2x,P1z,P2z,steigung,prgconfig.wait_g01+20000);
		if (!endprg)
		  endprg=Ziehe_Gerade(xrad,zpos,P1x,P2z,
			 prgconfig.wait_g01+4000,schritt_g00,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P1x,P2z,P1x,P1z,
			 prgconfig.wait_g00,schritt_g00,checkTasten);

		if (endprg) { *ok=1; *esc=1; }
		xrad=P1x;
		zpos=P1z;
	      } break;
     /**************** G84 *******************/
     case 84: /* laengsdrehzyklus */
	      if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		/* Start & Zielkoord */
		P1x=xrad; P1z=zpos;
		if (inkrementell)
		    {
		      P2x=xrad+xi_wert;
		      P2z=zpos+zk_wert;
		    } else {
			     P2x=(short)(xi_wert/2)+xcorr;
			     P2z=zk_wert+zcorr;
			   }
		/* Schritt */
		step=h_wert;

		/* Anfahren */
		if (step!=0)
		 if (P1x>P2x)
		    for (Xpos=P1x;Xpos-step>P2x && !endprg;Xpos-=step)
			{
			  endprg=Ziehe_Gerade(Xpos,P1z,Xpos-step,P1z,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(Xpos-step,P1z,Xpos-step,P2z,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(Xpos-step,P2z,Xpos-step,P1z,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			}
		  else for (Xpos=P1x;Xpos+step<P2x && !endprg;Xpos+=step)
			 {
			   endprg=Ziehe_Gerade(Xpos,P1z,Xpos+step,P1z,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			   if (!endprg)
			    endprg=Ziehe_Gerade(Xpos+step,P1z,Xpos+step,P2z,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			   if (!endprg)
			    endprg=Ziehe_Gerade(Xpos+step,P2z,Xpos+step,P1z,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			 }
		  else Xpos=P1x; /* von if step!=0 */

		/* letzter Schritt */
		if (!endprg)
		  endprg=Ziehe_Gerade(Xpos,P1z,P2x,P1z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P2x,P1z,P2x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P2x,P2z,P1x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P1x,P2z,P1x,P1z,
			 prgconfig.wait_g00,schritt_g00,checkTasten);

		if (endprg) { *ok=1; *esc=1; }
		xrad=P1x;
		zpos=P1z;
	      } break;
     /**************** G86 *******************/
     case 86: /* Austechzyklus */
	      if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		/* Start & Zielkoord */
		P1x=xrad; P1z=zpos;
		if (inkrementell)
		    {
		      P2x=xrad+xi_wert;
		      P2z=zpos+zk_wert;
		    } else {
			     P2x=(short)(xi_wert/2)+xcorr;
			     P2z=zk_wert+zcorr;
			   }
		/* Schritt */
		step=h_wert;
		za=abs(P1z-P2z);
		if (za<step || step<10 || step>999)
		  *ok=0;
		  else
		  {
		    /* Anfahren */
		    if (P1z>P2z)
		      for (Zpos=P1z;Zpos>P2z && !endprg;Zpos-=step)
			{
			  endprg=Ziehe_Gerade(P1x,Zpos,P2x,Zpos,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P2x,Zpos,P1x,Zpos,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P1x,Zpos,P1x,Zpos-step,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			}
		     else for (Zpos=P1z;Zpos<P2z && !endprg;Zpos+=step)
			{
			  endprg=Ziehe_Gerade(P1x,Zpos,P2x,Zpos,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P2x,Zpos,P1x,Zpos,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P1x,Zpos,P1x,Zpos+step,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			}
		    /* letzter Schritt */
		    if (!endprg)
		      endprg=Ziehe_Gerade(P1x,Zpos,P1x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		    if (!endprg)
		      endprg=Ziehe_Gerade(P1x,P2z,P2x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		    if (!endprg)
		      endprg=Ziehe_Gerade(P2x,P2z,P1x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		    if (!endprg)
		      endprg=Ziehe_Gerade(P1x,P2z,P1x,P1z,
			 prgconfig.wait_g00,schritt_g00,checkTasten);

		    if (endprg) { *ok=1; *esc=1; }
		  }

		xrad=P1x;
		zpos=P1z;
	      }break;
     /**************** G88 *******************/
     case 88: /* plandrehzyklus */
	      if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		/* Start & Zielkoord */
		P1x=xrad; P1z=zpos;
		if (inkrementell)
		    {
		      P2x=xrad+xi_wert;
		      P2z=zpos+zk_wert;
		    } else {
			     P2x=(short)(xi_wert/2)+xcorr;
			     P2z=zk_wert+zcorr;
			   }
		/* Schritt */
		step=h_wert;

		/* Anfahren */
		if (step!=0)
		 if (P1z>P2z)
		    for (Zpos=P1z;Zpos-step>P2z && !endprg;Zpos-=step)
			{
			  endprg=Ziehe_Gerade(P1x,Zpos,P1x,Zpos-step,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P1x,Zpos-step,P2x,Zpos-step,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P2x,Zpos-step,P1x,Zpos-step,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			}
		  else for (Zpos=P1z;Zpos+step<P2z && !endprg;Zpos+=step)
			{
			  endprg=Ziehe_Gerade(P1x,Zpos,P1x,Zpos+step,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P1x,Zpos+step,P2x,Zpos+step,
					 prgconfig.wait_g01,schritt_g01,checkTasten);
			  if (!endprg)
			    endprg=Ziehe_Gerade(P2x,Zpos+step,P1x,Zpos+step,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
			}
		  else Zpos=P1z; /* von if step!=0 */

		/* letzter Schritt */
		if (!endprg)
		  endprg=Ziehe_Gerade(P1x,Zpos,P1x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P1x,P2z,P2x,P2z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P2x,P2z,P2x,P1z,
			 prgconfig.wait_g01,schritt_g01,checkTasten);
		if (!endprg)
		  endprg=Ziehe_Gerade(P2x,P1z,P1x,P1z,
			 prgconfig.wait_g00,schritt_g00,checkTasten);

		if (endprg) { *ok=1; *esc=1; }
		xrad=P1x;
		zpos=P1z;
	      } break;
     /**************** G90 *******************/
     case 90:{
	       /* Absoltut ein : NP = Pos des Drehmeissels */
	       inkrementell=0;
	       _settextposition(3,66);
	       _outtext("ABS");

	       /* Neuer NP setzten & akt. Koord. anpassen */
	       NeuerGrNP(xrad,zpos);
	       xrad=0;
	       zpos=0;
	     } break;
     /**************** G91 *******************/
     case 91:/* Inkrementell ein */
	     inkrementell=1;
	     break;
     /**************** G92 *******************/
     case 92:if (cncprg[ip].XI[0]!='I' && cncprg[ip].ZK[0]!='K')
	      {
		/* Absolut ein : NP = Parameter */
		inkrementell=0;
		_settextposition(3,66);
		_outtext("ABS");

		/* Neuer NP setzten & akt. Koord. anpassen */
		zw_buf1=tool; /* Werkzeug zwischenspeichern & loeschen */
		Setzte_Stahl(0,0,0);

		NeuerGrNP(xrad-(short)(xi_wert/2),zpos-zk_wert);
		xrad=(short)(xi_wert/2);
		zpos=zk_wert;

		tool=zw_buf1;
		Setzte_Stahl(xrad,zpos,tool);

	      } else { *ok=0; endprg=1; } /*von if !I & !K */
	     break;
     /**************** G94 *******************/
     case 94: break; /* zZ no Action */
     /**************** G95 *******************/
     case 95: break; /* zZ no Action */
     /**************** Error *******************/
     default:/* Unbekannter G-Befehl */
	     {
	       *ok=0;	 /* Fehlerflag */
	       endprg=1; /* Prg-Ende-Flag */
	     }
  }/* von switch m_wert */

  /* Returnwert */
  if (!*ok && endprg)
	    {
	      Status("E-Unterbrechung");
	      Meldung("G-Befehl in der aktuellen Zeile ist unbekannt oder unkorrekt!");
	    }

  return endprg;
}
/****************************************************************
WERKZEUGBILDSCHIRM
*****************************************************************/
void Werkzeuge_darstellen(void)
{
   /* Textscreen retten */
   TW_Open_Window(2,2,78,23, TW_RAHMEN_NON,TW_NO_TITEL,0,NULL);
   _setvideomode(_HRESBW);

   /* Bildschirm */
   _settextposition(1,1);
   _outtext("Werkzeuge:");

   /* T01 */
   Zeichne_Stahl(40,20,1,7);
   _settextposition(9,8);
   _outtext("T01\n     rechter\n   Seitenstahl");
   _settextposition(10,2);
   _outtext("(Referenzstahl)");

   /* T02 */
   Zeichne_Stahl(200,20,2,7);
   _settextposition(8,29);
   _outtext("T02");
   _settextposition(9,27);
   _outtext("rechter");
   _settextposition(10,25);
   _outtext("Seitenstahl");
   _settextposition(11,26);
   _outtext("Korrektur:");
   _settextposition(12,25);
   _outtext("X=0 Z=+14mm");

   /* T03 */
   Zeichne_Stahl(380,20,3,7);
   _settextposition(8,51);
   _outtext("T03");
   _settextposition(9,48);
   _outtext("neutraler");
   _settextposition(10,48);
   _outtext("Drehstahl");
   _settextposition(11,48);
   _outtext("Korrektur:");
   _settextposition(12,48);
   _outtext("X=0 Z=+7mm");

   /* T04 */
   Zeichne_Stahl(550,20,4,7);
   _settextposition(8,71);
   _outtext("T04");
   _settextposition(9,67);
   _outtext("Gewindestahl");
   _settextposition(10,67);
   _outtext("au�en rechts");
   _settextposition(11,68);
   _outtext("Korrektur:");
   _settextposition(12,68);
   _outtext("X=0 Z=+2mm");

   /* T05 */
   Zeichne_Stahl(45,130,5,7);
   _settextposition(20,8);
   _outtext("T05\n   Stechstahl\n");
   _outtext("  X=-10mm Z=0\n");
   _outtext("Breite   : 1,2mm\n");
   _outtext("max Tiefe: 1,5mm\n");

   /* T06 */
   Zeichne_Stahl(210,110,6,7);
   _settextposition(20,27);
   _outtext("T06");
   _settextposition(21,22);
   _outtext("Abstechklinge");
   _settextposition(22,26);
   _outtext("(HSS)");
   _settextposition(23,25);
   _outtext("X=0 Z=0");

   /* T07 */
   Zeichne_Stahl(390,130,7,7);
   _settextposition(20,47);
   _outtext("T07");
   _settextposition(21,43);
   _outtext("Gewindestahl");
   _settextposition(22,43);
   _outtext("innen rechts");
   _settextposition(23,42);
   _outtext("X=+10mm Z=-20mm");

   /* T08 */
   Zeichne_Stahl(570,130,8,7);
   _settextposition(20,70);
   _outtext("T08");
   _settextposition(21,67);
   _outtext("Innendreh-");
   _settextposition(22,69);
   _outtext("stahl");
   _settextposition(23,65);
   _outtext("X=+10mm Z=-20mm");

   getch();

   /* Textscreen zurueckholen */
   _setvideomode(_TEXTC80);
   TW_Close_Window();
   SYS_CursorOff();
}
Пример #20
0
int create_window( Window how_big, char *title, short border_color,
                    long background_color, short foreground_color ) {
   static int window_counter;
   int i, j;

#ifdef DIAGNOSTICS
   fprintf(stderr, "entering CREATE_WINDOW\n");
#endif

   _settextwindow(how_big.row1-1, how_big.col1-1, how_big.row2+1, how_big.col2+1);
   _wrapon ( _GWRAPOFF );
   _setbkcolor ( background_color );
   _clearscreen ( _GWINDOW );
   _settextwindow(how_big.row1-1, how_big.col1-1, how_big.row2+2, how_big.col2+4);

   _settextcolor( border_color );
   _settextposition(1,1);
   _outtext("É");
   for (i=1; i<=(how_big.col2-how_big.col1) / 2 - strlen(title) / 2 - 1; i++)
      _outtext("Í");
   if ( strlen ( title ) % 2 == 0 )
      _outtext("Í");
   _outtext(" ");
   _settextcolor( BRIGHT_WHITE );
   _outtext(strupr(title));
   _settextcolor( border_color );
   _outtext(" ");
   for (i=1; i<=(how_big.col2-how_big.col1) / 2 - strlen(title) / 2 - 1; i++)
      _outtext("Í");
   if ( strlen ( title ) % 2 == 0 )
      _outtext("Í");
   _outtext("»");

   for (j=2; j<=how_big.row2-how_big.row1+2; j++) {
      _settextposition(j, 1);
      _outtext("º");
      _settextposition(j, how_big.col2-how_big.col1+3);
      _outtext("º");
   }

   _settextposition(how_big.row2-how_big.row1+3, 1);
   _outtext("È");
   for (i=1; i<=how_big.col2-how_big.col1+1; i++)
      _outtext("Í");
   _outtext("¼");

   /*
   **  Draw shadows (shadows are necessary to avoid end-of-window wrapping).
   */

   _setbkcolor ( BLACK );
   for (i=2; i<=how_big.row2+2; i++) {
      _settextposition ( i, how_big.col2-how_big.col1+4 );
      _outtext ( "  " );
   }
   for (j=2; j<=how_big.col2-how_big.col1+3; j++) {
      _settextposition ( how_big.row2+2, j );
      _outtext ( " " );
   }

   _setbkcolor ( background_color );
   _settextcolor ( foreground_color );

   _settextwindow(how_big.row1, how_big.col1, how_big.row2, how_big.col2);
   _settextposition(1,1);

   return(0);

#ifdef DIAGNOSTICS
   fprintf(stderr, "exit CREATE_WINDOW\n");
#endif

   return(window_counter++);
}
Пример #21
0
void
progressbar (int current, int total)
{
  /* display a progress bar on screen */

  char bar[51];
  int percent;
  int width;
  int col;
  int row;

  /* assumes current >= 0, current <= total, and both current & total
     are non-negative, otherwise behavior may not be as expected. */

  if (total > 0)
    {
      percent = 100 * current / total;
    }
  else
    {
      percent = 0;
    }

  if (percent < 0)
    {
      percent = 0;
    }
  else if (percent > 100)
    {
      percent = 100;
    }

  width = percent / 2;

  /* generate a string to display */

  for (col = 0; col < width; col++)
    {
      /* bar[col] = '#'; */
      bar[col] = 219;				/* filled box */
    }

  for ( ; col < 50; col++)
    {
      /* bar[col] = '-'; */
      bar[col] = 176;				/* shaded box */
    }

  bar[50] = 0;

  /* print the string */

  /* bar is 50 cols wide, so offset is 80 - 50 = 30 ; 30 / 2 = 15 */

  _settextwindow (15,1 , 20,80);		/* y1,x1 , y2,x2 */

  _settextcolor (_YELLOW_);
  _setbkcolor (_BLUE_);

  /* only initalize/clear screen if 'current' is 0 */

  if (current == 0)
    {
      _clearscreen (_GWINDOW);
    }

  for (row = 1; row <= 3; row++)
    {
      _settextposition (row, 15);		/* relative to window */
      cputs (bar);
    }

  _settextposition (3, 67);			/* relative to window */
  cprintf ("%d%%", percent);
}
Пример #22
0
char interpEditConfigMenu(const usint ch)
{
  struct rccoord coords;
  char tempStrn[256], strn[256];


 // toggle vnum checking

  if (ch == 'A')
  {
    setVarBoolVal(&varHead, VAR_VNUMCHECK_NAME, !getVnumCheckVal(), FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle zone flag checking

  if (ch == 'B')
  {
    setVarBoolVal(&varHead, VAR_CHECKZONEFLAGS_NAME, !getCheckZoneFlagsVal(),
                  FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle stopping at zone 'S' line setting

/*
  if (ch == 'C')
  {
    setVarBoolVal(&varHead, VAR_IGNOREZONES_NAME, !getIgnoreZoneSVal(),
                  FALSE);

    displayEditConfigMenu();
  }
  else
*/

 // toggle the showing of info on menus

  if (ch == 'C')
  {
    setVarBoolVal(&varHead, VAR_SHOWMENUINFO_NAME, !getShowMenuInfoVal(),
                  FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle walk creation mode

  if (ch == 'D')
  {
    setVarBoolVal(&varHead, VAR_WALKCREATE_NAME, !getWalkCreateVal(), FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle saving of currentRoom vnum

  if (ch == 'E')
  {
    setVarBoolVal(&varHead, VAR_SROOMACTIVE_NAME, !getStartRoomActiveVal(),
                  FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle object edesc thingy

/*
  if (ch == 'F')
  {
    setVarBoolVal(&varHead, VAR_FIRSTOBJEDESCKEY_NAME,
                  !getFirstObjEdescKeyVal(), FALSE);

    displayEditConfigMenu();
  }
  else
*/

 // toggle 'consider exit dest of -1 as out-of-zone' var

  if (ch == 'F')
  {
    setVarBoolVal(&varHead, VAR_NEGDESTOUTOFZONE_NAME,
                  !getNegDestOutofZoneVal(), FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle 'show shop prices adjusted' var

  if (ch == 'G')
  {
    setVarBoolVal(&varHead, VAR_SHOWPRICESADJUSTED_NAME,
                  !getShowPricesAdjustedVal(), FALSE);

    displayEditConfigMenu();
  }
  else

 // toggle 'autosave every X commands' var

  if (ch == 'H')
  {
    setVarBoolVal(&varHead, VAR_SAVEEVERYXCOMMANDS_NAME,
                  !getSaveEveryXCommandsVal(), FALSE);

    displayEditConfigMenu();
  }
  else

 // edit 'when to autosave' variable

  if (ch == 'I')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    displayColorString("&+CNew number of commands between autosaving: &n");

    itoa(getSaveHowOftenVal(), strn, 10);

    getStrn(tempStrn, 4, 1, 7, '°', strn, FALSE, FALSE);

    if (strnumer(tempStrn))
    {
      addVar(&varHead, VAR_SAVEHOWOFTEN_NAME, tempStrn);
    }

    displayEditConfigMenu();
  }
  else

 // edit screen height

  if (ch == 'J')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    displayColorString("&+CNew screen height: &n");

    itoa(getScreenHeight(), strn, 10);

    getStrn(tempStrn, 4, 1, 7, '°', strn, FALSE, FALSE);

   // allowing a height of 0 would be bad

    if (strnumer(tempStrn) && atoi(tempStrn))
    {
      addVar(&varHead, VAR_SCREENHEIGHT_NAME, tempStrn);
    }

    displayEditConfigMenu();
  }
  else

 // edit screen width

  if (ch == 'K')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    displayColorString("&+CNew screen width: &n");

    itoa(getScreenWidth(), strn, 10);

    getStrn(tempStrn, 4, 1, 7, '°', strn, FALSE, FALSE);

   // allowing a width of 0 would be very bad

    if (strnumer(tempStrn) && atoi(tempStrn))
    {
      addVar(&varHead, VAR_SCREENWIDTH_NAME, tempStrn);
    }

    displayEditConfigMenu();
  }
  else

 // edit name of external editor

  if (ch == 'L')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    displayColorString("&+CNew external editor (full path, if necessary): &n");

    getStrn(tempStrn, MAX_VARVAL_LEN - 1, 1, 7, '°',
            getEditorName(), FALSE, FALSE);

    addVar(&varHead, VAR_TEXTEDIT_NAME, tempStrn);

    displayEditConfigMenu();
  }
  else

 // edit name of menu edit prompt

  if (ch == 'M')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    displayColorString("&+CNew prompt for menus: &n");

    getStrn(tempStrn, MAX_VARVAL_LEN - 1, 1, 7, '°',
            getMenuPromptName(), FALSE, FALSE);

    if ((strlen(tempStrn) < (MAX_VARVAL_LEN - 1 - 2)) &&
        !strright(tempStrn, "&n") &&
        !strright(tempStrn, "&N")) strcat(tempStrn, "&n");

    addVar(&varHead, VAR_MENUPROMPT_NAME, tempStrn);

    displayEditConfigMenu();
  }
  else

 // edit name of main prompt

  if (ch == 'N')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    displayColorString("&+CNew main prompt: &n");

    getStrn(tempStrn, MAX_VARVAL_LEN - 1, 1, 7, '°',
            getMainPromptStrn(), FALSE, FALSE);

    if ((strlen(tempStrn) < (MAX_VARVAL_LEN - 1 - 2)) &&
        !strright(tempStrn, "&n") &&
        !strright(tempStrn, "&N") &&
        strcmp(tempStrn, "default")) strcat(tempStrn, "&n");

    addVar(&varHead, VAR_MAINPROMPT_NAME, tempStrn);
    createPrompt();

    displayEditConfigMenu();
  }
  else

 // quit

  if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE;

  return FALSE;
}
Пример #23
0
void editObjValueField(dikuObject *obj, uchar valueField)
{
  struct rccoord coords;
  char strn[256],
       helpAvail = checkForValueList(obj->objType, valueField),
       verboseAvail = checkForVerboseAvail(obj->objType, valueField),
       searchAvail =
             (checkForSearchAvail(obj->objType, valueField) ? TRUE : FALSE);


  coords = _gettextposition();

  _settextposition(coords.row, 1);
  clrline(coords.row);

  if (!specialObjValEdit(obj, valueField, FALSE))
  {
    while (TRUE)
    {
      if (!(verboseAvail && searchAvail))
        sprintf(strn, "&+CNew value for object field #%u", valueField + 1);
      else
        sprintf(strn, "&+CNew val for obj field #%u", valueField + 1);

     // assume verbose/search are only available if help is available

      if (helpAvail)
      {
        strcat(strn, " (? for list");

//        if (verboseAvail) strcat(strn, ", ?? for full list");

        if (searchAvail) strcat(strn, ", $ to search");

        strcat(strn, "): &n");
      }
      else strcat(strn, ": &n");

      displayColorString(strn);

      itoa(obj->objValues[valueField], strn, 10);

      getStrn(strn, 8, 1, 7, '°', strn, FALSE, FALSE);

      if (!strcmp(strn, "?") && helpAvail)
      {
        displayObjValueHelp(obj->objType, valueField, FALSE);
      }
      else

     // below assumes that verbose is only available when help is available

      if (!strcmp(strn, "??") && verboseAvail)
      {
        displayObjValueHelp(obj->objType, valueField, TRUE);
      }
      else

     // ditto for search

      if (!strcmp(strn, "$") && searchAvail)
      {
        searchObjValue(obj->objType, valueField);
      }
      else

      break;  // later add some sorta range checking or sump'n
    }

    obj->objValues[valueField] = atoi(strn);
  }
  else specialObjValEdit(obj, valueField, TRUE);
}
Пример #24
0
char interpEditObjTrapInfoMenu(usint ch, dikuObject *obj)
{
  char strn[256] = "\0", newName[256];
  struct rccoord coords;

 // edit trap affect flag

  if (ch == 'A')
  {
    fixObjName(obj->objShortName, newName);

    sprintf(strn, "&+gEditing trap effect flags for obj #&+c%u&+w, &+L\"&n%s&+L\"&n\n\n",
            obj->objNumber, newName);

    editFlags(trapEffFlagDef, &(obj->trapAff), strn,
              "object trap effect flags", NULL, 1);

    displayEditObjTrapInfoMenu(obj);
  }
  else

 // edit trap damage type

  if (ch == 'B')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    while (TRUE)
    {
      displayColorString("&+CNew trap damage type (? for list):&n ");

      itoa(obj->trapDam, strn, 10);

      getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE);

      if (!strcmp(strn, "?")) displayObjTrapDamList();
      else break;  // later add some sorta range checking or sump'n
    }

    obj->trapDam = atoi(strn);

    displayEditObjTrapInfoMenu(obj);
  }
  else

 // edit number of trap uses

  if (ch == 'C')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    while (TRUE)
    {
      displayColorString("&+CNew number of trap uses:&n ");

      itoa(obj->trapCharge, strn, 10);

      getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE);

      break;
    }

    obj->trapCharge = atoi(strn);

    displayEditObjTrapInfoMenu(obj);
  }
  else

 // edit trap level

  if (ch == 'D')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    while (TRUE)
    {
      displayColorString("&+CNew trap level (1-100):&n ");

      itoa(obj->trapLevel, strn, 10);

      getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE);

      break;
    }

    obj->trapLevel = atoi(strn);

    displayEditObjTrapInfoMenu(obj);
  }
  else
  if (ch == 'E')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    while (TRUE)
    {
      displayColorString("&+CNew trap percent (1-100):&n ");

      itoa(obj->trapPercent, strn, 10);

      getStrn(strn, 10, 1, 7, '°', strn, FALSE, FALSE);

      break;
    }

    obj->trapPercent = atoi(strn);

    displayEditObjTrapInfoMenu(obj);
  }
  else

  if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE;

  return FALSE;
}
Пример #25
0
char interpEditObjMiscMenu(usint ch, dikuObject *obj)
{
  char strn[256] = "\0";
  struct rccoord coords;


 // edit object type

  if (ch == 'A')
  {
    coords = _gettextposition();

    _settextposition(coords.row, 1);
    clrline(coords.row);

    while (TRUE)
    {
      if (checkForObjHeresWithLoadedContainer(obj->objNumber))
      {
        displayColorString(
"&+MCannot change type - objects exist of this type with items inside - press a key&n");

        getkey();

        displayEditObjMiscMenu(obj);

        return FALSE;
      }

      displayColorString("&+CNew object type (? for list): &n");

      itoa(obj->objType, strn, 10);

      getStrn(strn, 3, 1, 7, '°', strn, FALSE, FALSE);

      if (!strcmp(strn, "?")) displayObjTypeList();
      else break;
    }

    obj->objType = atoi(strn);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 0

  if (ch == 'B')
  {
    editObjValueField(obj, 0);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 1

  if (ch == 'C')
  {
    editObjValueField(obj, 1);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 2

  if (ch == 'D')
  {
    editObjValueField(obj, 2);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 3

  if (ch == 'E')
  {
    editObjValueField(obj, 3);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 4

  if (ch == 'F')
  {
    editObjValueField(obj, 4);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 5

  if (ch == 'G')
  {
    editObjValueField(obj, 5);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 6

  if (ch == 'H')
  {
    editObjValueField(obj, 6);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit object value 7

  if (ch == 'I')
  {
    editObjValueField(obj, 7);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit apply "type" 0

  if (ch == 'J')
  {
    editObjApplyType(obj, 0);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit apply modifier 0

  if (ch == 'K')
  {
    editObjApplyValue(obj, 0);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit apply "type" 1

  if (ch == 'L')
  {
    editObjApplyType(obj, 1);

    displayEditObjMiscMenu(obj);
  }
  else

 // edit apply modifier 1

  if (ch == 'M')
  {
    editObjApplyValue(obj, 1);

    displayEditObjMiscMenu(obj);
  }
  else if (checkMenuKey(ch, FALSE) == MENUKEY_SAVE) return TRUE;

  return FALSE;
}
char Execute_M(char *ok,char *esc)
{
  char endprg=0, arghhhh=*esc,
       Mbuffer[6],buf[20];
  int  m_wert;
  int  xi_wert,
       zk_wert,
       flkt_wert,
       h_wert;

  Status("Simulation");
  Meldung("Bearbeite M-Befehl.");

  /* G/M umkopieren zwecks Veraenderung */
  strcpy(Mbuffer,cncprg[ip].GM);

  /* M-Zeichen eliminieren & Wert feststellen */
  Mbuffer[0]=' ';
  m_wert=atoi(Mbuffer);

  strcpy(buf,cncprg[ip].XI);
  ElimSpaces(buf);
  ElimSpaces(buf);
  if (isdigit((int)buf[0]) || buf[0]=='-')
     xi_wert=atoi(buf);
    else xi_wert=atoi(buf+1);

  strcpy(buf,cncprg[ip].ZK);
  ElimSpaces(buf);
  ElimSpaces(buf);
  if (isdigit((int)buf[0]) || buf[0]=='-')
     zk_wert=atoi(buf);
    else zk_wert=atoi(buf+1);

  strcpy(buf,cncprg[ip].FLKT);
  ElimSpaces(buf);
  ElimSpaces(buf);
  if (isdigit((int)buf[0]) || buf[0]=='-')
     flkt_wert=atoi(buf);
    else flkt_wert=atoi(buf+1);

  h_wert=atoi(cncprg[ip].H);

  /* M-Befehle verzweigen */
  switch(m_wert)
  {
     /**************** M00 *******************/
     case 0:{
	      Meldung("Taste zur Fortsetzung.");
	      getch();
	      Meldung(" ");
	    } break; /* No Action */
     /**************** M01: Pseudo: Stueck neuzeichnen *******************/
     case 1:{
	      DemoText();
	      Zeichne_stueck();
	    }break;
     /**************** M03 *******************/
     case 3:break; /* No Action */
     /**************** M05 *******************/
     case 5:break; /* No Action */
     /**************** M06 *******************/
     case 6: /* werkzeugwechsel */
	     if (cncprg[ip].FLKT[0]=='T' && flkt_wert>0 && flkt_wert<=max_tools)
	     {
	       _settextposition(3,37);
	       _outtext(cncprg[ip].FLKT);
	       _outtext("        ");

	       Setzte_Stahl(xrad,zpos,(char)flkt_wert);
	       endprg=Ziehe_Gerade(xrad,zpos,xrad+xi_wert,zpos+zk_wert,
					 prgconfig.wait_g00,schritt_g00,checkTasten);
	       xrad=xrad+xi_wert;
	       zpos=zpos+zk_wert;

	       xcorr=xi_wert;
	       zcorr=zk_wert;
	     } else { *ok=0; endprg=1; }
	     break;
     /**************** M17 *******************/
     case 17:if (sp>0)
	     {
	       ip=stack[--sp];
	       ip++;
	     } else
	     {
	       Meldung("Fehler im RETURN-M17-Befehl: Keine Subroutine!");
	       Status("Fehler!");
	       endprg=1; *ok=0;
	     }break;
     /**************** M30 *******************/
     case 30:{
	       Status("M30-Ende");
	       Meldung(" ");
	       endprg=1;
	     } break;
     /**************** M98 *******************/
     case 98:break; /* No Action */
     /**************** M99 *******************/
     case 99:{
	       /* nur in Verbindung mit G02/G03 */
	       Meldung("Einzelner M99 Befehl gefunden!!");
	       Status("Fehler!");
	       endprg=1;
	       *ok=0;
	     }
     /**************** Error *******************/
     default:/* Unbekannter M-Befehl */
	     {
	       *ok=0;	 /* Fehlerflag */
	       endprg=1; /* Prg-Ende-Flag */
	     }
  }/* von switch m_wert */

  /* Returnwert */
  if (!*ok && endprg)
	    {
	      Status("E-Unterbrechung");
	      Meldung("M-Befehl in der aktuellen Zeile ist unbekannt oder unkorrekt!");
	    }

  return endprg;
}
Пример #27
0
char showmethodwin()
{
	int				i,nWidth;
	int				nmethod;
	int				nselect = 0;
	char			ch;
	char			Method[40];
	char			*str[] = {"( ) [B]eep Off","[O]k","[C]ancel"};
	static point	ptmethodok,ptmethodcancel,ptmethodbeep;
	char			*szMethod[] = {"Overwrite with 00","Overwrite with FF",
						"Overwrite with random data","NSA method",
						"Old NSA method","DoD STD method",
						"NATO method","Gutmann method"};
	
	_setvisualpage(PAGE_METHOD);  
	_setactivepage(PAGE_METHOD);  
                    
	nmethod = g_nMethod;
	                    
    drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);
 	_settextposition(3, 4);          
	_outtext("Please select the method :");
   
	g_pMethodSelWin = new cwindow(PAGE_METHOD, 5, 4, 15, 40);
	for(i=0;i<8;i++)
	{
		sprintf(Method,"( ) %s",szMethod[i]);
		g_pMethodSelWin->additemNotSort(Method,i); 
	}

	ptmethodcancel.row = 23;
	nWidth = strlen(str[2]);
	ptmethodcancel.col = g_SysInfo.nmaxcols - 2 - nWidth;	           
	_settextposition(ptmethodcancel.row, ptmethodcancel.col);
	_outtext(str[2]);  
	drawbox(ptmethodcancel.row - 1, ptmethodcancel.col - 1, ptmethodcancel.row + 1, ptmethodcancel.col + nWidth);

	nWidth = strlen(str[1]);
	ptmethodok.row = ptmethodcancel.row;
	ptmethodok.col = ptmethodcancel.col - 2 -nWidth;	           
	_settextposition(ptmethodok.row, ptmethodok.col);
	_outtext(str[1]);  
	drawbox(ptmethodok.row - 1, ptmethodok.col - 1, ptmethodok.row + 1, ptmethodok.col + nWidth);

	ptmethodbeep.row = 18;
	ptmethodbeep.col = 6;	           
	_settextposition(ptmethodbeep.row, ptmethodbeep.col);
	if (g_bBeepOff) str[0][1] = '*';
	else str[0][1] = ' ';
	_outtext(str[0]);  
	
	SetSelMethod(nmethod);
	winproc(g_pMethodSelWin, WM_ACTIVE);
	
	while(1)
	{                                               
	  	ch = _getch();
		switch(ch)
		{
		case 'b':
		case 'B':
			nselect = 1;  
//			winproc(g_pMethodSelWin, WM_INACTIVE);
			selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR);
			break;
		case 'o':
		case 'O':
			 g_nMethod = nmethod;
			_clearscreen(_GCLEARSCREEN); 
			delete g_pMethodSelWin;
		    return 'o';
		case 'c':
		case 'C':
		case ESC :
			_clearscreen(_GCLEARSCREEN); 
			delete g_pMethodSelWin;
		    return 'c';
		case SPACE :
			switch (nselect)
			{
			case 0:
				if(nmethod !=  g_pMethodSelWin->m_pitemactive->btItem)
				{
					nmethod = g_pMethodSelWin->m_pitemactive->btItem;
				}
				g_pMethodSelWin->emptyitem();
				g_pMethodSelWin->emptyscreen();
				for(i=0;i<8;i++)
				{
					sprintf(Method,"( ) %s",szMethod[i]);
					g_pMethodSelWin->additemNotSort(Method,i); 
				}
				SetSelMethod(nmethod);
				break;
			case 1:
				g_bBeepOff = !g_bBeepOff;
				if (g_bBeepOff) str[0][1] = '*';
				else str[0][1] = ' ';
				_settextposition(ptmethodbeep.row, ptmethodbeep.col);
				_outtext(str[0]);  
				selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR);
				break;
			case 2:
				 g_nMethod = nmethod;
				_clearscreen(_GCLEARSCREEN); 
				delete g_pMethodSelWin;
			    return 'o';
			case 3:
				_clearscreen(_GCLEARSCREEN); 
				delete g_pMethodSelWin;
			    return 'c';
			}
			break;
		case 0:
			switch(ch = _getch())
			{
			case SHIFT_TAB:
				switch(nselect)
				{
				case 0:
					nselect = 3;  
					winproc(g_pMethodSelWin, WM_INACTIVE);
					selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, SELCOLOR);
					break;
				case 1:
					nselect = 0;
					winproc(g_pMethodSelWin, WM_ACTIVE);
					selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, TEXTCOLOR);
					break;
				case 2:
					nselect = 1;
					selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR);
					selectstr(str[1], ptmethodok.row, ptmethodok.col, TEXTCOLOR);
					break;
				case 3:
					nselect = 2;  
					selectstr(str[1], ptmethodok.row, ptmethodok.col, SELCOLOR);
					selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, TEXTCOLOR);
					break;
				}
				break;
			case PAGEDOWN:
			case PAGEUP:
			case CTRL_END:
			case CTRL_HOME:  
			case UP:
			case DOWN:
				winproc(g_pMethodSelWin, WM_KEY, ch);
				break;
			}
			break;
		case TAB:
			switch(nselect)
			{
			case 0:
				nselect = 1;  
				winproc(g_pMethodSelWin, WM_INACTIVE);
				selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, SELCOLOR);
				break;
			case 1:
				nselect = 2;  
				selectstr(str[0], ptmethodbeep.row, ptmethodbeep.col, TEXTCOLOR);
				selectstr(str[1], ptmethodok.row, ptmethodok.col, SELCOLOR);
				break;
			case 2:
				nselect = 3;
				selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, SELCOLOR);
				selectstr(str[1], ptmethodok.row, ptmethodok.col, TEXTCOLOR);
				break;
			case 3:
				nselect = 0;  
				winproc(g_pMethodSelWin, WM_ACTIVE);
				selectstr(str[2], ptmethodcancel.row, ptmethodcancel.col, TEXTCOLOR);
				break;
			}
			break;
		case CR:
			switch(nselect)
			{
			case 2:
				 g_nMethod = nmethod;
				_clearscreen(_GCLEARSCREEN); 
				delete g_pMethodSelWin;
			    return 'o';
			case 3:
				_clearscreen(_GCLEARSCREEN); 
				delete g_pMethodSelWin;
			    return 'c';
			}
		}
	}
}
Пример #28
0
char showdiskviewwin()
{
	int					i;
	int					nWidth,nErr;
	char				szdrv[40];
	char				ch;
	char				*str[] = {"[S]elect sector"};
	static point		ptselsec;
	BIOS_DRIVE_PARAM    DriveParam;
	
	_setvisualpage(PAGE_DISKVIEW);  
	_setactivepage(PAGE_DISKVIEW);  
    
    ptselsec.row = 5;
    ptselsec.col = 64;
    
    drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);
    
   	_settextposition(2, 4); 
	_outtext("Sector information of hard disk");
    
    //Create and init disk selecter window.
    g_pDiskViewDiskWin = new cwindow(PAGE_DISKVIEW, 3, 4, 7, 35);
	//for(i = 0; i < g_nDiskNum; i++) 
	for(i = 0; i < g_nDiskNum; i++) 
	{            
		GetDriveParam(i+DISKBASE,&DriveParam);
		sprintf(szdrv, DISKFORMAT, i + 1,DriveParam.dwSectorL/2048);
		g_pDiskViewDiskWin->additemNotSort(szdrv,i); 
	}
	g_pDiskViewDiskWin->enabledscroll();
	if(!g_diskviewinfo.nSelDisk)
		g_diskviewinfo.nSelDisk = g_pDiskViewDiskWin->m_pitemactive->btItem+DISKBASE;    
	GetDriveParam(g_diskviewinfo.nSelDisk,&DriveParam);
	SetDiskSelecter(g_diskviewinfo.nSelDisk-DISKBASE);

	if(g_diskviewinfo.dwMinSec == g_diskviewinfo.dwMaxSec)
	{
		g_diskviewinfo.dwMinSec = 0;
		g_diskviewinfo.dwMaxSec = DriveParam.dwSectorL-1;
	}
	//Show selected disk number.
   	_settextposition(2, 36); 
	sprintf(szdrv,DISKVIEWDISKINFO,g_diskviewinfo.nSelDisk-DISKBASE +1,
			g_diskviewinfo.dwMinSec,g_diskviewinfo.dwMaxSec);
	_outtext(szdrv);

    //Create and init show selected sector detail window.
    g_pDiskViewInfoWin = new cwindow(PAGE_DISKVIEW,9,2,23,79);
	ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec,g_diskviewinfo.nSelDisk,&DriveParam,&nErr);
	g_pDiskViewInfoWin->enabledscroll();
	if(g_diskviewinfo.nselect == 2)
		winproc(g_pDiskViewInfoWin, WM_ACTIVE);
	
	//Init and Show absolute sector
	_settextposition(8,4);
	_outtext("Physical Sector: Absolute Sector ");

	_settextposition(8,37);
	sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec);
	_outtext(szdrv);

	//Add function box
	nWidth = strlen(str[0]);	                                 
	_settextposition(ptselsec.row, ptselsec.col);
	_outtext(str[0]);  
	drawbox(ptselsec.row - 1, ptselsec.col - 1, ptselsec.row + 1, ptselsec.col + nWidth);
	
   	_settextposition(24, 45); 
	_outtext("PageUp/PageDown:Prev/Next sector");
	showchs(&DriveParam);
	//Set active item
	switch(g_diskviewinfo.nselect)
	{
	case 0:
		winproc(g_pDiskViewDiskWin, WM_ACTIVE);
		break;
	case 1:
		if(g_diskviewinfo.nselect == 1)	selectstr(str[0], ptselsec.row, ptselsec.col, SELCOLOR);
		winproc(g_pDiskViewDiskWin, WM_INACTIVE);
		break;
	case 2:
		winproc(g_pDiskViewInfoWin, WM_ACTIVE);
		winproc(g_pDiskViewDiskWin, WM_INACTIVE);
		break;
	}

	while(1)
	{                                               
	  	ch = _getch();
		switch(ch)
		{
		case 's':
		case 'S':
			_clearscreen(_GCLEARSCREEN);
			DeleteDiskViewWin();
			return 's';			
		case 'C':
		case 'c':
		case ESC :
			_clearscreen(_GCLEARSCREEN); 
			DeleteDiskViewWin();
			memset(&g_diskviewinfo,0,sizeof(_diskviewinfo));
			return 'c';
		case CR:
			if(g_diskviewinfo.nselect == 1)
			{
				_clearscreen(_GCLEARSCREEN);
				DeleteDiskViewWin();
				return 's';			
			}
			break;
		case TAB:
			switch(g_diskviewinfo.nselect)
			{
			case 0:
				g_diskviewinfo.nselect = 1;
				selectstr(str[0], ptselsec.row, ptselsec.col, SELCOLOR);
				winproc(g_pDiskViewDiskWin, WM_INACTIVE);                                        
				break;
			case 1:
				g_diskviewinfo.nselect = 2;  
				selectstr(str[0], ptselsec.row, ptselsec.col, TEXTCOLOR);
				winproc(g_pDiskViewInfoWin, WM_ACTIVE);                                        
				break;
			case 2:
				g_diskviewinfo.nselect = 0;
				winproc(g_pDiskViewDiskWin, WM_ACTIVE);                                        
				winproc(g_pDiskViewInfoWin, WM_INACTIVE);                                        
				break;
			}
			break;
		case 0:
			switch(ch = _getch())
			{
			case SHIFT_TAB:
				switch(g_diskviewinfo.nselect)
				{
				case 0:
					g_diskviewinfo.nselect = 2;  
					winproc(g_pDiskViewDiskWin, WM_INACTIVE);                                        
					winproc(g_pDiskViewInfoWin, WM_ACTIVE);                                        
					break;
				case 1:
					g_diskviewinfo.nselect = 0;
					selectstr(str[0], ptselsec.row, ptselsec.col, TEXTCOLOR);
					winproc(g_pDiskViewDiskWin, WM_ACTIVE);                                        
					break;
				case 2:
					g_diskviewinfo.nselect = 1;
					selectstr(str[0], ptselsec.row, ptselsec.col, SELCOLOR);
					winproc(g_pDiskViewInfoWin, WM_INACTIVE);                                        
					break;
				}
				break;
			case PAGEDOWN:
				if(g_diskviewinfo.dwSelSec != g_diskviewinfo.dwMaxSec)
				{
					g_diskviewinfo.dwSelSec ++;
					_settextposition(8,37);
					_outtext(NULLSTRING);
					_settextposition(8,37);
					sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec);
					_outtext(szdrv);
					ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec,
									g_diskviewinfo.nSelDisk,&DriveParam,&nErr);
					g_pDiskViewInfoWin->enabledscroll();
					if(g_diskviewinfo.nselect == 2)
					{
						winproc(g_pDiskViewInfoWin, WM_ACTIVE);
					}
					showchs(&DriveParam);
				}
				break;
			case PAGEUP:
				if(g_diskviewinfo.dwSelSec != g_diskviewinfo.dwMinSec)
				{
					g_diskviewinfo.dwSelSec --;
					_settextposition(8,37);
					_outtext(NULLSTRING);
					_settextposition(8,37);
					sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec);
					_outtext(szdrv);

					ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec,
									g_diskviewinfo.nSelDisk,&DriveParam,&nErr);
					g_pDiskViewInfoWin->enabledscroll();
					if(g_diskviewinfo.nselect == 2)
					{
						winproc(g_pDiskViewInfoWin, WM_ACTIVE);
					}
					showchs(&DriveParam);
				}
				break;
			case CTRL_END:
			case CTRL_HOME:  
			case UP:
			case DOWN:
				if(g_diskviewinfo.nselect == 0 && !g_diskviewinfo.bDisableSwitchDisk)
				{
					g_pDiskViewDiskWin->m_pitemactive->szitemtext[1] = ' ';
					writestr(PAGE_DISKVIEW, 3+g_pDiskViewDiskWin->m_nactiverow , 6, " ");
					winproc(g_pDiskViewDiskWin, WM_KEY, ch);
					g_pDiskViewDiskWin->m_pitemactive->szitemtext[1] = '*';
					writestr(PAGE_DISKVIEW, 3+g_pDiskViewDiskWin->m_nactiverow , 6, "*");

					g_diskviewinfo.nSelDisk = g_pDiskViewDiskWin->m_pitemactive->btItem+DISKBASE;    
					GetDriveParam(g_diskviewinfo.nSelDisk,&DriveParam);
					
					g_diskviewinfo.dwSelSec = 0;
					g_diskviewinfo.dwMinSec = 0;
					g_diskviewinfo.dwMaxSec = DriveParam.dwSectorL-1;

					_settextposition(2,36);
					_outtext(NULLSTRING);
				   	_settextposition(2, 36); 
					sprintf(szdrv,DISKVIEWDISKINFO,g_diskviewinfo.nSelDisk-DISKBASE +1,
							g_diskviewinfo.dwMinSec,g_diskviewinfo.dwMaxSec);
					_outtext(szdrv);

					_settextposition(8,37);
					_outtext(NULLSTRING);
					_settextposition(8,37);
					sprintf(szdrv,ABSLUTESECTOR,g_diskviewinfo.dwSelSec);
					_outtext(szdrv);

					ShowSectorInfo(g_pDiskViewInfoWin,g_diskviewinfo.dwSelSec,
								g_diskviewinfo.nSelDisk,&DriveParam,&nErr);
					g_pDiskViewInfoWin->enabledscroll();
					showchs(&DriveParam);
				}
				if(g_diskviewinfo.nselect == 2)
				{
					winproc(g_pDiskViewInfoWin, WM_KEY, ch);
				}
				break;
			}
			break;
		}
	}

}
char LE_LineEdit(struct LE_parameter *para)
{
    char laenge=(char)(strlen(para->editstr)-1),
         xpos=para->x,
         ypos=para->y;
    char zeile[81],
         insert=para->insert,
         xcursor=para->begin_xpos;  /* beginnt ab 0 */

    char taste=0,
         raus=0,
         retcode=0,
         flag=0,
         za;


    /* CursorOn*/
    strcpy(zeile,para->editstr);

    _settextposition(ypos,xpos);
    _outtext(zeile);

    while(!raus)
    {
        /* Missbrauch des Systemcursors */
        _settextposition(ypos,xpos+xcursor);

        /* Warte auf Taste */
        if (para->erstetaste==0)
        {
            while (!kbhit());
            taste=(char)getch();
        }
        else {
            taste=para->erstetaste;
            para->erstetaste=0;
        }

        if (taste==0 || taste<31 || taste>126)
            /* Controllcodes */
        {
            if (taste==0)
                taste=(char)getch();
            switch(taste)
            {
            case 27: /* ESC */
                if (para->esc_erlaubt)
                {
                    raus=1;
                    retcode=LE_ESC;
                }
                break;
            case 77: /* rechts */
            {
                xcursor++;
                if (xcursor>laenge && para->raus_rechts)
                {
                    raus=1;
                    retcode=LE_RECHTS_RAUS;
                }
                if (xcursor>laenge && !para->raus_rechts)
                    xcursor--;
            }
            break;
            case 75: /* links */
            {
                xcursor--;
                if (xcursor<0 && para->raus_links)
                {
                    raus=1;
                    retcode=LE_LINKS_RAUS;
                }
                if (xcursor<0 && !para->raus_links)
                    xcursor++;
            }
            break;
            case 72: /* rauf */
                if (para->raus_oben)
                {
                    raus=1;
                    retcode=LE_OBEN_RAUS;
                }
                break;
            case 80: /* runter */
                if (para->raus_unten)
                {
                    raus=1;
                    retcode=LE_UNTEN_RAUS;
                }
                break;
            case 79: /* Ende */
            {
                for (za=laenge; za>0 && zeile[za]==' '; za--)
                    xcursor=za;
                _settextposition(ypos,xpos+xcursor);
            }
            break;
            case 71: /* Pos 1 */
            {
                xcursor=0;
                _settextposition(ypos,xpos);
            }
            break;
            case 82: /* Insert */
                insert=(char)!insert;
                break;

            case 83: /* Clr */
            {
                for (za=(char)(xcursor+1); za<=laenge; za++)
                    zeile[za-1]=zeile[za];
                zeile[laenge]=' ';
                _settextposition(ypos,xpos);
                _outtext(zeile);
            }
            break;
            case 13: /* Enter */
            {
                raus=1;
                retcode=LE_OK;
            }
            break;
            case 8:  /* Del */
                if (xcursor!=0)
                {
                    for (za=xcursor; za<=laenge; za++)
                        zeile[za-1]=zeile[za];
                    zeile[laenge]=' ';
                    xcursor--;
                    _settextposition(ypos,xpos);
                    _outtext(zeile);
                }
                break;
            case 10: /* CTRL + ENTER */
            {
                raus=1;
                retcode=LE_CTRL_RET;
            }
            break;
            case 25: /* CTRL + Y */
            {
                raus=1;
                retcode=LE_CTRL_Y;
            }
            break;
            case (char)146: /* CTRL + ins */
            {
                raus=1;
                retcode=LE_CTRL_INS;
            }
            break;
            case (char)118: /* CTRL + PD */
            {
                raus=1;
                retcode=LE_CTRL_PD;
            }
            break;
            case (char)132: /* CTRL + PU */
            {
                raus=1;
                retcode=LE_CTRL_PU;
            }
            break;
            case 59: /* F1 */
            {
                raus=1;
                retcode=LE_FUN_1;
            }
            break;
            case (char)134:/* F12 */
            {
                raus=1;
                retcode=LE_FUN_12;
            }
            break;
            } /* von switch taste */

        }/* 0-Code-Behandlung */
        else
            /* Normale Zeichen */
        {
            for (za=0,flag=0; para->zeichenmenge[za]!='\0'; za++)
                if (para->zeichenmenge[za]==taste)
                    flag=1;

            if (flag) /* Zeichen erlaubt */
            {
                LE_Ret_letztes_Zeichen=taste;
                if (insert)
                    /* Einfuegen */
                {
                    if (zeile[laenge]==' ')
                    {
                        for (za=(char)(laenge-1); za>=xcursor; za--)
                            zeile[za+1]=zeile[za];
                        zeile[xcursor]=taste;
                        _settextposition(ypos,xpos);
                        _outtext(zeile);
                        xcursor++;
                        if (xcursor>laenge && para->raus_ueberlauf)
                        {
                            raus=1;
                            retcode=LE_RECHTS_RAUS;
                        }
                        if (xcursor>laenge && !para->raus_ueberlauf)
                            xcursor--;
                    }
                }
                else
                    /* Ueberschreiben */
                {
                    zeile[xcursor]=taste;
                    XLE_outchar(taste);
                    xcursor++;
                    if (xcursor>laenge && para->raus_ueberlauf)
                    {
                        raus=1;
                        retcode=LE_RECHTS_RAUS;
                    }
                    if (xcursor>laenge && !para->raus_ueberlauf)
                        xcursor--;
                }

            }/* erlaubte Zeichen */
        }/* von normale Zeichen */

    }

    /* cursoroff*/
    strcpy(para->editstr,zeile);
    LE_Ret_XPos	 =xcursor;
    LE_Ret_MausYPos=0;
    LE_Ret_MausYPos=0;

    return retcode;
}
Пример #30
0
char showfinishwin()
{
	char			ch;
	int				nWidth,nselect;
	char			*str[] = {"Change [L]og Drive","[S]ave report","[F]inish"};
	static point	ptlogdrive,ptsave,ptfinish;

label_start_show:
	_setvisualpage(PAGE_FINISH);  
	_setactivepage(PAGE_FINISH);  
    
    drawbox(1, 1, g_SysInfo.nmaxrows, g_SysInfo.nmaxcols);    
	_settextposition(3, (g_SysInfo.nmaxcols-20)/2);          
	_outtext("Delete Successfuly");
    drawbox(2, (g_SysInfo.nmaxcols-20)/2-3, 4, (g_SysInfo.nmaxcols-20)/2+20);

	_settextposition(7, 4);          
	_outtext("is deleted completely by the NSA method.");

	nWidth = strlen(str[2]);
	ptfinish.row = 23;
	ptfinish.col = g_SysInfo.nmaxcols - 2 - nWidth;	           
	_settextposition(ptfinish.row, ptfinish.col);
	_outtext(str[2]);  
	drawbox(ptfinish.row - 1, ptfinish.col - 1, ptfinish.row + 1, ptfinish.col + nWidth);

	nWidth = strlen(str[1]);
	ptsave.row = 23;
	ptsave.col = ptfinish.col - 2 - nWidth;	           
	_settextposition(ptsave.row, ptsave.col);
	_outtext(str[1]);  
	drawbox(ptsave.row - 1, ptsave.col - 1, ptsave.row + 1, ptsave.col + nWidth);

   	nWidth = strlen(str[0]);
	ptlogdrive.row = 23;
	ptlogdrive.col = ptsave.col - 2 - nWidth;	           
	_settextposition(ptlogdrive.row, ptlogdrive.col);
	_outtext(str[0]);  
	drawbox(ptlogdrive.row - 1, ptlogdrive.col - 1, ptlogdrive.row + 1, ptlogdrive.col + nWidth);

    finishshowtarget();
	selectstr(str[1], ptsave.row, ptsave.col, SELCOLOR); 
	nselect = 1;

	while(1)
	{                                               
	  	ch = _getch();
		switch(ch)
		{
		case 's':
		case 'S':
			if (!SaveReportEx(g_chLogDrive))
			{
				ErrorMessageBox("Fail to save report!");
				break;
			}
			_clearscreen(_GCLEARSCREEN); 
			return 's';
		case 'F':
		case 'f':
		case ESC :
			_clearscreen(_GCLEARSCREEN); 
			return 'f';
		case 'l':
		case 'L':
			showsellogdrivewin();
			goto label_start_show;
			break;
		case TAB:
			switch(nselect)
			{
			case 1:
				nselect = 2;
				selectstr(str[1], ptsave.row, ptsave.col, TEXTCOLOR);
				selectstr(str[2], ptfinish.row,ptfinish.col, SELCOLOR);
				break;
			case 2:
				nselect = 0;
				selectstr(str[2], ptfinish.row, ptfinish.col, TEXTCOLOR);
				selectstr(str[0], ptlogdrive.row, ptlogdrive.col, SELCOLOR);
				break;
			case 0:
				nselect = 1;
				selectstr(str[0], ptlogdrive.row, ptlogdrive.col, TEXTCOLOR);
				selectstr(str[1], ptsave.row, ptsave.col, SELCOLOR);
				break;
			}
			break;
		case CR:
			switch (nselect)
			{
			case 0:
				showsellogdrivewin();
				goto label_start_show;
				break;
			case 1:
				if (!SaveReportEx(g_chLogDrive))
				{
					ErrorMessageBox("Fail to save report!");
					break;
				}
				_clearscreen(_GCLEARSCREEN);
				return 's';
			case 2:
				_clearscreen(_GCLEARSCREEN);
				return 'f';
			}
		case 0:
			switch(ch = _getch())
			{
			case SHIFT_TAB:
				switch(nselect)
				{
				case 1:
					nselect = 2;
					selectstr(str[1], ptsave.row, ptsave.col, TEXTCOLOR);
					selectstr(str[2], ptfinish.row,ptfinish.col, SELCOLOR);
					break;
				case 2:
					nselect = 0;
					selectstr(str[2], ptfinish.row, ptfinish.col, TEXTCOLOR);
					selectstr(str[0], ptlogdrive.row, ptlogdrive.col, SELCOLOR);
					break;
				case 0:
					nselect = 1;
					selectstr(str[0], ptlogdrive.row, ptlogdrive.col, TEXTCOLOR);
					selectstr(str[1], ptsave.row, ptsave.col, SELCOLOR);
					break;
				}
			}
			break;
		}
	}
}