示例#1
1
void WIN32_Console() {
	AllocConsole();
	SetConsoleTitle("DOSBox Debugger");
	ResizeConsole(GetStdHandle(STD_OUTPUT_HANDLE),80,50);
}
示例#2
1
bool ConsoleOverlayWindow::Create(DWORD consoleWindowThreadId)
{
	_hWndConsole = ::GetConsoleWindow();
	_consoleWindowThreadId = consoleWindowThreadId;

	// create the overlay window
	_hWndOverlay = CreateOverlayWindow();
	if (!_hWndOverlay)
		return false;

	// create the selection view window
	if (!_selectionView.Create(_hWndConsole, _hWndOverlay))
		return false;

	// create the tooltip for displaying the console's size while resizing
	if (!_sizeTooltip.Create(_hWndOverlay))
		debug_print("ConsoleOverlayWindow::Create - _sizeTooltip.Create failed, err=%#x\n", ::GetLastError());

	ReOpenConsoleHandles();

	SetupWinEventHooks();

	// place the overlay window directly above the console window
	AdjustOverlayPosition();
	AdjustOverlayZOrder();

	// register for OnSizeChanged notification 
	_resizeOperation.OnSizeChanged([this]() 
	{
		auto changed = ResizeConsole(_resizeOperation.GetRectangle());

		// while the resize operation continues
		if (_resizeOperation.IsActive())
		{
			// update the tooltip to display the current size of the console
			if (changed)
				UpdateSizeTooltipText();
		}
		// when the resize operation finished
		else
		{
			// hide the tooltip and adjust the overlay position for the final size of the console
			_sizeTooltip.Show(false);
			AdjustOverlayPosition();
		}
	});

	// HACK: without this the console's WinEvents are arriving with a delay. it is especially 
	// noticeable when scrolling the console while there is a selection showing.
	// experiments have shown that events are arriving just fine for other applications that
	// are not actually attached to the console.
	// TODO: find out why.
	::SetTimer(NULL, 0, 10, [](HWND, UINT, UINT_PTR, DWORD){
		// an empty timer handler also does the trick.
		// it seems that just by setting a timer, the WinEvents arriving without a delay.
		//::PostMessage(::GetConsoleWindow(), WM_NULL, 0, 0);
		//::PostThreadMessage(::GetCurrentThreadId(), WM_NULL, 0, 0);
	});

	return true;
}
示例#3
0
void textmode(int mode) {
	int fs = mode & FULLSCREEN;
	mode = mode & (~FULLSCREEN);
	if (mode == C80) {
		thData.width = 80;
		thData.height = 25;
		ResizeConsole(thData.output, 80, 25, 25);
	}
	else if (mode == C4350) {
		thData.width = 80;
		thData.height = 50;
		ResizeConsole(thData.output, 80, 50, 50);
	}
	else if (mode == LASTMODE) {
		textmode(thData.lastmode);
	};
};
示例#4
0
void CFrame::OnManagerResize(wxAuiManagerEvent& event)
{
	if (!g_pCodeWindow && m_LogWindow &&
			m_Mgr->GetPane(_T("Pane 1")).IsShown() &&
			!m_Mgr->GetPane(_T("Pane 1")).IsFloating())
	{
		m_LogWindow->x = m_Mgr->GetPane(_T("Pane 1")).rect.GetWidth();
		m_LogWindow->y = m_Mgr->GetPane(_T("Pane 1")).rect.GetHeight();
		m_LogWindow->winpos = m_Mgr->GetPane(_T("Pane 1")).dock_direction;
	}
	event.Skip();
	ResizeConsole();
}
示例#5
0
文件: Log.cpp 项目: FaceHunter/hAPI
bool Log::Init(const char* file, LogLevel logLevel)
{
	fileStream = fopen(file, "wb");

	if (fileStream == NULL)
	{
		return false;
	}

	enabled = true;

	CreateConsole("hAPI - Debug");
	ResizeConsole(80, 32766);

	Log::logLevel = logLevel;

	return true;
}
示例#6
0
int FolderTree::ProcessKey(int Key)
{
	if (Key>=KEY_ALT_BASE+0x01 && Key<=KEY_ALT_BASE+65535)
		Key=Lower(Key-KEY_ALT_BASE);
	else if (Key>=KEY_RALT_BASE+0x01 && Key<=KEY_RALT_BASE+65535)
		Key=Lower(Key-KEY_RALT_BASE);

	switch (Key)
	{
		case KEY_F1:
		{
			Help Hlp(L"FindFolder");
		}
		break;
		case KEY_ESC:
		case KEY_F10:
			FrameManager->DeleteFrame();
			SetExitCode(XC_MODIFIED);
			break;
		case KEY_NUMENTER:
		case KEY_ENTER:
			Tree->GetCurDir(strNewFolder);

			if (apiGetFileAttributes(strNewFolder)!=INVALID_FILE_ATTRIBUTES)
			{
				FrameManager->DeleteFrame();
				SetExitCode(XC_MODIFIED);
			}
			else
			{
				Tree->ProcessKey(KEY_ENTER);
				DrawEdit();
			}

			break;
		case KEY_F5:
			IsFullScreen=!IsFullScreen;
			ResizeConsole();
			return TRUE;
		case KEY_CTRLR:		case KEY_RCTRLR:
		case KEY_F2:
			Tree->ProcessKey(KEY_CTRLR);
			DrawEdit();
			break;
		case KEY_CTRLNUMENTER:       case KEY_RCTRLNUMENTER:
		case KEY_CTRLSHIFTNUMENTER:  case KEY_RCTRLSHIFTNUMENTER:
		case KEY_CTRLENTER:          case KEY_RCTRLENTER:
		case KEY_CTRLSHIFTENTER:     case KEY_RCTRLSHIFTENTER:
		{
			string strName;
			FindEdit->GetString(strName);
			Tree->FindPartName(strName,TRUE,Key==KEY_CTRLSHIFTENTER||Key==KEY_RCTRLSHIFTENTER||Key == KEY_CTRLSHIFTNUMENTER||Key == KEY_RCTRLSHIFTNUMENTER?-1:1,1);
			DrawEdit();
		}
		break;
		case KEY_UP:
		case KEY_NUMPAD8:
		case KEY_DOWN:
		case KEY_NUMPAD2:
		case KEY_PGUP:
		case KEY_NUMPAD9:
		case KEY_PGDN:
		case KEY_NUMPAD3:
		case KEY_HOME:
		case KEY_NUMPAD7:
		case KEY_END:
		case KEY_NUMPAD1:
		case KEY_MSWHEEL_UP:
		case(KEY_MSWHEEL_UP | KEY_ALT):
		case(KEY_MSWHEEL_UP | KEY_RALT):
		case KEY_MSWHEEL_DOWN:
		case(KEY_MSWHEEL_DOWN | KEY_ALT):
		case(KEY_MSWHEEL_DOWN | KEY_RALT):
			FindEdit->SetString(L"");
			Tree->ProcessKey(Key);
			DrawEdit();
			break;
		default:

			if (Key == KEY_ADD || Key == KEY_SUBTRACT) // OFM: Gray+/Gray- navigation
			{
				Tree->ProcessKey(Key);
				DrawEdit();
				break;
			}

			/*
			      else
			      {
			        if((Key&(~KEY_CTRLMASK)) == KEY_ADD)
			          Key='+';
			        else if((Key&(~KEY_CTRLMASK)) == KEY_SUBTRACT)
			          Key='-';
			      }
			*/
			if (FindEdit->ProcessKey(Key))
			{
				string strName;
				FindEdit->GetString(strName);

				if (Tree->FindPartName(strName,FALSE,1,1))
					strLastName = strName;
				else
				{
					FindEdit->SetString(strLastName);
					strName = strLastName;
				}

				DrawEdit();
			}

			break;
	}

	return TRUE;
}
示例#7
0
void CFrame::OnAllowNotebookDnD(wxAuiNotebookEvent& event)
{
	event.Skip();
	event.Allow();
	ResizeConsole();
}
示例#8
0
void CFrame::OnFloatingPageSize(wxSizeEvent& event)
{
	event.Skip();
	ResizeConsole();
}
示例#9
0
void HMenu::ProcessSubMenu(MenuDataEx *Data,int DataCount,
                           const wchar_t *SubMenuHelp,int X,int Y,int &Position)
{
	if (SubMenu)
		delete SubMenu;

	Position=-1;
	SubMenu=new VMenu(L"",Data,DataCount);
	SubMenu->SetFlags(VMENU_NOTCHANGE);
	SubMenu->SetBoxType(SHORT_DOUBLE_BOX);
	SubMenu->SetFlags(VMENU_WRAPMODE);
	SubMenu->SetHelp(SubMenuHelp);
	SubMenu->SetPosition(X,Y,0,0);
	SubMenu->Show();

	while (!SubMenu->Done() && !CloseFARMenu)
	{
		INPUT_RECORD rec;
		int Key;
		Key=GetInputRecord(&rec);

		if (Key==KEY_CONSOLE_BUFFER_RESIZE)
		{
			LockScreen LckScr;
			ResizeConsole();
			Show();
			SubMenu->Hide();
			SubMenu->Show();
		}
		else if (rec.EventType==MOUSE_EVENT)
		{
			if (rec.Event.MouseEvent.dwMousePosition.Y==Y1)
				if (ProcessMouse(&rec.Event.MouseEvent))
				{
					delete SubMenu;
					SubMenu=nullptr;
					return;
				}
			if(Key == KEY_MSWHEEL_UP || Key == KEY_MSWHEEL_DOWN || Key == KEY_MSWHEEL_RIGHT || Key == KEY_MSWHEEL_LEFT)
			{
				SubMenu->ProcessKey(Key);
			}
			else
			{
				SubMenu->ProcessMouse(&rec.Event.MouseEvent);
			}
		}
		else
		{
			if (Key == KEY_LEFT || Key == KEY_RIGHT ||Key == KEY_TAB ||
			        Key == KEY_NUMPAD4 || Key == KEY_NUMPAD6 ||
			        Key == KEY_MSWHEEL_LEFT || Key == KEY_MSWHEEL_RIGHT)
			{
				delete SubMenu;
				SubMenu=nullptr;
				ProcessKey(Key);
				ProcessKey(KEY_ENTER);
				return;
			}

			SubMenu->ProcessKey(Key);
		}
	}

	Position=SubMenu->Modal::GetExitCode();
	delete SubMenu;
	SubMenu=nullptr;
}
示例#10
0
int FolderTree::ProcessKey(const Manager::Key& Key)
{
	int LocalKey=Key.FarKey();
	if (LocalKey>=KEY_ALT_BASE+0x01 && LocalKey<=KEY_ALT_BASE+65535)
		LocalKey=ToLower(LocalKey-KEY_ALT_BASE);
	else if (LocalKey>=KEY_RALT_BASE+0x01 && LocalKey<=KEY_RALT_BASE+65535)
		LocalKey=ToLower(LocalKey-KEY_RALT_BASE);

	switch (LocalKey)
	{
		case KEY_F1:
		{
			Help::create(L"FindFolder");
		}
		break;
		case KEY_ESC:
		case KEY_F10:
			Global->WindowManager->DeleteWindow();
			SetExitCode(XC_MODIFIED);
			break;
		case KEY_NUMENTER:
		case KEY_ENTER:
			strNewFolder = Tree->GetCurDir();

			if (os::fs::exists(strNewFolder))
			{
				Global->WindowManager->DeleteWindow();
				SetExitCode(XC_MODIFIED);
			}
			else
			{
				Tree->ProcessKey(Manager::Key(KEY_ENTER));
				DrawEdit();
			}

			break;
		case KEY_F5:
			IsFullScreen=!IsFullScreen;
			ResizeConsole();
			Show();
			return TRUE;
		case KEY_CTRLR:		case KEY_RCTRLR:
		case KEY_F2:
			Tree->ProcessKey(Manager::Key(KEY_CTRLR));
			DrawEdit();
			break;
		case KEY_CTRLNUMENTER:       case KEY_RCTRLNUMENTER:
		case KEY_CTRLSHIFTNUMENTER:  case KEY_RCTRLSHIFTNUMENTER:
		case KEY_CTRLENTER:          case KEY_RCTRLENTER:
		case KEY_CTRLSHIFTENTER:     case KEY_RCTRLSHIFTENTER:
		{
			string strName;
			FindEdit->GetString(strName);
			Tree->FindPartName(strName, TRUE, LocalKey == KEY_CTRLSHIFTENTER || LocalKey == KEY_RCTRLSHIFTENTER || LocalKey == KEY_CTRLSHIFTNUMENTER || LocalKey == KEY_RCTRLSHIFTNUMENTER? -1 : 1);
			DrawEdit();
		}
		break;
		case KEY_UP:
		case KEY_NUMPAD8:
		case KEY_DOWN:
		case KEY_NUMPAD2:
		case KEY_PGUP:
		case KEY_NUMPAD9:
		case KEY_PGDN:
		case KEY_NUMPAD3:
		case KEY_HOME:
		case KEY_NUMPAD7:
		case KEY_END:
		case KEY_NUMPAD1:
		case KEY_MSWHEEL_UP:
		case(KEY_MSWHEEL_UP | KEY_ALT):
		case(KEY_MSWHEEL_UP | KEY_RALT):
		case KEY_MSWHEEL_DOWN:
		case(KEY_MSWHEEL_DOWN | KEY_ALT):
		case(KEY_MSWHEEL_DOWN | KEY_RALT):
			FindEdit->SetString(L"");
			Tree->ProcessKey(Key);
			DrawEdit();
			break;
		default:

			if (LocalKey == KEY_ADD || LocalKey == KEY_SUBTRACT) // OFM: Gray+/Gray- navigation
			{
				Tree->ProcessKey(Key);
				DrawEdit();
				break;
			}

			/*
			      else
			      {
			        if((Key&(~KEY_CTRLMASK)) == KEY_ADD)
			          Key='+';
			        else if((Key&(~KEY_CTRLMASK)) == KEY_SUBTRACT)
			          Key='-';
			      }
			*/
			if (FindEdit->ProcessKey(Key))
			{
				string strName;
				FindEdit->GetString(strName);

				if (Tree->FindPartName(strName, FALSE, 1))
					strLastName = strName;
				else
				{
					FindEdit->SetString(strLastName.data());
					strName = strLastName;
				}

				DrawEdit();
			}

			break;
	}

	return TRUE;
}
示例#11
0
static void ExitConio2(Conio2ThreadData *data) {
	ResizeConsole(data->output, data->origwidth, data->origheight, data->origdepth);
	SetConsoleMode(data->input, data->prevInputMode);
	SetConsoleMode(data->output, data->prevOutputMode);
	//	SetConsoleOutputCP();
};
示例#12
0
文件: hmenu.cpp 项目: CyberShadow/FAR
void HMenu::ProcessSubMenu(MenuDataEx *Data,int DataCount,
                           const wchar_t *SubMenuHelp,int X,int Y,int &Position)
{
	Position=-1;
	SubMenu=new VMenu2(L"",Data,DataCount);
	SubMenu->SetBoxType(SHORT_DOUBLE_BOX);
	SubMenu->SetFlags(VMENU_WRAPMODE);
	SubMenu->SetHelp(SubMenuHelp);
	SubMenu->SetPosition(X,Y,0,0);
	SubMenu->SetMacroMode(MACRO_MAINMENU);

	bool SendMouse=false;
	MOUSE_EVENT_RECORD MouseEvent;
	int SendKey=0;

	Position=SubMenu->RunEx([&](int Msg, void *param)->int
	{
		if(Msg!=DN_INPUT)
			return 0;

		INPUT_RECORD &rec=*static_cast<INPUT_RECORD*>(param);
		int Key=InputRecordToKey(&rec);

		if (Key==KEY_CONSOLE_BUFFER_RESIZE)
		{
			LockScreen LckScr;
			ResizeConsole();
			Show();
			return 1;
		}
		else if (rec.EventType==MOUSE_EVENT)
		{
			if (!TestMouse(&rec.Event.MouseEvent))
			{
				MouseEvent=rec.Event.MouseEvent;
				SendMouse=true;
				SubMenu->Close(-1);
				return 1;
			}
			if (rec.Event.MouseEvent.dwMousePosition.Y==Y1)
				return 1;
		}
		else
		{
			if (Key == KEY_LEFT || Key == KEY_RIGHT ||Key == KEY_TAB ||
			        Key == KEY_NUMPAD4 || Key == KEY_NUMPAD6 ||
			        Key == KEY_MSWHEEL_LEFT || Key == KEY_MSWHEEL_RIGHT)
			{
				SendKey=Key;
				SubMenu->Close(-1);
				return 1;
			}
		}
		return 0;
	});

	delete SubMenu;
	SubMenu=nullptr;

	if(SendMouse)
		ProcessMouse(&MouseEvent);
	if(SendKey)
	{
		ProcessKey(SendKey);
		ProcessKey(KEY_ENTER);
	}
}