void AISTargetAlertDialog::UpdateText()
{
    if( GetAlertText() ) {
        
        wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetAlert"), 12 );
        wxString face = dFont->GetFaceName();
        int sizes[7];
        for( int i = -2; i < 5; i++ ) {
            sizes[i + 2] = dFont->GetPointSize() + i + ( i > 0 ? i : 0 );
        }

        wxString html;
        wxColor bg = GetBackgroundColour();
        
        html.Printf( _T("<html><body bgcolor=#%02x%02x%02x><center>"), bg.Red(), bg.Green(), bg.Blue() );
        
        html << m_alert_text;
        html << _T("</center></font></body></html>");

        m_pAlertTextCtl->SetFonts( face, face, sizes );
        m_pAlertTextCtl->SetPage( html );

        RecalculateSize();
    }
    
    SetColorScheme();
    if( !g_bopengl && CanSetTransparent() )
        SetTransparent( 192 );
}
bool AISTargetAlertDialog::Create( int target_mmsi, wxWindow *parent, AIS_Decoder *pdecoder,
                                   bool b_jumpto, bool b_createWP, bool b_ack,
                                   wxWindowID id,  const wxString& caption,
                                   const wxPoint& pos,const wxSize& size, long style )
                     
{
    
    OCPN_AlertDialog::Create(parent, id, caption, pos, size, style);
    m_bjumpto = b_jumpto;
    m_back = b_ack;
    m_bcreateWP = b_createWP;
    
    m_target_mmsi = target_mmsi;
    m_pdecoder = pdecoder;

    wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetAlert"), 12 );
    int font_size = wxMax(8, dFont->GetPointSize());
    wxString face = dFont->GetFaceName();
#ifdef __WXGTK__
    face = _T("Monospace");
#endif
    wxFont *fp_font = FontMgr::Get().FindOrCreateFont( font_size, wxFONTFAMILY_MODERN,
            wxFONTSTYLE_NORMAL, dFont->GetWeight(), false, face );

    SetFont( *fp_font );

    CreateControls();
    if( !g_bopengl && CanSetTransparent() ) SetTransparent( 192 );
    DimeControl( this );
    wxColor bg = GetBackgroundColour();
    m_pAlertTextCtl->SetBackgroundColour( bg );
    SetBackgroundColour( bg );
    
    return true;
}
KSplash::KSplash(wxTopLevelWindow* parent, const wxBitmap& bitmap): wxSplashScreen(bitmap, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT,
												60000/*One minute so that we destroy it ourselves*/, 
												NULL, -1, wxDefaultPosition, 
												wxDefaultSize, wxBORDER_SIMPLE|wxSTAY_ON_TOP)
{
	m_parent = parent;
	m_parent->Show(false);//hide for now
	if(!CanSetTransparent())
		SetTransparent(wxIMAGE_ALPHA_TRANSPARENT);
	else
		SetBackgroundColour(wxColor(wxT("#0d0d0d")));// a hackish way to hide weakness ;)
}
void AISTargetAlertDialog::UpdateText()
{
    if( GetAlertText() ) {
        wxColor bg = GetBackgroundColour();
        m_pAlertTextCtl->SetBackgroundColour( bg );

        wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetQuery"), 12 );
        wxString face = dFont->GetFaceName();
        int sizes[7];
        for( int i = -2; i < 5; i++ ) {
            sizes[i + 2] = dFont->GetPointSize() + i + ( i > 0 ? i : 0 );
        }

        wxString html;
        html.Printf( _T("<html><body bgcolor=#%02x%02x%02x><center>"), bg.Red(), bg.Blue(),
                bg.Green() );

        html << m_alert_text;
        html << _T("</center></font></body></html>");

        m_pAlertTextCtl->SetFonts( face, face, sizes );
        m_pAlertTextCtl->SetPage( html );

        // Try to create a min size that works across font sizes.
        wxSize sz;
        if( !IsShown() ) {
            sz = m_pAlertTextCtl->GetVirtualSize();
            sz.x = 300;
            m_pAlertTextCtl->SetSize( sz );
        }
        m_pAlertTextCtl->Layout();
        wxSize ir( m_pAlertTextCtl->GetInternalRepresentation()->GetWidth(),
                m_pAlertTextCtl->GetInternalRepresentation()->GetHeight() );
        sz.x = wxMax( m_pAlertTextCtl->GetSize().x, ir.x );
        sz.y = wxMax( m_pAlertTextCtl->GetSize().y, ir.y );
        m_pAlertTextCtl->SetMinSize( sz );
        Fit();
        sz -= wxSize( 200, 200 );
        m_pAlertTextCtl->SetMinSize( sz );
    }

    DimeControl( this );
    if( !g_bopengl && CanSetTransparent() ) SetTransparent( 192 );
}
bool AISTargetAlertDialog::Create( int target_mmsi, wxWindow *parent, AIS_Decoder *pdecoder,
        bool b_jumpto, wxWindowID id, const wxString& caption, const wxPoint& pos,
        const wxSize& size, long style )
{
    //    As a display optimization....
    //    if current color scheme is other than DAY,
    //    Then create the dialog ..WITHOUT.. borders and title bar.
    //    This way, any window decorations set by external themes, etc
    //    will not detract from night-vision

    long wstyle = wxDEFAULT_FRAME_STYLE;
    if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY )
            && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER );

    m_bjumpto = b_jumpto;

    wxSize size_min = size;
    size_min.IncTo( wxSize( 500, 600 ) );
    if( !wxDialog::Create( parent, id, caption, pos, size_min, wstyle ) ) return false;

    m_target_mmsi = target_mmsi;
    m_pparent = parent;
    m_pdecoder = pdecoder;

    wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetAlert"), 12 );
    int font_size = wxMax(8, dFont->GetPointSize());
    wxString face = dFont->GetFaceName();
#ifdef __WXGTK__
    face = _T("Monospace");
#endif
    wxFont *fp_font = wxTheFontList->FindOrCreateFont( font_size, wxFONTFAMILY_MODERN,
            wxFONTSTYLE_NORMAL, dFont->GetWeight(), false, face );

    SetFont( *fp_font );

    CreateControls();
    if( !g_bopengl && CanSetTransparent() ) SetTransparent( 192 );
    DimeControl( this );

    return true;
}
bool OCPN_AlertDialog::Create( wxWindow *parent, wxWindowID id,
                                   const wxString& caption, const wxPoint& pos, const wxSize& size, long style )

{
    //    As a display optimization....
    //    if current color scheme is other than DAY,
    //    Then create the dialog ..WITHOUT.. borders and title bar.
    //    This way, any window decorations set by external themes, etc
    //    will not detract from night-vision
    
    long wstyle = wxDEFAULT_FRAME_STYLE;
    if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY )
        && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER );
    
    wxSize size_min = size;
    size_min.IncTo( wxSize( 500, 600 ) );
    if( !wxDialog::Create( parent, id, caption, pos, size_min, wstyle ) ) return false;
    
    m_pparent = parent;
    
    if( !g_bopengl && CanSetTransparent() ) SetTransparent( 192 );
    
    return true;
}