Пример #1
0
CFrame::CFrame(wxFrame* parent,
		wxWindowID id,
		const wxString& title,
		const wxPoint& pos,
		const wxSize& size,
		bool _UseDebugger,
		bool _BatchMode,
		bool ShowLogWindow,
		long style)
	: CRenderFrame(parent, id, title, pos, size, style)
	, g_pCodeWindow(NULL), g_NetPlaySetupDiag(NULL), g_CheatsWindow(NULL)
	, m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
	, m_GameListCtrl(NULL), m_Panel(NULL)
	, m_RenderFrame(NULL), m_RenderParent(NULL)
	, m_LogWindow(NULL), m_LogConfigWindow(NULL)
	, m_FifoPlayerDlg(NULL), UseDebugger(_UseDebugger)
	, m_bBatchMode(_BatchMode), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false)
	, m_bGameLoading(false)
{
	for (int i = 0; i <= IDM_CODEWINDOW - IDM_LOGWINDOW; i++)
		bFloatWindow[i] = false;

	if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true;

	// Give it a console early to show potential messages from this onward
	ConsoleListener *Console = LogManager::GetInstance()->GetConsoleListener();
	if (SConfig::GetInstance().m_InterfaceConsole) Console->Open();

	// Start debugging maximized
	if (UseDebugger) this->Maximize(true);
	// Debugger class
	if (UseDebugger)
	{
		g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, this, IDM_CODEWINDOW);
		LoadIniPerspectives();
		g_pCodeWindow->Load();
	}

	// Create toolbar bitmaps
	InitBitmaps();

	// Give it a status bar
	SetStatusBar(CreateStatusBar(2, wxST_SIZEGRIP, ID_STATUSBAR));
	if (!SConfig::GetInstance().m_InterfaceStatusbar)
		GetStatusBar()->Hide();

	// Give it a menu bar
	CreateMenu();

	// ---------------
	// Main panel
	// This panel is the parent for rendering and it holds the gamelistctrl
	m_Panel = new CPanel(this, IDM_MPANEL);

	m_GameListCtrl = new CGameListCtrl(m_Panel, LIST_CTRL,
			wxDefaultPosition, wxDefaultSize,
			wxLC_REPORT | wxSUNKEN_BORDER | wxLC_ALIGN_LEFT);

	wxBoxSizer *sizerPanel = new wxBoxSizer(wxHORIZONTAL);
	sizerPanel->Add(m_GameListCtrl, 1, wxEXPAND | wxALL);
	m_Panel->SetSizer(sizerPanel);
	// ---------------

	// Manager
	m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE);

	m_Mgr->AddPane(m_Panel, wxAuiPaneInfo()
			.Name(_T("Pane 0")).Caption(_T("Pane 0")).PaneBorder(false)
			.CaptionVisible(false).Layer(0).Center().Show());
	if (!g_pCodeWindow)
		m_Mgr->AddPane(CreateEmptyNotebook(), wxAuiPaneInfo()
				.Name(_T("Pane 1")).Caption(_("Logging")).CaptionVisible(true)
				.Layer(0).FloatingSize(wxSize(600, 350)).CloseButton(true).Hide());
	AuiFullscreen = m_Mgr->SavePerspective();

	// Create toolbar
	RecreateToolbar();
	if (!SConfig::GetInstance().m_InterfaceToolbar) DoToggleToolbar(false);

	m_LogWindow = new CLogWindow(this, IDM_LOGWINDOW);
	m_LogWindow->Hide();
	m_LogWindow->Disable();

	g_TASInputDlg = new TASInputDlg(this);
	Movie::SetInputManip(TASManipFunction);

	State::SetOnAfterLoadCallback(OnAfterLoadCallback);

	// Setup perspectives
	if (g_pCodeWindow)
	{
		// Load perspective
		DoLoadPerspective();
	}
	else
	{
		if (SConfig::GetInstance().m_InterfaceLogWindow)
			ToggleLogWindow(true);
		if (SConfig::GetInstance().m_InterfaceLogConfigWindow)
			ToggleLogConfigWindow(true);
		if (SConfig::GetInstance().m_InterfaceConsole)
			ToggleConsole(true);
	}

	// Show window
	Show();

	// Commit
	m_Mgr->Update();

	#ifdef _WIN32
		SetToolTip(wxT(""));
		GetToolTip()->SetAutoPop(25000);
	#endif

	#if defined(HAVE_XRANDR) && HAVE_XRANDR
		m_XRRConfig = new X11Utils::XRRConfiguration(X11Utils::XDisplayFromHandle(GetHandle()),
				X11Utils::XWindowFromHandle(GetHandle()));
	#endif

	// -------------------------
	// Connect event handlers

	m_Mgr->Bind(wxEVT_AUI_RENDER, &CFrame::OnManagerResize, this);
	// ----------

	// Update controls
	UpdateGUI();
}
Пример #2
0
void NyqBench::OnLargeIcons(wxCommandEvent & e)
{
   RecreateToolbar(true);
}
Пример #3
0
NyqBench::NyqBench(wxWindow * parent)
:  wxFrame(NULL,
           wxID_ANY,
           wxEmptyString,
           wxDefaultPosition,
           wxDefaultSize,
           wxDEFAULT_FRAME_STYLE |
           wxMINIMIZE_BOX |
           wxMAXIMIZE_BOX |
           wxRESIZE_BORDER)
{
   mFindDlg = NULL;
   mRunning = false;
   mScriptBox = NULL;
   mOutputBox = NULL;
   mScript = NULL;
   mOutput = NULL;

   mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString);
   mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0);
   mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0);
   mLargeIcons = (gPrefs->Read(wxT("NyqBench/LargeIcons"), 0L) != 0);
   mSplitMode = gPrefs->Read(wxT("NyqBench/SplitMode"), wxSPLIT_VERTICAL);
   mShowCode = (gPrefs->Read(wxT("NyqBench/ShowScript"), true) != 0);
   mShowOutput = (gPrefs->Read(wxT("NyqBench/ShowOutput"), true) != 0);

   SetIcon(wxICON(AudacityLogo));
   SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
   ShuttleGui S(this, eIsCreating);
   PopulateOrExchange(S);
   wxMenuBar *bar = new wxMenuBar();

   wxMenu *menu = new wxMenu();
   menu->Append(wxID_NEW, wxT("&New\tCtrl+N"));
   menu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O"));
   menu->Append(wxID_SAVE, wxT("&Save...\tCtrl+S"));
   menu->Append(wxID_SAVEAS, wxT("Save &As...\tCtrl+Shift+S"));
   menu->AppendSeparator();
   menu->Append(wxID_REVERT_TO_SAVED, _T("&Revert to Saved"));
   menu->AppendSeparator();
   menu->AppendCheckItem(ID_AUTOLOAD, _T("Auto &Load Last File"))->Check(mAutoLoad);
   menu->AppendSeparator();
   menu->Append(wxID_CLOSE, wxT("&Close Window\tCtrl+W"));
   bar->Append(menu, wxT("&File"));

   menu = new wxMenu();
   menu->Append(wxID_UNDO, _("&Undo\tCtrl+Z"));
   menu->Append(wxID_REDO, _("&Redo\tCtrl+Y"));
   menu->AppendSeparator();
   menu->Append(wxID_CUT, _("Cu&t\tCtrl+X"));
   menu->Append(wxID_COPY, _("&Copy\tCtrl+C"));
   menu->Append(wxID_PASTE, _("&Paste\tCtrl+V"));
   menu->Append(wxID_CLEAR, _("Cle&ar\tCtrl+L"));
   menu->AppendSeparator();
   menu->Append(wxID_SELECTALL, _("Select A&ll\tCtrl+A"));
   menu->AppendSeparator();
   menu->Append(wxID_FIND, _("&Find...\tCtrl+F"));
   menu->AppendSeparator();
   wxMenu *sub = new wxMenu();
   sub->Append(ID_MATCH, _("&Matching Paren\tF8"));
   sub->Append(ID_TOP, _("&Top S-expr\tF9"));
   sub->Append(ID_UP, _("&Higher S-expr\tF10"));
   sub->Append(ID_PREVIOUS, _("&Previous S-expr\tF11"));
   sub->Append(ID_NEXT, _("&Next S-expr\tF12"));
   menu->AppendSubMenu(sub, _("&Go to"));
   menu->AppendSeparator();
   menu->AppendCheckItem(ID_AUTOWRAP, _T("Auto &Wrap"))->Check(mAutoWrap);
   bar->Append(menu, wxT("&Edit"));

   menu = new wxMenu();
   menu->Append(ID_FONT, _("Select &Font..."));
   menu->AppendSeparator();
   menu->Append(ID_SPLITV, _("Split &Vertically"));
   menu->Append(ID_SPLITH, _("Split &Horizontally"));
   menu->AppendSeparator();
   menu->AppendCheckItem(ID_TOGGLECODE, _("Show S&cript"));
   menu->AppendCheckItem(ID_TOGGLEOUTPUT, _("Show &Output"));
   menu->AppendSeparator();
   sub = new wxMenu();
   sub->AppendRadioItem(ID_LARGEICONS, _("&Large Icons"));
   sub->AppendRadioItem(ID_SMALLICONS, _("&Small Icons"));
   menu->AppendSubMenu(sub, _("Toolbar"));
   bar->Append(menu, wxT("&View"));

   menu = new wxMenu();
   menu->Append(ID_GO, _("&Go\tF5"));
   menu->Append(ID_STOP, _("&Stop\tF6"));
   bar->Append(menu, wxT("&Run"));

#if defined(__WXMAC__)
   menu->Append(wxID_ABOUT, _("&About"));
#else
   menu = new wxMenu();
   menu->Append(wxID_ABOUT, _("&About"));
   bar->Append(menu, wxT("Help"));
#endif

   SetMenuBar(bar);

   RecreateToolbar(mLargeIcons);

   wxRect r;
   r.SetX(gPrefs->Read(wxT("NyqBench/Window/X"), -1));
   r.SetY(gPrefs->Read(wxT("NyqBench/Window/Y"), -1));
   r.SetWidth(gPrefs->Read(wxT("NyqBench/Window/Width"), -1));
   r.SetHeight(gPrefs->Read(wxT("NyqBench/Window/Height"), -1));
   if (r == wxRect(-1, -1, -1, -1)) {
      Center();
   }
   else {
      SetSize(r);
   }

   bool maximized = false;
   gPrefs->Read(wxT("NyqBench/Window/Maximized"), maximized);
   if (maximized) {
      Maximize();
   }

   long sashpos;
   sashpos = gPrefs->Read(wxT("NyqBench/SplitX"), 0l);
   if (sashpos > 0) {
      mSplitter->SetSashPosition(sashpos);
   }

   wxString dflt = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT).GetNativeFontInfoDesc();
   wxString desc;
   wxTextAttr attr;

   desc = gPrefs->Read(wxT("NyqBench/ScriptFont"), dflt);
   mScriptFont.SetNativeFontInfo(desc);
#if defined(__WXMSW__)
   // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
   // I don't know if this is something I'm doing wrong, but I'll have to look at this
   // later if I get bored.
   mScriptFont.SetEncoding(wxFONTENCODING_SYSTEM);
#endif
   attr.SetFont(mScriptFont);
   mScript->SetDefaultStyle(attr);

   desc = gPrefs->Read(wxT("NyqBench/OutputFont"), dflt);
   mOutputFont.SetNativeFontInfo(desc);
#if defined(__WXMSW__)
   // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
   // I don't know if this is something I'm doing wrong, but I'll have to look at this
   // later if I get bored.
   mOutputFont.SetEncoding(wxFONTENCODING_SYSTEM);
#endif
   attr.SetFont(mOutputFont);
   mOutput->SetDefaultStyle(attr);

   if (mAutoLoad && !mPath.GetFullPath().IsEmpty()) {
      LoadFile();
   }

   SetWindowTitle();
}
Пример #4
0
void NyqBench::OnSmallIcons(wxCommandEvent & e)
{
   RecreateToolbar(false);
}