コード例 #1
0
ファイル: main.c プロジェクト: ABratovic/open-watcom-v2
void AskExit()
{
	if(CheckIfModified()==TRUE)
	{
		SetColor(LIGHTWHITE);
		SetBackColor(RED);
		OpenWindow(10,24,5,32);
		SetColor(YELLOW);
		Print_At(11,29,"Apply Changes on Exit?");
		SetColor(BLUE);
		SetBackColor(WHITE);
		SetBlink(ON);
		Print_At(13,32," <Yes> ");
		Print_At(13,42," <No> ");
		SetBlink(OFF);
		GetKey();
	}
	CloseAllWindows();
	VideoReset();
	if(keycode!=ESC && keychar!='n' && keychar!='N')
		if(WriteHeader(&id32)!=0)
		{
			printf("%s could not write to file\n" ,errstr);
			exit(1);
		}
	CloseFile();
	exit(0);
}
コード例 #2
0
ファイル: gui.cpp プロジェクト: teacoffee2017/OpenTomb
gui_ProgressBar::gui_ProgressBar()
{
    // Set up some defaults.
    Visible   = false;
    Alternate = false;
    Invert    = false;
    Vertical  = false;
    Forced    = false;

    // Initialize parameters.
    // By default, bar is initialized with TR5-like health bar properties.
    SetPosition(GUI_ANCHOR_HOR_LEFT, 20, GUI_ANCHOR_VERT_TOP, 20);
    SetSize(250, 25, 3);
    SetColor(BASE_MAIN, 255, 50, 50, 150);
    SetColor(BASE_FADE, 100, 255, 50, 150);
    SetColor(ALT_MAIN, 255, 180, 0, 220);
    SetColor(ALT_FADE, 255, 255, 0, 220);
    SetColor(BACK_MAIN, 0, 0, 0, 160);
    SetColor(BACK_FADE, 60, 60, 60, 130);
    SetColor(BORDER_MAIN, 200, 200, 200, 50);
    SetColor(BORDER_FADE, 80, 80, 80, 100);
    SetValues(1000, 300);
    SetBlink(300);
    SetExtrude(true, 100);
    SetAutoshow(true, 5000, true, 1000);
}
コード例 #3
0
ファイル: main.c プロジェクト: ABratovic/open-watcom-v2
void DiskError()
{
	SetColor(LIGHTWHITE);
	SetBackColor(RED);
	OpenWindow(10,24,5,32);
	SetColor(YELLOW);
	Print_At(11,28,"Error Reading/Writing!");
	SetColor(BLUE);
	SetBackColor(WHITE);
	SetBlink(ON);
	Print_At(13,26," Press a key to continue... ");
	SetBlink(OFF);
	GetKey();
	CloseWindow();
	keychar=keycode=0;
}
コード例 #4
0
ファイル: iface.c プロジェクト: ABratovic/open-watcom-v2
unsigned long Input(int y, int x, int l, unsigned long old)
{
	int n;
	char c;
	char buf[80];

	Print_At(y,x-1,"<");
	Print_At(y,x+l,">");
	for(n=0; n<l; n++) Print_At(y,x+n,".");

	for(n=0; n<l; n++)
	{
l0:		SetBlink(1); Print_At(y,x+n,"Û"); SetBlink(0);

		do
		{	GetKey(); c=toupper(keychar);
			if(c=='X') c='x';
			if(c==0x1B) goto l1;
			if(c==0x0D) goto l1;
			if(c==0x08) break;
		} while(c<0x20);

		if(c==0x08)
		{
			if(n>0)
			{
				Print_At(y,x+n,".");
				n--;
				goto l0;
			} else goto l0;
		}
		buf[n]=c;
		Print_At(y,x+n,"%c",c);
	}

l1:	buf[n]=0;

	Print_At(y,x-1," ");
	Print_At(y,x+l," ");
	for(n=0; n<l; n++) Print_At(y,x+n," ");

	keychar=keycode=0;
	if(c==0x1B) return(old);
	if(strlen(buf)==0 && c==0x0D) return(old);
	if(hexmode==0) return((unsigned long)strtol(buf,NULL,10));
	else return((unsigned long)strtol(buf,NULL,16));
}
コード例 #5
0
ファイル: Console.cpp プロジェクト: vshymanskyy/TurtlOS
void
Console::ResetAttributes()
{
	SetBold(false);
	SetBlink(false);
	SetReverseVideo(false);
	Background(BLACK);
	Foreground(WHITE);
}
コード例 #6
0
ファイル: main.c プロジェクト: ABratovic/open-watcom-v2
void CheckIfLocked()
{
	if((id32.dos32a_misc2&0x40)==0x40)
	{
		SetColor(LIGHTWHITE);
		SetBackColor(RED);
		OpenWindow(10,24,5,32);
		SetColor(YELLOW);
		Print_At(11,28,"Configuration is Locked!");
		SetColor(BLUE);
		SetBackColor(WHITE);
		SetBlink(ON);
		Print_At(13,27," Press any key to exit... ");
		SetBlink(OFF);
		GetKey();
		CloseAllWindows();
		VideoReset();
		exit(0);
	}
}
コード例 #7
0
ファイル: main.c プロジェクト: ABratovic/open-watcom-v2
void CheckVersion()
{
	if(id32.dos32a_version==0)
		return;
	if(id32.dos32a_version!=version2)
	{
		SetColor(LIGHTWHITE);
		SetBackColor(RED);
		OpenWindow(10,18,8,44);
		SetColor(LIGHTWHITE);
		Print_At(11,20,"WARNING:");
		SetColor(YELLOW);
		Print_At(11,29,"DOS Extender's version does not");
		Print_At(12,20,"match the version of the Setup Program!!");
		SetColor(BLUE);
		SetBackColor(WHITE);
		SetBlink(ON);
		Print_At(15,27," Press any key to exit... ");
		SetBlink(OFF);
		GetKey();
		CloseWindow();
		DiscardExit();
	}
}
コード例 #8
0
ファイル: iface.c プロジェクト: ABratovic/open-watcom-v2
char *InputString(int y, int x, int l, char *tmp)
{
	int n,m, xx;
	char c;
	static char buf[80];
	char *defbuf[] = {
		"DEFAULT.D32",
		"DOS4GW.D32",
		"FAILSAFE.D32",
		"MAXIMUM.D32",
		"MINIMUM.D32",
		"PMODEW.D32",
		"STANDARD.D32",
		"VERBOSE.D32",
		"CUSTOM.D32",
		""
	};

	m=-1; xx=x;
	if(tmp!=NULL) strcpy(buf,tmp);
l8:	Print_At(y,x-1,"<");
	Print_At(y,x+l,">");
	for(n=0; n<l; n++) Print_At(y,x+n,".");
	for(n=0; buf[n]!=NULL; n++) { SetPos(y,x+n); PrintC(buf[n]); }

	for(; n<l; n++)
	{
l0:		SetBlink(1); Print_At(y,x+n,"Û"); SetBlink(0);

		do
		{	GetKey();
			c=toupper(keychar);
			if(c==0x1B) goto l1;
			if(c==0x0D) goto l1;
			if(c==0x08) break;
			if(keycode==UP)   { m++; if(m>8) m=0; x=xx; strcpy(buf,defbuf[m]); goto l8; }
			if(keycode==DOWN) { m--; if(m<0) m=8; x=xx; strcpy(buf,defbuf[m]); goto l8; }
		} while(c<0x20);

		if(c==0x08)
		{
		  if(n>0)
		  {
			Print_At(y,x+n,".");
			n--;
			goto l0;
		  } else goto l0;
		}
		buf[n]=c;
		Print_At(y,x+n,"%c",c);
	}

l1:	buf[n]=0;

	Print_At(y,x-1," ");
	Print_At(y,x+l," ");
	for(n=0; n<l; n++) Print_At(y,x+n," ");

	keychar=keycode=0;
	if(c==0x1B) return(NULL);
	else if(strlen(buf)==0) return(NULL);
	else return(buf);
}
コード例 #9
0
ファイル: TenKey.cpp プロジェクト: japgo/mygithub
int CTenkey::GetTenKeyNo(void)
{
	int retKey    = NO_KEY;
	int curKeyVal = GetKeyPadNo(); 

	Display();
	SetSegData(m_segment.hDigit, m_segment.mDigit, m_segment.lDigit);

	switch(m_fsmKey.GetStatus())
	{
	case MC_INIT:
		m_nRetValue = 0;
		m_segment.hDigit = m_segment.mDigit = m_segment.lDigit = 0;
		m_fsmKey.SetStatus(ST_KEY_IN);
		break;

	case ST_KEY_IN:
		if(NO_KEY == curKeyVal || m_fsmBlink.IsRun())
		{
			m_fsmKey.RstDelay();
			break;
		}

		if(SET_KEY == curKeyVal)
		{
			if(m_fsmKey.DelaymS(100))
			{
				SetBlink(300, 1);
				retKey = m_nRetValue = GetSegNo();
				m_fsmKey.SetStatus(ST_KEY_OFF);
				m_bNeedRst = TRUE;
			}
		}
		else if(CLR_KEY == curKeyVal)
		{
			if(m_fsmKey.DelaymS(100))
			{
				SetBlink(300, 1);
				retKey = m_nRetValue = GetSegNo() + 1000;
				m_fsmKey.SetStatus(ST_KEY_OFF);
				m_bNeedRst = TRUE;
			}
		}
		else if(m_fsmKey.DelaymS(50))
		{
			m_segment.hDigit = m_segment.mDigit;
			m_segment.mDigit = m_segment.lDigit;
			m_segment.lDigit = curKeyVal;

			if(m_bNeedRst)
				m_segment.hDigit = m_segment.mDigit = 0;

			m_fsmKey.SetStatus(ST_KEY_OFF);
			m_bNeedRst = FALSE;
		}
		break;

	case ST_KEY_OFF:
		if(NO_KEY != curKeyVal)
			m_fsmKey.RstDelay();
		else if(m_fsmKey.DelaymS(100))
			m_fsmKey.SetStatus(ST_KEY_IN);
		break;

	case ST_KEY_DISABLE:
		m_nRetValue = 0;
		m_segment.hDigit = m_segment.mDigit = m_segment.lDigit = 0xf;
		m_fsmKey.SetStatus(MC_STOP);
		break;
	}

	return (retKey);
}//------------------------------------------------------------------
コード例 #10
0
ファイル: Console.cpp プロジェクト: vshymanskyy/TurtlOS
/// @todo Check boundaries
bool
Console::AnsiEscFilter(const char c)
{
	if (_ansiBufferPos == 0 && c == (char)0x9B) {
		_ansiBufferPos = 2;
		return true;
	}else if (_ansiBufferPos == 0 && c == (char)0x1B) {
		_ansiBufferPos = 1;
		return true;
	}else if (_ansiBufferPos == 1) {
		if (c == '[') {
			_ansiBufferPos = 2;
			return true;
		} else {
			_ansiBufferPos = 0;
			return false;
		}
	}else if (_ansiBufferPos > 1) {
		if (isdigit(c) || c == ';') {
			_ansiBuffer[_ansiBufferPos++] = c;
		} else {
			_ansiBuffer[_ansiBufferPos] = '\0';
			_ansiBufferPos = 0;

			long params[10] = {0};
			const int parQty = AnsiEscParseParams(&_ansiBuffer[2], params);
			switch(c) {
				case 'c':	// Reset Device
					ResetAttributes();
					Erase(BOTH, false);
					break;
				case 'h':
					if (parQty == 1 && params[0] == 7)
						SetLineWrap(true);
					break;
				case 'l':
					if (parQty == 1 && params[0] == 7)
						SetLineWrap(false);
					break;
				case 'A':	// [nA Cursor Up
					if (!parQty)
						params[0] = 1;
					//
					_cursor -= _canvas.Size().x*params[0];
					UpdateCursor();
					break;
				case 'B':	// [nB Cursor Down
					if (!parQty)
						params[0] = 1;
					//
					_cursor += _canvas.Size().x*params[0];
					UpdateCursor();
					break;
				case 'C':	// [nC Cursor Forward
					if (!parQty)
						params[0] = 1;
					//
					_cursor += params[0];
					UpdateCursor();
					break;
				case 'D':	// [nD Cursor Backward
					if (!parQty)
						params[0] = 1;
					//
					_cursor -= params[0];
					UpdateCursor();
					break;
				case 'H':	// [y;xH Cursor Home
				case 'f':	// [y;xf Force Cursor Position
					if (parQty < 2) {
						params[0] = 0;	// Y
						params[1] = 0;	// X
					}
					//
					_cursor = _canvas.Buffer() + _canvas.Size().x*params[0] + params[1];
					UpdateCursor();
					break;
				case 's':	// [s Save Cursor
					_ansiCursorStack.Push(_cursor);
					break;
				case 'u':	// [u Unsave Cursor
					_cursor = _ansiCursorStack.Pop();
					UpdateCursor();
					break;
				case 'J':	// [nJ
					if (parQty == 0)
						params[0] = 0;
					Erase(static_cast<EraseDirection>(params[0]), false);
					break;
				case 'K':	// [nK
					if (parQty == 0)
						params[0] = 0;
					Erase(static_cast<EraseDirection>(params[0]), true);
					break;
				case 'm':	// [p1;..;pNm
					if (!parQty) {
						ResetAttributes();
					} else {
						for(int i=0; i<parQty; ++i) {
							switch(params[i]) {
								case  0:	ResetAttributes();		break;
								case  1:	SetBold(true);			break;
								//case  2:	SetFaint(true);			break;
								//case  3:	SetItalic(true);		break;
								//case  4:	SetUnderline(true);		break;
								case  5:	SetBlink(true);			break;
								//case  6:	SetRapidBlink(true);	break;
								case  7:	SetReverseVideo(true);	break;
								//case  8:	SetInvisible(true);		break;
								//case 48:	SetSubscript(true);		break;
								//case 49:	SetSuperscript(true);	break;

								case 30:	Foreground(BLACK);	break;
								case 31:	Foreground(RED);	break;
								case 32:	Foreground(GREEN);	break;
								case 33:	Foreground(BROWN);	break;
								case 34:	Foreground(BLUE);	break;
								case 35:	Foreground(MAGENTA);break;
								case 36:	Foreground(CYAN);	break;
								case 37:	Foreground(WHITE);	break;
								case 90:	Foreground(GRAY);	break;
								case 91:	Foreground(RED_B);	break;
								case 92:	Foreground(LIME);	break;
								case 93:	Foreground(YELLOW);	break;
								case 94:	Foreground(BLUE_B);	break;
								case 95:	Foreground(MAGENTA_B);break;
								case 96:	Foreground(CYAN_B);	break;
								case 97:	Foreground(WHITE_B);break;

								case 40:	Background(BLACK);	break;
								case 41:	Background(RED);	break;
								case 42:	Background(GREEN);	break;
								case 43:	Background(BROWN);	break;
								case 44:	Background(BLUE);	break;
								case 45:	Background(MAGENTA);break;
								case 46:	Background(CYAN);	break;
								case 47:	Background(WHITE);	break;
								case 100:	Background(GRAY);	break;
								case 101:	Background(RED_B);	break;
								case 102:	Background(LIME);	break;
								case 103:	Background(YELLOW);	break;
								case 104:	Background(BLUE_B);	break;
								case 105:	Background(MAGENTA_B);break;
								case 106:	Background(CYAN_B);	break;
								case 107:	Background(WHITE_B);break;
							}
						}
					}
					break;
				default:		//the command was not recognized
					char* p = _ansiBuffer;
					while(*p)
						PutChar(*p++);
					break;
			}
		}
		return true;
	}
	return false;
}