Beispiel #1
0
void CLogWindow::OnWrapLineCheck(wxCommandEvent& event)
{
#ifdef __WXGTK__
  // Clear the old word wrap state and set the new
  m_Log->SetWindowStyleFlag(m_Log->GetWindowStyleFlag() ^ (wxTE_WORDWRAP | wxTE_DONTWRAP));
#else
  wxString Text;
  // Unfortunately wrapping styles can only be changed dynamically with wxGTK
  // Notice: To retain the colors when changing word wrapping we need to
  //         loop through every letter with GetStyle and then reapply them letter by letter
  // Prevent m_Log access while it's being destroyed
  m_LogAccess = false;
  UnPopulateBottom();
  Text = m_Log->GetValue();
  m_Log->Destroy();
  if (event.IsChecked())
    m_Log =
        CreateTextCtrl(this, wxID_ANY, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_WORDWRAP);
  else
    m_Log =
        CreateTextCtrl(this, wxID_ANY, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP);
  m_Log->SetDefaultStyle(wxTextAttr(*wxWHITE));
  m_Log->AppendText(Text);
  PopulateBottom();
  m_LogAccess = true;
#endif
  SaveSettings();
}
Beispiel #2
0
void wxGenericComboCtrl::SetCustomPaintWidth( int width )
{
#ifdef UNRELIABLE_TEXTCTRL_BORDER
    //
    // If starting/stopping to show an image in front
    // of a writable text-field, then re-create textctrl
    // with different kind of border (because we can't
    // assume that textctrl fully supports wxNO_BORDER).
    //
    wxTextCtrl* tc = GetTextCtrl();

    if ( tc && (m_iFlags & wxCC_BUTTON_OUTSIDE_BORDER) )
    {
        int borderType = tc->GetWindowStyle() & wxBORDER_MASK;
        int tcCreateStyle = -1;

        if ( width > 0 )
        {
            // Re-create textctrl with no border
            if ( borderType != wxNO_BORDER )
            {
                m_widthCustomBorder = 1;
                tcCreateStyle = wxNO_BORDER;
            }
        }
        else if ( width == 0 )
        {
            // Re-create textctrl with normal border
            if ( borderType == wxNO_BORDER )
            {
                m_widthCustomBorder = 0;
                tcCreateStyle = 0;
            }
        }

        // Common textctrl re-creation code
        if ( tcCreateStyle != -1 )
        {
            tc->RemoveEventHandler(m_textEvtHandler);
            delete m_textEvtHandler;

            CreateTextCtrl( tcCreateStyle );

            InstallInputHandlers();
        }
    }
#endif // UNRELIABLE_TEXTCTRL_BORDER

    wxComboCtrlBase::SetCustomPaintWidth( width );
}
Beispiel #3
0
bool
MFCQuaFloatCtrl::CreateFloatCtrl(CRect &r, CWnd *w, UINT id, CFont *cf, CRect *tr, COLORREF *bgc, COLORREF *tbgc, COLORREF *tc)
{
	return CreateTextCtrl(r, w, id, cf, tr, bgc, tbgc, tc);
}
Beispiel #4
0
void CLogWindow::CreateGUIControls()
{
  IniFile ini;
  ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));

  IniFile::Section* options = ini.GetOrCreateSection("Options");
  IniFile::Section* log_window = ini.GetOrCreateSection("LogWindow");
  log_window->Get("x", &x, Parent->GetSize().GetX() / 2);
  log_window->Get("y", &y, Parent->GetSize().GetY());
  log_window->Get("pos", &winpos, wxAUI_DOCK_RIGHT);

  // Font
  m_FontChoice = new wxChoice(this, wxID_ANY);
  m_FontChoice->Bind(wxEVT_CHOICE, &CLogWindow::OnFontChange, this);
  m_FontChoice->Append(_("Default font"));
  m_FontChoice->Append(_("Monospaced font"));
  m_FontChoice->Append(_("Selected font"));

  DefaultFont = GetFont();
  MonoSpaceFont.SetFamily(wxFONTFAMILY_TELETYPE);
#ifdef _WIN32
  // Windows uses Courier New for monospace even though there are better fonts.
  MonoSpaceFont.SetFaceName("Consolas");
#endif
  MonoSpaceFont.SetPointSize(DefaultFont.GetPointSize());
  LogFont.push_back(DefaultFont);
  LogFont.push_back(MonoSpaceFont);
  LogFont.push_back(DebuggerFont);

  int font;
  options->Get("Font", &font, 0);
  m_FontChoice->SetSelection(font);

  // Word wrap
  bool wrap_lines;
  options->Get("WrapLines", &wrap_lines, false);
  m_WrapLine = new wxCheckBox(this, wxID_ANY, _("Word Wrap"));
  m_WrapLine->Bind(wxEVT_CHECKBOX, &CLogWindow::OnWrapLineCheck, this);
  m_WrapLine->SetValue(wrap_lines);

  // Log viewer
  m_Log = CreateTextCtrl(this, wxID_ANY, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY |
                                             (wrap_lines ? wxTE_WORDWRAP : wxTE_DONTWRAP));

  // submit row
  m_cmdline = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
                             wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);

  // Clear log button
  m_clear_log_btn =
      new wxButton(this, wxID_ANY, _("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
  m_clear_log_btn->Bind(wxEVT_BUTTON, &CLogWindow::OnClear, this);

  const int space3 = FromDIP(3);

  // Sizers
  wxBoxSizer* sTop = new wxBoxSizer(wxHORIZONTAL);
  sTop->Add(m_clear_log_btn, 0, wxALIGN_CENTER_VERTICAL);
  sTop->Add(m_FontChoice, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space3);
  sTop->Add(m_WrapLine, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space3);

  sBottom = new wxBoxSizer(wxVERTICAL);
  PopulateBottom();

  wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
  sMain->Add(sTop, 0, wxEXPAND);
  sMain->Add(sBottom, 1, wxEXPAND);
  SetSizer(sMain);

  m_cmdline->SetFocus();
}
Beispiel #5
0
MyFrame::MyFrame(wxFrame *frame)
    : wxFrame( frame, wxID_ANY, _("wxWidgets 2.0 wxFrameLayout Test Application"), wxDefaultPosition, 
          wxSize( 700, 500 ), 
          wxCLIP_CHILDREN | wxMINIMIZE_BOX | wxMAXIMIZE_BOX | 
          wxTHICK_FRAME   | wxSYSTEM_MENU  | wxCAPTION, 
          wxT("freimas") )
{
    mpClientWnd = CreateTextCtrl( _("Client window") );
    
    mpLayout = new wxFrameLayout( this, mpClientWnd );
    
#if defined(__WXGTK__) || defined(__WXX11__)
    cbCommonPaneProperties props;
    mpLayout->GetPaneProperties( props );
    
    props.mRealTimeUpdatesOn = false; // real-time OFF!!!
    
    mpLayout->SetPaneProperties( props, wxALL_PANES );
#endif
    
    mpLayout->SetUpdatesManager( new cbGCUpdatesMgr() );
    
    // this is now default...
    //mpLayout->SetMargins( 1,1,1,1 ); // gaps for vertical/horizontal/right/left panes
    
    // setup plugins for testing
    mpLayout->PushDefaultPlugins();
    
    mpLayout->AddPlugin( CLASSINFO( cbBarHintsPlugin ) ); // fancy "X"es and bevel for bars
    mpLayout->AddPlugin( CLASSINFO( cbHintAnimationPlugin ) );
    mpLayout->AddPlugin( CLASSINFO( cbRowDragPlugin  ) );
    mpLayout->AddPlugin( CLASSINFO( cbAntiflickerPlugin ) );
    mpLayout->AddPlugin( CLASSINFO( cbSimpleCustomizationPlugin ) );
    
    // drop in some bars
    cbDimInfo sizes0( 200,45, // when docked horizontally      
                      200,85, // when docked vertically        
                      175,35, // when floated                  
                      false,  // the bar is not fixed-size
                      4,      // vertical gap (bar border)
                      4       // horizontal gap (bar border)
                    ); 
    
    cbDimInfo sizes1( 150,35, // when docked horizontally      
                      150,85, // when docked vertically        
                      175,35, // when floated                  
                      true,   // the bar is not fixed-size
                      4,      // vertical gap (bar border)
                      4       // horizontal gap (bar border)
                    ); 
    
    cbDimInfo sizes2( 195,35, // when docked horizontally      
                      185,37, // when docked vertically        
                      195,35, // when floated                  
                      true,   // the bar is not fixed-size
                      4,      // vertical gap (bar border)
                      4,      // horizontal gap (bar border)
                      new cbDynToolBarDimHandler()
                    ); 
    
    mpLayout->AddBar( CreateTextCtrl(_("Hello")),  // bar window
                      sizes0, FL_ALIGN_TOP,     // alignment ( 0-top,1-bottom, etc)
                      0,                        // insert into 0th row (vert. position)
                      0,                        // offset from the start of row (in pixels)
                      _("InfoViewer1"),            // name to refer in customization pop-ups
                      true
                    );
    
    mpLayout->AddBar( CreateTextCtrl(_("Bye")),    // bar window
                      sizes0, FL_ALIGN_TOP,     // alignment ( 0-top,1-bottom, etc)
                      1,                        // insert into 0th row (vert. position)
                      0,                        // offset from the start of row (in pixels)
                      _("InfoViewer2"),            // name to refer in customization pop-ups
                      true
                    );
    
    mpLayout->AddBar( CreateTextCtrl(_("Fixed0")), // bar window
                      sizes1, FL_ALIGN_TOP,     // alignment ( 0-top,1-bottom, etc)
                      0,                        // insert into 0th row (vert. position)
                      0,                        // offset from the start of row (in pixels)
                      _("ToolBar1"),               // name to refer in customization pop-ups
                      true
                    );
    
    wxDynamicToolBar* pToolBar = new wxDynamicToolBar();
    
    pToolBar->Create( this, wxID_ANY );
    
    // 1001-1006 ids of command events fired by added tool-buttons

    pToolBar->AddTool( 1001, wxString(wxT(BMP_DIR)) + wxT("new.bmp") );
    pToolBar->AddSeparator();
    pToolBar->AddTool( 1002, wxString(wxT(BMP_DIR)) + wxT("open.bmp") );
    pToolBar->AddTool( 1003, wxString(wxT(BMP_DIR)) + wxT("save.bmp") );
#if wxUSE_STATLINE
    pToolBar->AddSeparator(new wxMySeparatorLine(pToolBar, wxID_ANY));    
#endif // wxUSE_STATLINE
    pToolBar->AddTool( 1004, wxString(wxT(BMP_DIR)) + wxT("cut.bmp") );
    pToolBar->AddTool( 1005, wxString(wxT(BMP_DIR)) + wxT("copy.bmp") );
    pToolBar->AddTool( 1006, wxString(wxT(BMP_DIR)) + wxT("paste.bmp") );
    
    
    mpLayout->AddBar( pToolBar,             // bar window (can be NULL)
                      sizes2, FL_ALIGN_TOP, // alignment ( 0-top,1-bottom, etc)
                      0,                    // insert into 0th row (vert. position)
                      0,                    // offset from the start of row (in pixels)
                      wxT("ToolBar2"),           // name to refer in customization pop-ups
                      false
                    );
    
    mpLayout->EnableFloating( true ); // off, thinking about wxGtk...
}
Beispiel #6
0
bool wxGenericComboCtrl::Create(wxWindow *parent,
                                wxWindowID id,
                                const wxString& value,
                                const wxPoint& pos,
                                const wxSize& size,
                                long style,
                                const wxValidator& validator,
                                const wxString& name)
{
    //
    // Note that technically we only support 'default' border and wxNO_BORDER.
    long border = style & wxBORDER_MASK;
    int tcBorder = wxNO_BORDER;

#if defined(__WXUNIVERSAL__)
    if ( !border )
        border = wxBORDER_SIMPLE;
#elif defined(__WXMSW__)
    if ( !border )
        // For XP, have 1-width custom border, for older version use sunken
        /*if ( wxUxThemeEngine::GetIfActive() )
        {
            border = wxBORDER_NONE;
            m_widthCustomBorder = 1;
        }
        else*/
            border = wxBORDER_SUNKEN;
#else

    //
    // Generic version is optimized for wxGTK
    //

    #define UNRELIABLE_TEXTCTRL_BORDER

    if ( !border )
    {
        if ( style & wxCB_READONLY )
        {
            m_widthCustomBorder = 1;
        }
        else
        {
            m_widthCustomBorder = 0;
            tcBorder = 0;
        }
    }
    else
    {
        // Have textctrl instead use the border given.
        tcBorder = border;
    }

    // Because we are going to have button outside the border,
    // let's use wxBORDER_NONE for the whole control.
    border = wxBORDER_NONE;

    Customize( wxCC_BUTTON_OUTSIDE_BORDER |
               wxCC_NO_TEXT_AUTO_SELECT |
               wxCC_BUTTON_STAYS_DOWN );

#endif

    style = (style & ~(wxBORDER_MASK)) | border;
    if ( style & wxCC_STD_BUTTON )
        m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;

    // create main window
    if ( !wxComboCtrlBase::Create(parent,
                                  id,
                                  value,
                                  pos,
                                  size,
                                  style | wxFULL_REPAINT_ON_RESIZE,
                                  validator,
                                  name) )
        return false;

    // Create textctrl, if necessary
    CreateTextCtrl( tcBorder );

    // Add keyboard input handlers for main control and textctrl
    InstallInputHandlers();

    // Set background style for double-buffering, when needed
    // (cannot use when system draws background automatically)
    if ( !HasTransparentBackground() )
        SetBackgroundStyle( wxBG_STYLE_PAINT );

    // SetInitialSize should be called last
    SetInitialSize(size);

    return true;
}
Beispiel #7
0
void CLogWindow::CreateGUIControls()
{
  IniFile ini;
  ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));

  IniFile::Section* options = ini.GetOrCreateSection("Options");
  IniFile::Section* log_window = ini.GetOrCreateSection("LogWindow");
  log_window->Get("x", &x, Parent->GetSize().GetX() / 2);
  log_window->Get("y", &y, Parent->GetSize().GetY());
  log_window->Get("pos", &winpos, wxAUI_DOCK_RIGHT);

  // Set up log listeners
  int verbosity;
  options->Get("Verbosity", &verbosity, 0);

  // Ensure the verbosity level is valid
  if (verbosity < 1)
    verbosity = 1;
  if (verbosity > MAX_LOGLEVEL)
    verbosity = MAX_LOGLEVEL;

  // Get the logger output settings from the config ini file.
  options->Get("WriteToFile", &m_writeFile, false);
  options->Get("WriteToWindow", &m_writeWindow, true);

  IniFile::Section* logs = ini.GetOrCreateSection("Logs");
  for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
  {
    bool enable;
    logs->Get(m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &enable, false);

    if (m_writeWindow && enable)
      m_LogManager->AddListener((LogTypes::LOG_TYPE)i, LogListener::LOG_WINDOW_LISTENER);
    else
      m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, LogListener::LOG_WINDOW_LISTENER);

    if (m_writeFile && enable)
      m_LogManager->AddListener((LogTypes::LOG_TYPE)i, LogListener::FILE_LISTENER);
    else
      m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, LogListener::FILE_LISTENER);

    m_LogManager->SetLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)(verbosity));
  }
  m_has_listeners = true;

  // Font
  m_FontChoice = new wxChoice(this, wxID_ANY);
  m_FontChoice->Bind(wxEVT_CHOICE, &CLogWindow::OnFontChange, this);
  m_FontChoice->Append(_("Default font"));
  m_FontChoice->Append(_("Monospaced font"));
  m_FontChoice->Append(_("Selected font"));

  DefaultFont = GetFont();
  MonoSpaceFont.SetNativeFontInfoUserDesc("lucida console windows-1252");
  LogFont.push_back(DefaultFont);
  LogFont.push_back(MonoSpaceFont);
  LogFont.push_back(DebuggerFont);

  int font;
  options->Get("Font", &font, 0);
  m_FontChoice->SetSelection(font);

  // Word wrap
  bool wrap_lines;
  options->Get("WrapLines", &wrap_lines, false);
  m_WrapLine = new wxCheckBox(this, wxID_ANY, _("Word Wrap"));
  m_WrapLine->Bind(wxEVT_CHECKBOX, &CLogWindow::OnWrapLineCheck, this);
  m_WrapLine->SetValue(wrap_lines);

  // Log viewer
  m_Log = CreateTextCtrl(this, wxID_ANY, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY |
                                             (wrap_lines ? wxTE_WORDWRAP : wxTE_DONTWRAP));

  // submit row
  m_cmdline = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
                             wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);

  // Clear log button
  m_clear_log_btn =
      new wxButton(this, wxID_ANY, _("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
  m_clear_log_btn->Bind(wxEVT_BUTTON, &CLogWindow::OnClear, this);

  const int space3 = FromDIP(3);

  // Sizers
  wxBoxSizer* sTop = new wxBoxSizer(wxHORIZONTAL);
  sTop->Add(m_clear_log_btn, 0, wxALIGN_CENTER_VERTICAL);
  sTop->Add(m_FontChoice, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space3);
  sTop->Add(m_WrapLine, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, space3);

  sBottom = new wxBoxSizer(wxVERTICAL);
  PopulateBottom();

  wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
  sMain->Add(sTop, 0, wxEXPAND);
  sMain->Add(sBottom, 1, wxEXPAND);
  SetSizer(sMain);

  m_cmdline->SetFocus();
}
Beispiel #8
0
bool wxComboCtrl::Create(wxWindow *parent,
                            wxWindowID id,
                            const wxString& value,
                            const wxPoint& pos,
                            const wxSize& size,
                            long style,
                            const wxValidator& validator,
                            const wxString& name)
{

    // Set border
    long border = style & wxBORDER_MASK;

    if ( !border )
    {
        if ( wxUxThemeIsActive() )
        {
            // For XP, have 1-width custom border, for older version use sunken
            border = wxBORDER_NONE;
            m_widthCustomBorder = 1;
        }
        else
            border = wxBORDER_SUNKEN;

        style = (style & ~(wxBORDER_MASK)) | border;
    }

    // create main window
    if ( !wxComboCtrlBase::Create(parent,
                           id,
                           value,
                           pos,
                           size,
                           style | wxFULL_REPAINT_ON_RESIZE,
                           validator,
                           name) )
        return false;

    if ( wxUxThemeIsActive() && ::wxGetWinVersion() >= wxWinVersion_Vista )
            m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;

    if ( style & wxCC_STD_BUTTON )
        m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;

    // Prepare background for double-buffering or better background theme
    // support, whichever is possible.
    SetDoubleBuffered(true);
    if ( !IsDoubleBuffered() )
        SetBackgroundStyle( wxBG_STYLE_PAINT );

    // Create textctrl, if necessary
    CreateTextCtrl( wxNO_BORDER );

    // Add keyboard input handlers for main control and textctrl
    InstallInputHandlers();

    // SetInitialSize should be called last
    SetInitialSize(size);

    return true;
}
Beispiel #9
0
bool wxComboCtrl::Create(wxWindow *parent,
                            wxWindowID id,
                            const wxString& value,
                            const wxPoint& pos,
                            const wxSize& size,
                            long style,
                            const wxValidator& validator,
                            const wxString& name)
{

    // Set border
    long border = style & wxBORDER_MASK;

#if wxUSE_UXTHEME
    wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
#endif

    if ( !border )
    {
#if wxUSE_UXTHEME
        if ( theme )
        {
            // For XP, have 1-width custom border, for older version use sunken
            border = wxBORDER_NONE;
            m_widthCustomBorder = 1;
        }
        else
#endif
            border = wxBORDER_SUNKEN;

        style = (style & ~(wxBORDER_MASK)) | border;
    }

    // create main window
    if ( !wxComboCtrlBase::Create(parent,
                           id,
                           value,
                           pos,
                           size,
                           style | wxFULL_REPAINT_ON_RESIZE,
                           wxDefaultValidator,
                           name) )
        return false;

#if wxUSE_UXTHEME
    if ( theme )
    {
        if ( ::wxGetWinVersion() >= wxWinVersion_Vista )
            m_iFlags |= wxCC_BUTTON_STAYS_DOWN |wxCC_BUTTON_COVERS_BORDER;
    }
#endif

    if ( style & wxCC_STD_BUTTON )
        m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;

    // Create textctrl, if necessary
    CreateTextCtrl( wxNO_BORDER, validator );

    // Add keyboard input handlers for main control and textctrl
    InstallInputHandlers();

    // Prepare background for double-buffering
    SetBackgroundStyle( wxBG_STYLE_CUSTOM );

    // SetInitialSize should be called last
    SetInitialSize(size);

    return true;
}
Beispiel #10
0
bool wxGenericComboControl::Create(wxWindow *parent,
                                   wxWindowID id,
                                   const wxString& value,
                                   const wxPoint& pos,
                                   const wxSize& size,
                                   long style,
                                   const wxValidator& validator,
                                   const wxString& name)
{

    // Set border
    long border = style & wxBORDER_MASK;

    if ( !border )
    {
#if defined(__WXUNIVERSAL__)
        border = wxBORDER_SIMPLE;
#elif defined(__WXMSW__)
        // For XP, have 1-width custom border, for older version use sunken
        if ( wxUxThemeEngine::GetIfActive() )
        {
            border = wxBORDER_NONE;
            m_widthCustomBorder = 1;
        }
        else
            border = wxBORDER_SUNKEN;
#elif defined(__WXGTK__)
        border = wxBORDER_NONE;
        //m_widthCustomBorder = 2;
        m_widthCustomBorder = 1;
#else
        border = wxBORDER_SIMPLE;
#endif

        style = (style & ~(wxBORDER_MASK)) | border;
    }

#if defined(__WXGTK__)
    Customize( wxCC_BUTTON_OUTSIDE_BORDER |
               wxCC_NO_TEXT_AUTO_SELECT );
#endif

    if ( style & wxCC_STD_BUTTON )
        m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;

    // create main window
    if ( !wxComboCtrlBase::Create(parent,
                                  id,
                                  value,
                                  pos,
                                  size,
                                  style | wxFULL_REPAINT_ON_RESIZE,
                                  wxDefaultValidator,
                                  name) )
        return false;

    // Create textctrl, if necessary
    CreateTextCtrl( wxNO_BORDER, validator );

    // Add keyboard input handlers for main control and textctrl
    InstallInputHandlers( true );

    // Set background
    SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // for double-buffering

    // SetBestSize should be called last
    SetBestSize(size);

    return true;
}
Beispiel #11
0
void CLogWindow::CreateGUIControls()
{
	IniFile ini;
	ini.Load(File::GetUserPath(F_LOGGERCONFIG_IDX));

	ini.Get("LogWindow", "x", &x, Parent->GetSize().GetX() / 2);
	ini.Get("LogWindow", "y", &y, Parent->GetSize().GetY());
	ini.Get("LogWindow", "pos", &winpos, wxAUI_DOCK_RIGHT);

	// Set up log listeners
	int verbosity;
	ini.Get("Options", "Verbosity", &verbosity, 0);

	// Ensure the verbosity level is valid
	if (verbosity < 1)
		verbosity = 1;
	if (verbosity > MAX_LOGLEVEL)
		verbosity = MAX_LOGLEVEL;

	// Get the logger output settings from the config ini file.
	ini.Get("Options", "WriteToFile", &m_writeFile, false);
	ini.Get("Options", "WriteToWindow", &m_writeWindow, true);
#ifdef _MSC_VER
	if (IsDebuggerPresent())
	{
		ini.Get("Options", "WriteToDebugger", &m_writeDebugger, true);
	}
	else
#endif
	{
		m_writeDebugger = false;
	}

	for (int i = 0; i < LogTypes::NUMBER_OF_LOGS; ++i)
	{
		bool enable;
		ini.Get("Logs", m_LogManager->GetShortName((LogTypes::LOG_TYPE)i), &enable, true);

		if (m_writeWindow && enable)
			m_LogManager->AddListener((LogTypes::LOG_TYPE)i, this);
		else
			m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, this);

		if (m_writeFile && enable)
			m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetFileListener());
		else
			m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetFileListener());

		if (m_writeDebugger && enable)
			m_LogManager->AddListener((LogTypes::LOG_TYPE)i, m_LogManager->GetDebuggerListener());
		else
			m_LogManager->RemoveListener((LogTypes::LOG_TYPE)i, m_LogManager->GetDebuggerListener());

		m_LogManager->SetLogLevel((LogTypes::LOG_TYPE)i, (LogTypes::LOG_LEVELS)(verbosity));
	}

	// Font
	m_FontChoice = new wxChoice(this, IDM_FONT);
	m_FontChoice->Append(_("Default font"));
	m_FontChoice->Append(_("Monospaced font"));
	m_FontChoice->Append(_("Selected font"));

	DefaultFont = GetFont();
	MonoSpaceFont.SetNativeFontInfoUserDesc("lucida console windows-1252");
	LogFont.push_back(DefaultFont);
	LogFont.push_back(MonoSpaceFont);
	LogFont.push_back(DebuggerFont);

	int font;
	ini.Get("Options", "Font", &font, 0);
	m_FontChoice->SetSelection(font);

	// Word wrap
	bool wrap_lines;
	ini.Get("Options", "WrapLines", &wrap_lines, false);
	m_WrapLine = new wxCheckBox(this, IDM_WRAPLINE, _("Word Wrap"));
	m_WrapLine->SetValue(wrap_lines);

	// Log viewer
	m_Log = CreateTextCtrl(this, IDM_LOG, wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY |
			(wrap_lines ? wxTE_WORDWRAP : wxTE_DONTWRAP));

	// submit row
	m_cmdline = new wxTextCtrl(this, IDM_SUBMITCMD, wxEmptyString, wxDefaultPosition, wxDefaultSize,
			wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB);

	// Sizers
	wxBoxSizer *sTop = new wxBoxSizer(wxHORIZONTAL);
	sTop->Add(new wxButton(this, IDM_CLEARLOG, _("Clear"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT));
	sTop->Add(m_FontChoice, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 3);
	sTop->Add(m_WrapLine, 0, wxALIGN_CENTER_VERTICAL);

	sBottom = new wxBoxSizer(wxVERTICAL);
	PopulateBottom();

	wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL);
	sMain->Add(sTop, 0, wxEXPAND);
	sMain->Add(sBottom, 1, wxEXPAND);
	SetSizer(sMain);

	m_cmdline->SetFocus();
}