示例#1
0
static void push(int item,int inout)
{
   switch(item)
   {
   case -1:
      break;
   case 5:
      RasterOp(zREPz);
      if (samecharges)
         InvertInsides(&tools[(item-5)/3].t->TB);
      else
         PushButton(&chargeR,inout);
      break;
   case 8:
   case 11:
   case 14:
   case 17:
   case 20:
      RasterOp(zREPz);
      InvertInsides(&tools[(item-5)/3].t->TB);
      break;
   case 25:
   case 26:
      RasterOp(zREPz);
      PushOrDoublePress(mainR[item],inout,item-25 == stopped);
      break;
   default:
      RasterOp(zREPz);
      PushButton(mainR[item],inout);
      break;
   }
   if (item == 4)
      ExtraHilite(mainR[item],inout);
}
INLINE static Bit32u ModeOperation(Bit8u val) {
	Bit32u full;
	switch (vga.config.write_mode) {
	case 0x00:
		// Write Mode 0: In this mode, the host data is first rotated as per the Rotate Count field, then the Enable Set/Reset mechanism selects data from this or the Set/Reset field. Then the selected Logical Operation is performed on the resulting data and the data in the latch register. Then the Bit Mask field is used to select which bits come from the resulting data and which come from the latch register. Finally, only the bit planes enabled by the Memory Plane Write Enable field are written to memory. 
		val=((val >> vga.config.data_rotate) | (val << (8-vga.config.data_rotate)));
		full=ExpandTable[val];
		full=(full & vga.config.full_not_enable_set_reset) | vga.config.full_enable_and_set_reset; 
		full=RasterOp(full,vga.config.full_bit_mask);
		break;
	case 0x01:
		// Write Mode 1: In this mode, data is transferred directly from the 32 bit latch register to display memory, affected only by the Memory Plane Write Enable field. The host data is not used in this mode. 
		full=vga.latch.d;
		break;
	case 0x02:
		//Write Mode 2: In this mode, the bits 3-0 of the host data are replicated across all 8 bits of their respective planes. Then the selected Logical Operation is performed on the resulting data and the data in the latch register. Then the Bit Mask field is used to select which bits come from the resulting data and which come from the latch register. Finally, only the bit planes enabled by the Memory Plane Write Enable field are written to memory. 
		full=RasterOp(FillTable[val&0xF],vga.config.full_bit_mask);
		break;
	case 0x03:
		// Write Mode 3: In this mode, the data in the Set/Reset field is used as if the Enable Set/Reset field were set to 1111b. Then the host data is first rotated as per the Rotate Count field, then logical ANDed with the value of the Bit Mask field. The resulting value is used on the data obtained from the Set/Reset field in the same way that the Bit Mask field would ordinarily be used. to select which bits come from the expansion of the Set/Reset field and which come from the latch register. Finally, only the bit planes enabled by the Memory Plane Write Enable field are written to memory.
		full=RasterOp(vga.config.full_set_reset,ExpandTable[val] & vga.config.full_bit_mask);
		break;
	default:
		LOG(LOG_VGAMISC,LOG_NORMAL)("VGA:Unsupported write mode %d",vga.config.write_mode);
	}
	return full;
}
示例#3
0
文件: STAMP.C 项目: mrchurrisky/chaos
void framelines(rect * R)
{
	RasterOp(zXORz);
	PenColor(WHITE);
	MoveTo(sssR->Xmin, sssR->Ymin);
	LineTo(R->Xmin, R->Ymin);
	MoveTo(sssR->Xmax, sssR->Ymin);
	LineTo(R->Xmax, R->Ymin);
	MoveTo(sssR->Xmin, sssR->Ymax);
	LineTo(R->Xmin, R->Ymax);
	MoveTo(sssR->Xmax, sssR->Ymax);
	LineTo(R->Xmax, R->Ymax);
	RasterOp(zREPz);
}
示例#4
0
void SetStopSign(void)
{
   RasterOp(zREPz);
   /* Just paint two buttons... */
   PaintRadioButton(&runstopstepR[0],!stopped,!stopped,RSS[0]);
   PaintRadioButton(&runstopstepR[1],stopped,stopped,RSS[1]);
   current_main_item = -1;
}
示例#5
0
void drawChargeButton(void)
{
   /* This one is a bit sneaky. We might not have a single charge... */
   int i;

   HideCursor();
   set_samecharges();
   if (samecharges)
   {
      if (charge_thing == DIFFERENT)
      {
         RasterOp(zREPz);
         PenColor(BLUE);
         PaintRect(&chargeR);
         tools[0].t->value = chargeunit;
   		CreateNumberToolTitle(tools[0].t, tools[0].text,WHITE,BLUE);
         mainR[5] = &tools[0].t->TB.nR;
         mainR[6] = &tools[0].t->mR;
         mainR[7] = &tools[0].t->pR;
      }
      else
         drawone(&ChargeTool,chargeunit);
      charge_thing = SAME;
   }
   else
   {
      if (charge_thing == SAME)
      {
         rect R = chargeR;
         RasterOp(zREPz);
         InsetRect(&R,-2,0);
         PenColor(BLUE);
         PaintRect(&R);
         PaintRadioButton(&chargeR,false,false,chargemsg);
         for(i=0;i<3;i++)
            mainR[i+5] = &chargeR;
      }
      charge_thing = DIFFERENT;
   }
   ShowCursor();
}
示例#6
0
void PaintQuitButton(int inout)
{
	rect R = QuitButtonR;
	int cx, cy;

	HideCursor();
   RasterOp(zREPz);
	Centers(&R, &cx, &cy);
	PaintRadioButton(&R, inout, inout, "");
	TextAlign(alignCenter, alignTop);
	PenColor(WHITE);
	BackColor(inout ? RED : DARKGRAY);
	MoveTo(cx, R.Ymin + 4);
	DrawString("Alt-X");
	MoveTo(cx, R.Ymin + FontHeight + 4);
	DrawString("to Exit");
	PushButton(&R, inout);
	ExtraHilite(&R, inout);
	if (inout)
		DoublePress(&R, true, RED);
	ShowCursor();
}
示例#7
0
static void drawone(numbertool *t,double d)
{
   t->value = d;
   RasterOp(zREPz);
	PaintNumberBoxEntryPrecision(&t->TB, t->value, t->type, t->p1, t->p2);
}
示例#8
0
void setupcontrols(void)
{
	rect R;
	int i;

   RasterOp(zREPz);

	ChargeTool.type = GS_INTEGER;
	ChargeTool.value = chargeunit;
   ChargeTool.lo = -500;
   ChargeTool.hi = 500;

   current_main_item = -1;
	CapRadTool.type = GS_UNSIGNED;
	CapRadTool.value = xsection;
   CapRadTool.lo = 0;
   CapRadTool.hi = 20;


	RadiusTool.type = GS_UNSIGNED;
	RadiusTool.value = magnetradius;
   RadiusTool.lo = 1;
   RadiusTool.hi = 60;

	PullTool.type = GS_INTEGER;
	PullTool.value = centerpull;
   PullTool.lo = -500;
   PullTool.hi = 500;

	FreqTool.type = GS_UNSIGNED;
	FreqTool.value = freq;
   FreqTool.lo = 2;
   FreqTool.hi = 10000;

	FricTool.type = GS_FLOAT;
	FricTool.value = friction;
	FricTool.p1 = 4;
	FricTool.p2 = 2;
   FricTool.lo = 0;
   FricTool.hi = 500;

	R.Xmin = sR.Xmax / 4;
	R.Ymin = 0;
	R.Xmax = sR.Xmax;
	R.Ymax = sR.Ymax;

	displayRect = R;
	R.Xmin = 0;
	R.Ymin = 0;
	R.Xmax = sR.Xmax / 4 - 9;
	R.Ymax = sR.Ymax;

	controlRect = menuRect = R;

	PenColor(BLUE);
	PaintRect(&R);
	PenColor(WHITE);
	FrameRect(&R);



	R.Xmin = controlRect.Xmin + 4;
	R.Xmax = controlRect.Xmax - 4;
	R.Ymin = controlRect.Ymin + 4;
	R.Ymax = R.Ymin + FontHeight + 4;
	main_items = 0;

	for (i = 0; i < 4; i++)
	{
		buttonR[i] = R;
		mainR[main_items++] = &buttonR[i];

		PaintRadioButton(&R, false, false, msgs[i]);
		OffsetRect(&R, 0, 3 * FontHeight / 2);
	}

	R.Ymax += FontHeight;
	QuitButtonR = R;
	PaintQuitButton(false);
	mainR[main_items++] = &QuitButtonR;

	R.Ymin = R.Ymax + FontHeight;
	R.Ymax = R.Ymin + FontHeight + 4;
	R.Xmin = StringWidth("Charge") + 8;

	for (i = 0; i < 6; i++)
	{
		tools[i].t->tR = R;
		CreateNumberToolTitle(tools[i].t, tools[i].text,WHITE,BLUE);
		mainR[main_items++] = &tools[i].t->TB.nR;
		mainR[main_items++] = &tools[i].t->mR;
		mainR[main_items++] = &tools[i].t->pR;


      /* The charge rect is sneaky. */
      if (i == 0)
      {
         chargeR = R;
         chargeR.Xmin = QuitButtonR.Xmin;
         charge_thing = SAME;
         drawChargeButton();
      }
		OffsetRect(&R, 0, 3 * FontHeight / 2);
	}

   /* Now let's work on the bottom ones. */
   R.Ymin = sR.Ymax - 3*(3*FontHeight/2);
   R.Ymax = R.Ymin + FontHeight + 4;
   R.Xmin = 4;
   randomize_posR = R;
   PaintRadioButton(&R,false,false,randomposmsg);
   mainR[main_items++] = &randomize_posR;

   OffsetRect(&R,0,3*FontHeight/2);
   randomize_chargeR = R;
   PaintRadioButton(&R,false,false,randomchargemsg);
   mainR[main_items++] = &randomize_chargeR;

   OffsetRect(&R,0,3*FontHeight/2);
   CreateRadioPanel(&R,RSS,runstopstepR,3,stopped);
   for(i=0;i<3;i++)
      mainR[main_items++] = &runstopstepR[i];



}