コード例 #1
0
void RheiaLoggerManager::InitializeEnvironment()
{
//    /*************************************************************************
//    * Create the log window
//    *************************************************************************/
//#if wxHAS_TEXT_WINDOW_STREAM
//    LogWindow = new wxTextCtrl( Book, wxID_ANY, _("This is the log window\n"), wxDefaultPosition,
//                                wxDefaultSize, wxNO_BORDER | wxTE_RICH | wxTE_READONLY | wxTE_MULTILINE );
//    redirector = new wxStreamToTextRedirector( LogWindow );
//#else
//    LogWindow = new wxStreamedTextCtrl( Book, wxID_ANY, _("This is the log window\n"), wxDefaultPosition,
//                                        wxDefaultSize, wxNO_BORDER | wxTE_RICH | wxTE_READONLY | wxTE_MULTILINE );
//    redirector = new wxStreamToTextRedirector( (wxStreamedTextCtrl*) LogWindow , std::cout );
//#endif
//    std::cout << "Standard cout stream redirected to the log window..." << std::endl;
//
//    // Set user profile book configuration
//    RheiaConfigurationManager *icfg = RheiaManager::Get()->GetConfigurationManager(_T("log_manager"));
//
//    /* Now sets the log font size */
//    int FontSize = (int) icfg->ReadInt(_T("/aspect/log_font_size"), 8);
//    wxTextCtrl *iText = LogWindow;
//    wxFont font = iText->GetFont();
//    font.SetPointSize( FontSize );
//    iText->SetFont( font );
//
//    for(size_t i = 0; i < max_logs; ++i)
//    {
//        slot[i].index = i;
//        slot[i].log = &g_null_log;
//    }
//
//    SetLog(new RheiaTextCtrlLogger, app_log);
//    SetLog(new RheiaStdoutLogger, stdout_log);
//    SetLog(new RheiaTextCtrlLogger, debug_log);
//    slot[app_log].title = _T("Rheia");
//    slot[debug_log].title = _T("Rheia Debug");
//    slot[stdout_log].title = _T("stdout");
//
//    wxString path = RheiaStandardPaths::DataDirectoryGlobal() + _T("/images/edit_16x16.png");
//    defaultBitmap = RheiaLoadBitmap(path, wxBITMAP_TYPE_PNG);
//
//    wxRegisterId(baseID + num_pages);
//    for(int i = 0; i < num_pages; ++i)
//    {
//        page[i] = Page();
//    }
//
//    wxWindow* log;
//
//    for(size_t i = app_log; i < ::max_logs; ++i)
//    {
//        if((log = Slot(i).GetLogger()->CreateControl(Book)))
//            AddLogger(Slot(i).GetLogger(), log, Slot(i).title, Slot(i).icon);
//    }
//
//    /*************************************************************************
//    * Add the log window to the page
//    *************************************************************************/
//    Book->AddPage( LogWindow , _("Logs") , false , defaultBitmap );

    /***
    *   Global loggers shall now be registered
    *   Create standard RheiaLoggers name Rheia Log, Rheia Debug Log
    */
    RheiaLogger* log = RheiaLoggerFactory::Get()->BuildLogger( wxT("TimeTextLogger") , wxT("Rheia Log") );

    if( log != NULL )
    {
        AddLogger(log,wxT("Rheia Log"));
        log->Log( wxT("Rheia Log initialized ...") , RheiaLogging::success );
        log->Log( wxT("You will find here all standard Rheia Logging Info ...") , RheiaLogging::info );
        SetActiveLogger( wxT("Rheia Log") );
    }

//#if defined( RHEIA_DEBUG ) || defined( _DEBUG )
    RheiaLogger* debuglog = RheiaLoggerFactory::Get()->BuildLogger( wxT("TimeTextLogger") , wxT("Rheia Debug Log") );

    if( debuglog != NULL )
    {
        AddLogger(debuglog,wxT("Rheia Debug Log"));
        debuglog->Log( wxT("Rheia Debug Log initialized ...") , RheiaLogging::success );
    }
//#endif
    if( m_parent )
	{
        m_parent->PushEventHandler( this );
		RheiaFrameEventsManager::Get(m_parent)->RegisterEventMethod(RheiaEVT_FRAME_CLOSING,
			new RheiaEventFunctor<RheiaLoggerManager>(this, RheiaFrameEventHandler(RheiaLoggerManager::OnCloseFrame)));
	}
}
コード例 #2
0
RheiaMainFrame::RheiaMainFrame(wxWindow* parent,
       wxWindowID id,
       const wxString& title,
       const wxPoint& pos,
       const wxSize& size,
       long style):
       RheiaManagedFrame(parent, id, title, pos, size, style)
{
    BuildMenu();

    /* First build the aui components */
    BuildAui();


    /* now create the info window */
    wxAuiNotebook* book = RheiaInfoPaneManager::Get(this)->CreateWindow(this);
    RheiaInfoPaneManager::Get(this)->BuildMenu( m_menuBar );

    m_layout->AddPane( book , wxAuiPaneInfo().
                            Name(wxT("InfoPane")).Caption(_("Information")).
                            BestSize(600,500).MinSize(wxSize(100,100)).MaximizeButton(true).
                            MinimizeButton(true).
                            Bottom().Layer(0));

    /* now create the info window */
    book = RheiaLeftPaneManager::Get(this)->CreateWindow(this);
    RheiaLeftPaneManager::Get(this)->BuildMenu( m_menuBar );

    m_layout->AddPane( book , wxAuiPaneInfo().
                            Name(wxT("ManagementPane")).Caption(_("Management")).
                            BestSize(300,600).MinSize(wxSize(100,100)).MaximizeButton(true).
                            MinimizeButton(true).
                            Left().Layer(1));

    /*** Now add the workspace manager to the left pane's manager */
    RheiaLeftPaneManager::Get(this)->AddPage( wxT("Workspaces") , RheiaWorkspaceManager::Get(this) );
    RheiaWorkspaceManager::Get(this)->BuildMenu( m_menuBar );

    RheiaLoggerManager::Get(this)->InitializeEnvironment();
    RheiaLoggerManager::Get(this)->BuildMenu(m_menuBar);
    RheiaLogger* log = RheiaLoggerManager::Get(this)->GetRheiaDebugLogger();
    log->Log( wxT("RheiaMainFrame::Registering Rheia Events..."), RheiaLogging::info );
	
	RheiaEditorManager::Get(this)->BuildMenu( m_menuBar );
	
	/*
	RheiaEditorPropertyPanel* m_pppanel = new RheiaEditorPropertyPanel(this,NULL);
	
	m_layout->AddPane( m_pppanel , wxAuiPaneInfo().
                            Name(wxT("ManagementPane")).Caption(_("Editor Configuration")).
                            BestSize(300,600).MinSize(wxSize(100,100)).
                            Right().Layer(1));*/
	
	/*** Build toolbars */
	wxAuiToolBar* prjtb = RheiaWorkspaceManager::Get(this)->BuildProjectsToolBar(this);
    RheiaToolBarManager::Get(this)->AddToolBar(wxT("Projects"),prjtb);
	
	wxAuiToolBar* wksptb = RheiaWorkspaceManager::Get(this)->BuildToolBar(this);
    RheiaToolBarManager::Get(this)->AddToolBar(wxT("Workspaces"),wksptb);

	RheiaEditorManager::Get(this)->BuildToolBar( this );
//	
//	RheiaInfoPaneManager::Get(this)->AddPage(wxT("Python console"), RheiaPythonConsoleManager::Get(this));
//	RheiaPythonConsoleManager::Get(this)->BuildMenu(m_menuBar);
//
////    wxBitmap bmp = RheiaLoadBitmap(RheiaStandardPaths::DataDirectoryGlobal() + (_T("/share/rheia/images/rheia_24.jpg")) , wxBITMAP_TYPE_JPEG );
////    wxIcon icon;
////    icon.CopyFromBitmap( bmp );
////    SetIcon( icon );
//
    /* First build the status bar */
    log->Log( wxT("RheiaMainFrame::Building Rheia status bar..."), RheiaLogging::info);
    BuildStatusBar();

    /* Displays a welcome message in the status bar */
#if wxUSE_STATUSBAR
    SetStatusText(_("Welcome to Rheia !"));
#endif // wxUSE_STATUSBAR

    log->Log( wxT("RheiaMainFrame::Loading user profile..."), RheiaLogging::info);
    LoadLayout();

    log->Log( wxT("RheiaMainFrame::Initializing package data base..."), RheiaLogging::info);
    RheiaPackageDBManager::Get();
    log->Log( wxT("RheiaMainFrame::Checking for pending packages..."), RheiaLogging::info);
    RheiaPackageManager::Get()->InstallPendingPackages( true );
    log->Log( wxT("RheiaMainFrame::Loading installed plugins..."), RheiaLogging::info);
    RheiaPluginManager::Get()->LoadAllPlugins();

    RheiaPackageManager::Get()->BuildMenu( this , m_menuBar );
    log->Log( wxT("RheiaMainFrame::Initializing package data base..."), RheiaLogging::info);
    RheiaPackageDBManager::Get();
    log->Log( wxT("RheiaMainFrame::Checking for pending packages..."), RheiaLogging::info);
    RheiaPackageManager::Get()->InstallPendingPackages( true );
    log->Log( wxT("RheiaMainFrame::Loading installed plugins..."), RheiaLogging::info);
    RheiaPluginManager::Get()->LoadAllPlugins();
    RheiaFramePluginManager::Get(this)->LoadAllPlugins();

	m_startpage = new RheiaStartPageContainer( this, wxT("nm_test_page.html") );
	RheiaCenterPaneManager::Get(this)->AddPage( wxT("Start here") , m_startpage );

    m_layout->Update();
    RegisterEvents();  
}