Example #1
0
void
_WinDrawRectangle(RectangleType *r, UInt16 cornerDiam)
{
	if (hires)
		HRWinDrawRectangle(hires, r, cornerDiam);
	else
		WinDrawRectangle(r, cornerDiam);
}
Example #2
0
static void
TableDrawData(void *table, Int16 row, Int16 column, RectangleType *bounds)
{
  UInt16 index=TblGetRowID(table, row);
  ExamDBRecord *ex;
  MemHandle mex;
  RGBColorType fore={0x00, 0x00, 0x00, 0x00}, back={0x00, 0xFF, 0xFF, 0xFF};

  if (! TblRowUsable(table, row)) return;
  
  TNSetBackColorRGB(&back, NULL);
  TNSetForeColorRGB(&back, NULL);
  WinDrawRectangle(bounds, 0);

  mex = DmQueryRecord(DatabaseGetRefN(DB_MAIN), index);
  ex = (ExamDBRecord *)MemHandleLock(mex);

  if (column == EXCOL_COURSE) {
    Char *temp;
    MemHandle m=MemHandleNew(1);
    CourseGetName(ex->course, &m, true);
    temp = MemHandleLock(m);

    TNSetForeColorRGB(&fore, NULL);
    TNDrawCharsToFitWidth(temp, bounds);

    MemHandleUnlock(m);
    MemHandleFree(m);
  } else if (column == EXCOL_NOTE) {
    if (ex->note) {
      Char noteSymb[2] = { GADGET_NOTESYMBOL, 0 };
      FontID oldFont = FntSetFont(symbolFont);

      TNDrawCharsToFitWidth(noteSymb, bounds);
      FntSetFont(oldFont);
    }
  } else if (column == EXCOL_DATE) {
    Char dateTemp[dateStringLength];
    DateToAscii(ex->date.month, ex->date.day, ex->date.year+MAC_SHIT_YEAR_CONSTANT, PrefGetPreference(prefDateFormat), dateTemp);
    TNDrawCharsToFitWidth(dateTemp, bounds);
  } else if (column == EXCOL_TIME) {
    Char timeTemp[timeStringLength];
    TimeToAscii(ex->begin.hours, ex->begin.minutes, PrefGetPreference(prefTimeFormat), timeTemp);
    TNDrawCharsToFitWidth(timeTemp, bounds);
  }


  if (ex->flags & EX_FLAG_DONE) {
    RGBColorType red = {0x00, 0xFF, 0x00, 0x00}, old;
    Int16 yCoord=bounds->topLeft.y+(bounds->extent.y / 2);
    TNSetForeColorRGB(&red, &old);
    WinDrawLine(bounds->topLeft.x, yCoord, bounds->topLeft.x+bounds->extent.x, yCoord);
    TNSetForeColorRGB(&old, NULL);
  }

  MemHandleUnlock(mex);
}
Example #3
0
/*****************************************************************************
* Function: GadgetDrawTime
*
* Description: Show a time in the grid
*****************************************************************************/
void
GadgetDrawTime(TimeType begin, TimeType end, UInt8 day, RGBColorType *color, UInt16 courseID, UInt8 num_times, UInt8 pos)
{
  RectangleType rect;
  RGBColorType prevColor, inverted;

  // Sort out bogus requests, could be more intelligent, maybe later...
  if (day >= gGadgetDaysNum) return;

  // do nothing if Gadget has not yet been GadgetSet
  if (! gForm) return;
  if (! gGadgetID) return;

  GadgetTimeSetRect(&rect, begin, end, day, num_times, pos);


  TNSetForeColorRGB(color, &prevColor);
  WinDrawRectangle(&rect, 0);

  if ( (gPrefs.showTypes || gPrefs.showShortNames) && (rect.extent.y >= FntLineHeight())) {

    RGBColorType oldBack, oldText;

    // Get inverted color
    inverted.r = 255 - color->r;
    inverted.g = 255 - color->g;
    inverted.b = 255 - color->b;

    RctSetRectangle(&rect, rect.topLeft.x+2, rect.topLeft.y, rect.extent.x-4, rect.extent.y);

    TNSetTextColorRGB(&inverted, &oldText);
    TNSetBackColorRGB(color, &oldBack);

    if (gPrefs.showTypes) {
      MemHandle shortName=MemHandleNew(1);;
      CourseTypeGetShortByCourseID(&shortName, courseID);
      TNDrawCharsToFitWidth((Char *)MemHandleLock(shortName), &rect);
      MemHandleUnlock(shortName);
      MemHandleFree(shortName);
    } else if (gPrefs.showShortNames) {
      MemHandle courseName=MemHandleNew(1);
      CourseGetName(courseID, &courseName, false);

      TNDrawCharsToFitWidth((Char *)MemHandleLock(courseName), &rect);

      MemHandleUnlock(courseName);
      MemHandleFree(courseName);
    }

    TNSetBackColorRGB(&oldBack, NULL);
    TNSetTextColorRGB(&oldText, NULL);
  }

  TNSetForeColorRGB(&prevColor, NULL);
}
Example #4
0
// Equivalent of "at".
static void put_char_at(Short row, Short col, Char ch, Boolean bold)
{
  Short cheat, vcheat = DunTopY + (itsy_on ? 0 : 0);//center the map vertically
  RectangleType r;
  Short vc_w = itsy_on ? visible_char_w_itsy : visible_char_w;
  Short vc_h = itsy_on ? visible_char_h_itsy : visible_char_h;

  RctSetRectangle(&r, col * vc_w, row*vc_h+vcheat, vc_w, vc_h);

  if (!my_prefs.black_bg || IsColor)
    WinEraseRectangle(&r, 0);
  else
    WinDrawRectangle(&r, 0);
    
  // calculate pixel position of "row, col" and put char there
  cheat = vc_w - FntCharWidth(ch); // center the variable width characters

  if (cheat <= 1)   cheat = 0;
  else              cheat /= 2;

  if (ch != ' ') {

#ifdef I_AM_COLOR
    //  if (IsColor) {
    //    WinSetTextColor(get_color(ch, col+visible_x, row+visible_y));
    //  }
#endif

    if (!itsy_on && (ch== 'g' || ch== 'j' || ch== 'p' ||ch == 'q' ||ch == 'y'))
      vcheat--; // unfortunately, letters with dangling bits are a pain.
    
    if (!my_prefs.black_bg || IsColor)
      WinDrawChars(&ch, 1, col * vc_w + cheat, row * vc_h+vcheat);
    else
      WinDrawInvertedChars(&ch, 1, col * vc_w + cheat, row * vc_h+vcheat);

    if (bold)  WinInvertRectangle(&r, 0); /* 0 for square corners */
  }
  terminal[row][col] = ch;

}
Example #5
0
void displayNextIndicate( int index )
{
	FormPtr form;
	RectangleType rect;
	
	form = FrmGetActiveForm();
    
    rect.topLeft.x = INDICATE_LEFT + INDICATE_WIDTH * (index-1);
	rect.topLeft.y = INDICATE_TOP;
	rect.extent.x = INDICATE_WIDTH;
	rect.extent.y = INDICATE_HEIGHT;
	
    if (gbVgaExists) {
        rect.topLeft.x += rect.topLeft.x / 2;
        rect.topLeft.y += rect.topLeft.y / 2;
        rect.extent.x += rect.extent.x / 2 + 1;
        rect.extent.y += rect.extent.y / 2;
    }
    
	WinDrawRectangle( &rect, 0 );
	return;
}