bool about::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); m_parent = parent; m_btips_loaded = false; wxFont *qFont = GetOCPNScaledFont(_("Dialog")); SetFont( *qFont ); CreateControls(); Update(); wxSize sz = g_Platform->getDisplaySize(); GetSizer()->Fit( this ); //Set the maximum size of the entire settings dialog SetSizeHints( -1, -1, sz.x-100, sz.y-100 ); if( g_bresponsive ) SetSize( wxSize( sz.x-100, sz.y-100 ) ); Centre(); return TRUE; }
bool S57ExtraQueryInfoDlg::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|wxFRAME_FLOAT_ON_PARENT; if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY ) && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER ); if( !wxFrame::Create( parent, id, caption, pos, size, wstyle ) ) return false; wxFont *dFont = GetOCPNScaledFont(_("ObjectQuery")); SetFont( *dFont ); CreateControls(); DimeControl( this ); return true; }
int OCPNPlatform::DoDirSelectorDialog( wxWindow *parent, wxString *file_spec, wxString Title, wxString initDir) { wxString dir; int result = wxID_CANCEL; #ifdef __OCPN__ANDROID__ result = androidFileChooser(&dir, initDir, Title, _T(""), _T(""), true); // Directories only if(file_spec) *file_spec = dir; #else wxDirDialog *dirSelector = new wxDirDialog( parent, Title, initDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); wxFont *qFont = GetOCPNScaledFont(_("Dialog")); dirSelector->SetFont(*qFont); if(g_bresponsive) dirSelector = AdjustDirDialogFont(parent, dirSelector); #ifdef __WXOSX__ if(parent) parent->HideWithEffect(wxSHOW_EFFECT_BLEND ); #endif result = dirSelector->ShowModal(); #ifdef __WXOSX__ if(parent) parent->ShowWithEffect(wxSHOW_EFFECT_BLEND ); #endif if( result == wxID_CANCEL ){ } else{ if(file_spec){ *file_spec = dirSelector->GetPath(); } } delete dirSelector; #endif return result; }
bool S57QueryDialog::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; #ifdef __WXOSX__ wstyle |= wxSTAY_ON_TOP; #endif if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY ) && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER ); if( !wxDialog::Create( parent, id, caption, pos, size, wstyle ) ) return false; wxFont *dFont = GetOCPNScaledFont(_("ObjectQuery")); SetFont( *dFont ); CreateControls(); m_createsize = size; /* // This ensures that the dialog cannot be sized smaller // than the minimum size GetSizer()->SetSizeHints( this ); // Explicitely set the size SetSize( size ); // Centre the dialog on the parent or (if none) screen Centre(); */ RecalculateSize(); DimeControl( this ); return true; }
bool about::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) { m_parent = parent; #ifdef __WXOSX__ style |= wxSTAY_ON_TOP; #endif SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS ); wxDialog::Create( parent, id, caption, pos, size, style ); wxFont *qFont = GetOCPNScaledFont(_("Dialog")); SetFont( *qFont ); m_displaySize = g_Platform->getDisplaySize(); CreateControls(); Populate(); RecalculateSize(); return TRUE; }
wxFileDialog* OCPNPlatform::AdjustFileDialogFont(wxWindow *container, wxFileDialog* dlg) { wxFileDialog* ret_dlg = dlg; dlg->Show(); dlg->SetSize( container->GetSize()); dlg->Centre(); wxSize sds = dlg->GetSize(); wxSize ss = container->GetSize(); if(sds.x > ss.x){ dlg->Hide(); wxString msg = dlg->GetMessage(); wxString default_dir = dlg->GetDirectory(); wxString default_file = dlg->GetFilename(); wxString wildcard = dlg->GetWildcard(); delete dlg; ret_dlg = new wxFileDialog( NULL, msg, default_dir, default_file, wildcard, wxFD_OPEN ); wxFont *dialogFont = GetOCPNScaledFont(_("Dialog")); wxFont *smallFont = new wxFont( * dialogFont ); smallFont->SetPointSize( (smallFont->GetPointSize() / 2) + 0.5 ); // + 0.5 to round instead of truncate ret_dlg->SetFont( * smallFont ); ret_dlg->SetSize( container->GetSize()); ret_dlg->Centre(); } ret_dlg->Hide(); return ret_dlg; }
wxDirDialog* OCPNPlatform::AdjustDirDialogFont(wxWindow *container, wxDirDialog* dlg) { wxDirDialog* ret_dlg = dlg; dlg->Show(); dlg->SetSize( container->GetSize()); dlg->Centre(); wxSize sds = dlg->GetSize(); wxSize ss = container->GetSize(); if(sds.x > ss.x){ dlg->Hide(); wxString msg = dlg->GetMessage(); wxString default_dir = dlg->GetPath(); delete dlg; ret_dlg = new wxDirDialog( NULL, msg, default_dir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); wxFont *dialogFont = GetOCPNScaledFont(_("Dialog")); wxFont *smallFont = new wxFont( * dialogFont ); smallFont->SetPointSize( (smallFont->GetPointSize() / 2) + 0.5 ); // + 0.5 to round instead of truncate ret_dlg->SetFont( * smallFont ); ret_dlg->SetSize( container->GetSize()); ret_dlg->Centre(); } ret_dlg->Hide(); return ret_dlg; }
AISTargetListDialog::AISTargetListDialog( wxWindow *parent, wxAuiManager *auimgr, AIS_Decoder *pdecoder ) : wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize( 780, 250 ), wxBORDER_NONE ) { m_pparent = parent; m_pAuiManager = auimgr; m_pdecoder = pdecoder; wxFont *qFont = GetOCPNScaledFont(_T("Dialog"), 12); SetFont( *qFont ); // Make an estimate of the default dialog size // for the case when the AUI Perspective for this dialog is undefined wxSize esize; esize.x = 700; esize.y = GetCharHeight() * 18; SetSize( esize ); // SetMinSize( wxSize(400,240)); s_p_sort_decoder = pdecoder; m_pMMSI_array = new ArrayOfMMSI( ArrayItemCompareMMSI ); wxBoxSizer* topSizer = new wxBoxSizer( wxHORIZONTAL ); SetSizer( topSizer ); // Parse the global column width string as read from config file wxStringTokenizer tkz( g_AisTargetList_column_spec, _T(";") ); wxString s_width = tkz.GetNextToken(); int width; long lwidth; m_pListCtrlAISTargets = new OCPNListCtrl( this, ID_AIS_TARGET_LIST, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES | wxBORDER_SUNKEN | wxLC_VIRTUAL ); wxImageList *imglist = new wxImageList( 16, 16, true, 2 ); ocpnStyle::Style* style = g_StyleManager->GetCurrentStyle(); imglist->Add( style->GetIcon( _T("sort_asc") ) ); imglist->Add( style->GetIcon( _T("sort_desc") ) ); m_pListCtrlAISTargets->AssignImageList( imglist, wxIMAGE_LIST_SMALL ); m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( AISTargetListDialog::OnTargetSelected ), NULL, this ); m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( AISTargetListDialog::OnTargetSelected ), NULL, this ); m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED, wxListEventHandler( AISTargetListDialog::OnTargetDefaultAction ), NULL, this ); m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_COL_CLICK, wxListEventHandler( AISTargetListDialog::OnTargetListColumnClicked ), NULL, this ); int dx = GetCharWidth(); width = dx * 4; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlTRK, _("Trk"), wxLIST_FORMAT_LEFT, width ); s_width = tkz.GetNextToken(); width = dx * 12; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlNAME, _("Name"), wxLIST_FORMAT_LEFT, width ); s_width = tkz.GetNextToken(); width = dx * 7; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlCALL, _("Call"), wxLIST_FORMAT_LEFT, width ); s_width = tkz.GetNextToken(); width = dx * 10; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlMMSI, _("MMSI"), wxLIST_FORMAT_LEFT, width ); s_width = tkz.GetNextToken(); width = dx * 7; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlCLASS, _("Class"), wxLIST_FORMAT_CENTER, width ); s_width = tkz.GetNextToken(); width = dx * 10; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlTYPE, _("Type"), wxLIST_FORMAT_LEFT, width ); s_width = tkz.GetNextToken(); width = dx * 12; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlNAVSTATUS, _("Nav Status"), wxLIST_FORMAT_LEFT, width ); s_width = tkz.GetNextToken(); width = dx * 6; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlBRG, _("Brg"), wxLIST_FORMAT_RIGHT, width ); s_width = tkz.GetNextToken(); width = dx * 8; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlRNG, _("Range"), wxLIST_FORMAT_RIGHT, width ); s_width = tkz.GetNextToken(); width = dx * 6; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlCOG, _("CoG"), wxLIST_FORMAT_RIGHT, width ); s_width = tkz.GetNextToken(); width = dx * 6; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlSOG, _("SoG"), wxLIST_FORMAT_RIGHT, width ); width = dx * 7; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlCPA, _("CPA"), wxLIST_FORMAT_RIGHT, width ); width = dx * 8; if( s_width.ToLong( &lwidth ) ) { width = wxMax(dx * 2, lwidth); width = wxMin(width, dx * 30); } m_pListCtrlAISTargets->InsertColumn( tlTCPA, _("TCPA"), wxLIST_FORMAT_RIGHT, width ); wxListItem item; item.SetMask( wxLIST_MASK_IMAGE ); item.SetImage( g_bAisTargetList_sortReverse ? 1 : 0 ); g_AisTargetList_sortColumn = wxMax(g_AisTargetList_sortColumn, 0); m_pListCtrlAISTargets->SetColumn( g_AisTargetList_sortColumn, item ); topSizer->Add( m_pListCtrlAISTargets, 1, wxEXPAND | wxALL, 0 ); wxBoxSizer* boxSizer02 = new wxBoxSizer( wxVERTICAL ); boxSizer02->AddSpacer( 22 ); m_pButtonInfo = new wxButton( this, wxID_ANY, _("Target info"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonInfo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnTargetQuery ), NULL, this ); boxSizer02->Add( m_pButtonInfo, 0, wxEXPAND | wxALL, 0 ); boxSizer02->AddSpacer( 5 ); m_pButtonJumpTo = new wxButton( this, wxID_ANY, _("Center View"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonJumpTo->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnTargetScrollTo ), NULL, this ); boxSizer02->Add( m_pButtonJumpTo, 0, wxEXPAND | wxALL, 0 ); m_pButtonCreateWpt = new wxButton( this, wxID_ANY, _("Create WPT"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonCreateWpt->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnTargetCreateWpt ), NULL, this ); boxSizer02->Add( m_pButtonCreateWpt, 0, wxEXPAND | wxALL, 0 ); m_pButtonHideAllTracks = new wxButton( this, wxID_ANY, _("Hide All Tracks"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonHideAllTracks->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnHideAllTracks ), NULL, this ); boxSizer02->Add( m_pButtonHideAllTracks, 0, wxEXPAND | wxALL, 0 ); m_pButtonShowAllTracks = new wxButton( this, wxID_ANY, _("Show All Tracks"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonShowAllTracks->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnShowAllTracks ), NULL, this ); boxSizer02->Add( m_pButtonShowAllTracks, 0, wxEXPAND | wxALL, 0 ); m_pButtonToggleTrack = new wxButton( this, wxID_ANY, _("Toggle track"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonToggleTrack->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnToggleTrack ), NULL, this ); boxSizer02->Add( m_pButtonToggleTrack, 0, wxEXPAND | wxALL, 0 ); boxSizer02->AddSpacer( 10 ); m_pStaticTextRange = new wxStaticText( this, wxID_ANY, _("Limit range: NM"), wxDefaultPosition, wxDefaultSize, 0 ); boxSizer02->Add( m_pStaticTextRange, 0, wxALL, 0 ); boxSizer02->AddSpacer( 2 ); m_pSpinCtrlRange = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 50, -1 ), wxSP_ARROW_KEYS, 1, 20000, g_AisTargetList_range ); m_pSpinCtrlRange->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler( AISTargetListDialog::OnLimitRange ), NULL, this ); m_pSpinCtrlRange->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( AISTargetListDialog::OnLimitRange ), NULL, this ); boxSizer02->Add( m_pSpinCtrlRange, 0, wxEXPAND | wxALL, 0 ); topSizer->Add( boxSizer02, 0, wxEXPAND | wxALL, 2 ); boxSizer02->AddSpacer( 10 ); m_pStaticTextCount = new wxStaticText( this, wxID_ANY, _("Target Count"), wxDefaultPosition, wxDefaultSize, 0 ); boxSizer02->Add( m_pStaticTextCount, 0, wxALL, 0 ); boxSizer02->AddSpacer( 2 ); m_pTextTargetCount = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); boxSizer02->Add( m_pTextTargetCount, 0, wxALL, 0 ); boxSizer02->AddSpacer( 10 ); m_pButtonOK = new wxButton( this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW ); m_pButtonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( AISTargetListDialog::OnCloseButton ), NULL, this ); boxSizer02->Add( m_pButtonOK, 0, wxEXPAND | wxALL, 0 ); topSizer->Layout(); // This is silly, but seems to be required for __WXMSW__ build // If not done, the SECOND invocation of AISTargetList fails to expand the list to the full wxSizer size.... SetSize( GetSize().x, GetSize().y - 1 ); SetColorScheme(); UpdateButtons(); if( m_pAuiManager ) { wxAuiPaneInfo pane = wxAuiPaneInfo().Name( _T("AISTargetList") ).CaptionVisible( true ). DestroyOnClose( true ).Float().FloatingPosition( 50, 50 ).TopDockable( false ). BottomDockable( true ).LeftDockable( false ).RightDockable( false ).Show( true ); m_pAuiManager->LoadPaneInfo( g_AisTargetList_perspective, pane ); bool b_reset_pos = false; if( (pane.floating_size.x != -1) && (pane.floating_size.y != -1)){ #ifdef __WXMSW__ // Support MultiMonitor setups which an allow negative window positions. // If the requested window title bar does not intersect any installed monitor, // then default to simple primary monitor positioning. RECT frame_title_rect; frame_title_rect.left = pane.floating_pos.x; frame_title_rect.top = pane.floating_pos.y; frame_title_rect.right = pane.floating_pos.x + pane.floating_size.x; frame_title_rect.bottom = pane.floating_pos.y + 30; if( NULL == MonitorFromRect( &frame_title_rect, MONITOR_DEFAULTTONULL ) ) b_reset_pos = true; #else // Make sure drag bar (title bar) of window intersects wxClient Area of screen, with a little slop... wxRect window_title_rect;// conservative estimate window_title_rect.x = pane.floating_pos.x; window_title_rect.y = pane.floating_pos.y; window_title_rect.width = pane.floating_size.x; window_title_rect.height = 30; wxRect ClientRect = wxGetClientDisplayRect(); ClientRect.Deflate(60, 60);// Prevent the new window from being too close to the edge if(!ClientRect.Intersects(window_title_rect)) b_reset_pos = true; #endif if( b_reset_pos ) pane.FloatingPosition( 50, 50 ); } // If the list got accidentally dropped on top of the chart bar, move it away.... if( pane.IsDocked() && ( pane.dock_row == 0 ) ) { pane.Float(); pane.Row( 1 ); pane.Position( 0 ); g_AisTargetList_perspective = m_pAuiManager->SavePaneInfo( pane ); pConfig->UpdateSettings(); } pane.Caption( wxGetTranslation( _("AIS target list") ) ); m_pAuiManager->AddPane( this, pane ); m_pAuiManager->Update(); m_pAuiManager->Connect( wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler( AISTargetListDialog::OnPaneClose ), NULL, this ); } }
TCWin::TCWin( ChartCanvas *parent, int x, int y, void *pvIDX ) { // 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 m_created = false; xSpot = 0; ySpot = 0; m_pTCRolloverWin = NULL; long wstyle = wxCLIP_CHILDREN | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ; if( ( global_color_scheme != GLOBAL_COLOR_SCHEME_DAY ) && ( global_color_scheme != GLOBAL_COLOR_SCHEME_RGB ) ) wstyle |= ( wxNO_BORDER ); #ifdef __WXOSX__ wstyle |= wxSTAY_ON_TOP; #endif pParent = parent; m_x = x; m_y = y; RecalculateSize(); wxDialog::Create( parent, wxID_ANY, wxString( _T ( "" ) ), m_position , m_tc_size, wstyle ); m_created = true; wxFont *qFont = GetOCPNScaledFont(_("Dialog")); SetFont( *qFont ); pIDX = (IDX_entry *) pvIDX; gpIDXn++; // Set up plot type if( strchr( "Tt", pIDX->IDX_type ) ) { m_plot_type = TIDE_PLOT; SetTitle( wxString( _( "Tide" ) ) ); gpIDX = pIDX; // remember pointer for routeplan } else { m_plot_type = CURRENT_PLOT; SetTitle( wxString( _( "Current" ) ) ); } int sx, sy; GetClientSize( &sx, &sy ); // Figure out this computer timezone minute offset wxDateTime this_now = gTimeSource; bool cur_time = !gTimeSource.IsValid(); if (cur_time) { this_now = wxDateTime::Now(); } wxDateTime this_gmt = this_now.ToGMT(); #if wxCHECK_VERSION(2, 6, 2) wxTimeSpan diff = this_now.Subtract( this_gmt ); #else wxTimeSpan diff = this_gmt.Subtract ( this_now ); #endif int diff_mins = diff.GetMinutes(); // Correct a bug in wx3.0.2 // If the system TZ happens to be GMT, with DST active (e.g.summer in London), // then wxDateTime returns incorrect results for toGMT() method #if wxCHECK_VERSION(3, 0, 2) if( diff_mins == 0 && this_now.IsDST() ) diff_mins +=60; #endif int station_offset = ptcmgr->GetStationTimeOffset( pIDX ); m_corr_mins = station_offset - diff_mins; if( this_now.IsDST() ) m_corr_mins += 60; // Establish the inital drawing day as today m_graphday = this_now; wxDateTime graphday_00 = this_now; graphday_00.ResetTime(); time_t t_graphday_00 = graphday_00.GetTicks(); // Correct a Bug in wxWidgets time support if( !graphday_00.IsDST() && m_graphday.IsDST() ) t_graphday_00 -= 3600; if( graphday_00.IsDST() && !m_graphday.IsDST() ) t_graphday_00 += 3600; m_t_graphday_00_at_station = t_graphday_00 - ( m_corr_mins * 60 ); btc_valid = false; wxString* TClist = NULL; m_tList = new wxListBox( this, -1, wxPoint( sx * 65 / 100, 11 ), wxSize( ( sx * 32 / 100 ), ( sy * 20 / 100 ) ), 0, TClist, wxLB_SINGLE | wxLB_NEEDED_SB | wxLB_HSCROLL ); // Measure the size of a generic button, with label wxButton *test_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( -1, -1), wxDefaultSize ); test_button->GetSize( &m_tsx, &m_tsy ); delete test_button; // In the interest of readability, if the width of the dialog is too narrow, // simply skip showing the "Hi/Lo" list control. if( (m_tsy * 15) > sx ) m_tList->Hide(); OK_button = new wxButton( this, wxID_OK, _( "OK" ), wxPoint( sx - (2 * m_tsy + 10), sy - (m_tsy + 10) ), wxDefaultSize ); PR_button = new wxButton( this, ID_TCWIN_PR, _( "Prev" ), wxPoint( 10, sy - (m_tsy + 10) ), wxSize( -1, -1 ) ); wxSize texc_size = wxSize( ( sx * 60 / 100 ), ( sy *29 / 100 ) ); if( !m_tList->IsShown()){ texc_size = wxSize( ( sx * 90 / 100 ), ( sy *29 / 100 ) ); } m_ptextctrl = new wxTextCtrl( this, -1, _T(""), wxPoint( sx * 3 / 100, 6 ), texc_size , wxTE_MULTILINE | wxTE_READONLY | wxTE_DONTWRAP); int bsx, bsy, bpx, bpy; PR_button->GetSize( &bsx, &bsy ); PR_button->GetPosition( &bpx, &bpy ); NX_button = new wxButton( this, ID_TCWIN_NX, _( "Next" ), wxPoint( bpx + bsx + 5, sy - (m_tsy + 10) ), wxSize( -1, -1 ) ); m_TCWinPopupTimer.SetOwner( this, TCWININF_TIMER ); wxScreenDC dc; int text_height; dc.GetTextExtent(_T("W"), NULL, &text_height); m_button_height = m_tsy; //text_height + 20; // Build graphics tools wxFont *dlg_font = FontMgr::Get().GetFont( _("Dialog") ); int dlg_font_size = dlg_font->GetPointSize(); pSFont = FontMgr::Get().FindOrCreateFont( dlg_font_size-2, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, FALSE, wxString( _T ( "Arial" ) ) ); pSMFont = FontMgr::Get().FindOrCreateFont( dlg_font_size-1, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, FALSE, wxString( _T ( "Arial" ) ) ); pMFont = FontMgr::Get().FindOrCreateFont( dlg_font_size, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE, wxString( _T ( "Arial" ) ) ); pLFont = FontMgr::Get().FindOrCreateFont( dlg_font_size+1, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, FALSE, wxString( _T ( "Arial" ) ) ); pblack_1 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFD" ) ), wxMax(1,(int)(m_tcwin_scaler+0.5)), wxPENSTYLE_SOLID ); pblack_2 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFD" ) ), wxMax(2,(int)(2*m_tcwin_scaler+0.5)), wxPENSTYLE_SOLID ); pblack_3 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UWHIT" ) ), wxMax(1,(int)(m_tcwin_scaler+0.5)), wxPENSTYLE_SOLID ); pred_2 = wxThePenList->FindOrCreatePen( GetGlobalColor( _T ( "UINFR" ) ), wxMax(4,(int)(4*m_tcwin_scaler+0.5)), wxPENSTYLE_SOLID ); pltgray = wxTheBrushList->FindOrCreateBrush( GetGlobalColor( _T ( "UIBCK" ) ), wxBRUSHSTYLE_SOLID ); pltgray2 = wxTheBrushList->FindOrCreateBrush( GetGlobalColor( _T ( "DILG1" ) ), wxBRUSHSTYLE_SOLID ); DimeControl( this ); // Fill in some static text control information // Tidi station information m_ptextctrl->Clear(); wxString locn( pIDX->IDX_station_name, wxConvUTF8 ); wxString locna, locnb; if( locn.Contains( wxString( _T ( "," ) ) ) ) { locna = locn.BeforeFirst( ',' ); locnb = locn.AfterFirst( ',' ); } else { locna = locn; locnb.Empty(); } // write the first line wxTextAttr style; style.SetFont( *pLFont ); m_ptextctrl->SetDefaultStyle( style ); m_ptextctrl->AppendText( locna ); m_ptextctrl->AppendText(_T("\n")); style.SetFont( *pSMFont ); m_ptextctrl->SetDefaultStyle( style ); if( !locnb.IsEmpty() ) m_ptextctrl->AppendText( locnb ); m_ptextctrl->AppendText(_T("\n")); //Reference to the master station if(( 't' == pIDX->IDX_type ) || ( 'c' == pIDX->IDX_type )) { wxString mref( pIDX->IDX_reference_name, wxConvUTF8 ); mref.Prepend(_T(" ")); m_ptextctrl->AppendText( _( "Reference Station :" ) ); m_ptextctrl->AppendText(_T("\n")); m_ptextctrl->AppendText( mref ); m_ptextctrl->AppendText(_T("\n")); } else { m_ptextctrl->AppendText(_T("\n")); } // Show the data source wxString dsource( pIDX->source_ident, wxConvUTF8 ); dsource.Prepend(_T(" ")); m_ptextctrl->AppendText( _( "Data Source :" ) ); m_ptextctrl->AppendText(_T("\n")); m_ptextctrl->AppendText( dsource ); m_ptextctrl->ShowPosition( 0 ); }
// Define a constructor for my canvas ConsoleCanvas::ConsoleCanvas( wxWindow *frame ) { pbackBrush = NULL; m_bNeedClear = false; long style = wxSIMPLE_BORDER | wxCLIP_CHILDREN; #ifdef __WXOSX__ style |= wxSTAY_ON_TOP; #endif wxDialog::Create( frame, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, style ); m_pParent = frame; m_pitemBoxSizerLeg = new wxBoxSizer( wxVERTICAL ); pThisLegText = new wxStaticText( this, -1, _("This Leg") ); pThisLegText->Fit(); m_pitemBoxSizerLeg->Add( pThisLegText, 0, wxALIGN_CENTER_HORIZONTAL, 2 ); wxFont *qFont = GetOCPNScaledFont(_("Dialog")); wxFont *pThisLegFont = FontMgr::Get().FindOrCreateFont( 10, wxFONTFAMILY_DEFAULT, qFont->GetStyle(), wxFONTWEIGHT_BOLD, false, qFont->GetFaceName() ); pThisLegText->SetFont( *pThisLegFont ); pXTE = new AnnunText( this, -1, _("Console Legend"), _("Console Value") ); pXTE->SetALabel( _T("XTE") ); m_pitemBoxSizerLeg->Add( pXTE, 1, wxALIGN_LEFT | wxALL, 2 ); pBRG = new AnnunText( this, -1, _("Console Legend"), _("Console Value") ); pBRG->SetALabel( _T("BRG") ); m_pitemBoxSizerLeg->Add( pBRG, 1, wxALIGN_LEFT | wxALL, 2 ); pVMG = new AnnunText( this, -1, _("Console Legend"), _("Console Value") ); pVMG->SetALabel( _T("VMG") ); m_pitemBoxSizerLeg->Add( pVMG, 1, wxALIGN_LEFT | wxALL, 2 ); pRNG = new AnnunText( this, -1, _("Console Legend"), _("Console Value") ); pRNG->SetALabel( _T("RNG") ); m_pitemBoxSizerLeg->Add( pRNG, 1, wxALIGN_LEFT | wxALL, 2 ); pTTG = new AnnunText( this, -1, _("Console Legend"), _("Console Value") ); pTTG->SetALabel( _T("TTG") ); m_pitemBoxSizerLeg->Add( pTTG, 1, wxALIGN_LEFT | wxALL, 2 ); // Create CDI Display Window pCDI = new CDI( this, -1, wxSIMPLE_BORDER, _T("CDI") ); m_pitemBoxSizerLeg->AddSpacer( 5 ); m_pitemBoxSizerLeg->Add( pCDI, 0, wxALL | wxEXPAND, 2 ); SetSizer( m_pitemBoxSizerLeg ); // use the sizer for layout m_pitemBoxSizerLeg->SetSizeHints( this ); Layout(); Fit(); if( g_bShowRouteTotal ) pThisLegText->SetLabel( _("Route") ); else pThisLegText->SetLabel( _("This Leg") ); Hide(); }
void glTextureManager::BuildCompressedCache() { idx_sorted_by_distance.Clear(); // Building the cache may take a long time.... // Be a little smarter. // Build a sorted array of chart database indices, sorted on distance from the ownship currently. // This way, a user may build a few charts textures for immediate use, then "skip" out on the rest until later. int count = 0; for(int i = 0; i<ChartData->GetChartTableEntries(); i++) { /* skip if not kap */ const ChartTableEntry &cte = ChartData->GetChartTableEntry(i); ChartTypeEnum chart_type = (ChartTypeEnum)cte.GetChartType(); if(chart_type != CHART_TYPE_KAP) continue; wxString CompressedCacheFilePath = CompressedCachePath(ChartData->GetDBChartFileName(i)); wxFileName fn(CompressedCacheFilePath); // if(fn.FileExists()) /* skip if file exists */ // continue; idx_sorted_by_distance.Add(i); count++; } if(count == 0) return; wxLogMessage(wxString::Format(_T("BuildCompressedCache() count = %d"), count )); b_inCompressAllCharts = true; PurgeJobList(); ClearAllRasterTextures(); // Build another array of sorted compression targets. // We need to do this, as the chart table will not be invariant // after the compression threads start, so our index array will be invalid. ArrayOfCompressTargets ct_array; for(unsigned int j = 0; j<idx_sorted_by_distance.GetCount(); j++) { int i = idx_sorted_by_distance.Item(j); const ChartTableEntry &cte = ChartData->GetChartTableEntry(i); double distance = chart_dist(i); wxString filename(cte.GetpFullPath(), wxConvUTF8); compress_target *pct = new compress_target; pct->distance = distance; pct->chart_path = filename; ct_array.Add(pct); } // create progress dialog long style = wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_CAN_SKIP; wxString msg0; msg0 = _T(" \n \n "); #ifdef __WXQT__ msg0 = _T("Very longgggggggggggggggggggggggggggggggggggggggggggg\ngggggggggggggggggggggggggggggggggggggggggggg top line "); #endif for(int i=0 ; i < m_max_jobs+1 ; i++) msg0 += _T("\n "); m_progDialog = new wxGenericProgressDialog(); wxFont *qFont = GetOCPNScaledFont(_("Dialog")); int fontSize = qFont->GetPointSize(); wxFont *sFont; wxSize csz = cc1->GetClientSize(); if(csz.x < 500 || csz.y < 500) sFont = FontMgr::Get().FindOrCreateFont( 10, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); else sFont = FontMgr::Get().FindOrCreateFont( fontSize, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL); m_progDialog->SetFont( *sFont ); // Should we use "compact" screen layout? wxScreenDC sdc; int height, width; sdc.GetTextExtent(_T("[WWWWWWWWWWWWWWWWWWWWWWWWWWWWWW]"), &width, &height, NULL, NULL, sFont); if(width > (csz.x / 2)) m_bcompact = true; m_progDialog->Create(_("OpenCPN Compressed Cache Update"), msg0, count+1, NULL, style ); // Make sure the dialog is big enough to be readable m_progDialog->Hide(); wxSize sz = m_progDialog->GetSize(); sz.x = csz.x * 9 / 10; m_progDialog->SetSize( sz ); m_progDialog->Layout(); wxSize sza = m_progDialog->GetSize(); wxSize pprog_size = sz; m_progDialog->Centre(); m_progDialog->Show(); m_progDialog->Raise(); m_skipout = false; m_skip = false; for( m_jcnt = 0; m_jcnt<ct_array.GetCount(); m_jcnt++) { wxString filename = ct_array.Item(m_jcnt).chart_path; wxString CompressedCacheFilePath = CompressedCachePath(filename); double distance = ct_array.Item(m_jcnt).distance; ChartBase *pchart = ChartData->OpenChartFromDBAndLock( filename, FULL_INIT ); if(!pchart) /* probably a corrupt chart */ continue; // bad things if more than one texfactory for a chart g_glTextureManager->PurgeChartTextures( pchart, true ); ChartBaseBSB *pBSBChart = dynamic_cast<ChartBaseBSB*>( pchart ); if(pBSBChart) { glTexFactory *tex_fact = new glTexFactory(pchart, g_raster_format); m_progMsg.Printf( _("Distance from Ownship: %4.0f NMi\n"), distance); m_progMsg.Prepend(_T("Preparing RNC Cache...\n")); if(m_skipout) { g_glTextureManager->PurgeJobList(); ChartData->DeleteCacheChart(pchart); delete tex_fact; break; } int size_X = pBSBChart->GetSize_X(); int size_Y = pBSBChart->GetSize_Y(); int tex_dim = g_GLOptions.m_iTextureDimension; int nx_tex = ceil( (float)size_X / tex_dim ); int ny_tex = ceil( (float)size_Y / tex_dim ); int nt = ny_tex * nx_tex; wxRect rect; rect.y = 0; rect.width = tex_dim; rect.height = tex_dim; for( int y = 0; y < ny_tex; y++ ) { rect.x = 0; for( int x = 0; x < nx_tex; x++ ) { for(int level = 0; level < g_mipmap_max_level + 1; level++ ) if(!tex_fact->IsLevelInCache( level, rect, global_color_scheme )){ goto schedule; } rect.x += rect.width; } rect.y += rect.height; } // Free all possible memory ChartData->DeleteCacheChart(pchart); delete tex_fact; continue; schedule: ScheduleJob(tex_fact, wxRect(), 0, false, true, true, false); while(!m_skip) { ::wxYield(); int cnt = GetJobCount() - GetRunningJobCount(); if(!cnt) break; wxThread::Sleep(1); } if(m_skipout) { g_glTextureManager->PurgeJobList(); ChartData->DeleteCacheChart(pchart); delete tex_fact; break; } } } while(GetRunningJobCount()) { wxThread::Sleep(1); ::wxYield(); } b_inCompressAllCharts = false; delete m_progDialog; m_progDialog = NULL; }
AISTargetListDialog::AISTargetListDialog( wxWindow *parent, wxAuiManager *auimgr, AIS_Decoder *pdecoder ) : wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize( -1, -1/*780, 250*/ ), wxBORDER_NONE ) { m_pparent = parent; m_pAuiManager = auimgr; m_pdecoder = pdecoder; g_bsort_once = false; m_bautosort_force = false; wxFont *qFont = GetOCPNScaledFont(_("Dialog")); SetFont( *qFont ); s_p_sort_decoder = pdecoder; m_pMMSI_array = new ArrayOfMMSI( ArrayItemCompareMMSI ); CreateControls(); SetColorScheme(); UpdateButtons(); if( m_pAuiManager ) { wxAuiPaneInfo pane = wxAuiPaneInfo().Name( _T("AISTargetList") ).CaptionVisible( true ).Float().FloatingPosition( 50, 50 ) .FloatingSize(400, 200).BestSize(700, GetCharHeight() * 10); m_pAuiManager->LoadPaneInfo( g_AisTargetList_perspective, pane ); // Force and/or override any perspective information that is not applicable pane.Name( _T("AISTargetList") ); pane.DestroyOnClose( true ); pane.TopDockable( false ).BottomDockable( true ).LeftDockable( false ).RightDockable( false ); pane.Show( true ); bool b_reset_pos = false; if( (pane.floating_size.x != -1) && (pane.floating_size.y != -1)){ #ifdef __WXMSW__ // Support MultiMonitor setups which an allow negative window positions. // If the requested window title bar does not intersect any installed monitor, // then default to simple primary monitor positioning. RECT frame_title_rect; frame_title_rect.left = pane.floating_pos.x; frame_title_rect.top = pane.floating_pos.y; frame_title_rect.right = pane.floating_pos.x + pane.floating_size.x; frame_title_rect.bottom = pane.floating_pos.y + 30; if( NULL == MonitorFromRect( &frame_title_rect, MONITOR_DEFAULTTONULL ) ) b_reset_pos = true; #else // Make sure drag bar (title bar) of window intersects wxClient Area of screen, with a little slop... wxRect window_title_rect;// conservative estimate window_title_rect.x = pane.floating_pos.x; window_title_rect.y = pane.floating_pos.y; window_title_rect.width = pane.floating_size.x; window_title_rect.height = 30; wxRect ClientRect = wxGetClientDisplayRect(); ClientRect.Deflate(60, 60);// Prevent the new window from being too close to the edge if(!ClientRect.Intersects(window_title_rect)) b_reset_pos = true; #endif if( b_reset_pos ) pane.FloatingPosition( 50, 50 ); } // If the list got accidentally dropped on top of the chart bar, move it away.... if( pane.IsDocked() && ( pane.dock_row == 0 ) ) { pane.Float(); pane.Row( 1 ); pane.Position( 0 ); } pane.Caption( wxGetTranslation( _("AIS target list") ) ); pane.Show(); // Some special setup for touch screens if(g_btouch){ pane.Float(); pane.Dockable( false ); wxSize screen_size = ::wxGetDisplaySize(); pane.FloatingSize(screen_size.x * 6/10, screen_size.y * 8/10); pane.FloatingPosition(screen_size.x * 2/10, screen_size.y * 1/10); } m_pAuiManager->AddPane( this, pane ); m_pAuiManager->Update(); g_AisTargetList_perspective = m_pAuiManager->SavePaneInfo( pane ); pConfig->UpdateSettings(); m_pAuiManager->Connect( wxEVT_AUI_PANE_CLOSE, wxAuiManagerEventHandler( AISTargetListDialog::OnPaneClose ), NULL, this ); } else { // Make an estimate of the default dialog size // for the case when the AUI Perspective for this dialog is undefined wxSize esize; esize.x = 700; esize.y = GetCharHeight() * 10; //18; SetSize( esize ); } RecalculateSize(); }
void BuildCompressedCache() { idx_sorted_by_distance.Clear(); // Building the cache may take a long time.... // Be a little smarter. // Build a sorted array of chart database indices, sorted on distance from the ownship currently. // This way, a user may build a few charts textures for immediate use, then "skip" out on the rest until later. int count = 0; for(int i = 0; i<ChartData->GetChartTableEntries(); i++) { /* skip if not kap */ const ChartTableEntry &cte = ChartData->GetChartTableEntry(i); ChartTypeEnum chart_type = (ChartTypeEnum)cte.GetChartType(); if(chart_type != CHART_TYPE_KAP) continue; wxString CompressedCacheFilePath = CompressedCachePath(ChartData->GetDBChartFileName(i)); wxFileName fn(CompressedCacheFilePath); // if(fn.FileExists()) /* skip if file exists */ // continue; idx_sorted_by_distance.Add(i); count++; } if(count == 0) return; wxLogMessage(wxString::Format(_T("BuildCompressedCache() count = %d"), count )); b_inCompressAllCharts = true; g_glTextureManager->PurgeJobList(); g_glTextureManager->ClearAllRasterTextures(); // Build another array of sorted compression targets. // We need to do this, as the chart table will not be invariant // after the compression threads start, so our index array will be invalid. ArrayOfCompressTargets ct_array; for(unsigned int j = 0; j<idx_sorted_by_distance.GetCount(); j++) { int i = idx_sorted_by_distance.Item(j); const ChartTableEntry &cte = ChartData->GetChartTableEntry(i); double distance = chart_dist(i); wxString filename(cte.GetpFullPath(), wxConvUTF8); compress_target *pct = new compress_target; pct->distance = distance; pct->chart_path = filename; ct_array.Add(pct); } // create progress dialog long style = wxPD_SMOOTH | wxPD_ELAPSED_TIME | wxPD_ESTIMATED_TIME | wxPD_REMAINING_TIME | wxPD_CAN_SKIP; // style |= wxSTAY_ON_TOP; wxString msg0; #ifdef __WXQT__ msg0 = _T("Very longgggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg top line "); #endif wxProgressDialog prog(_("OpenCPN Compressed Cache Update"), msg0, count+1, cc1, style ); wxSize csz = cc1->GetClientSize(); if(csz.x < 600 || csz.y < 600){ wxFont *qFont = GetOCPNScaledFont(_("Dialog")); // to get type, weight, etc... wxFont *sFont = FontMgr::Get().FindOrCreateFont( 10, qFont->GetFamily(), qFont->GetStyle(), qFont->GetWeight()); prog.SetFont( *sFont ); } // Make sure the dialog is big enough to be readable prog.Hide(); wxSize sz = prog.GetSize(); sz.x = csz.x * 8 / 10; // sz.y += thread_count * 40; // allow for multiline messages prog.SetSize( sz ); wxSize pprog_size = sz; prog.Centre(); prog.Show(); prog.Raise(); bool b_skipout = false; for(unsigned int j = 0; j<ct_array.GetCount(); j++) { wxString filename = ct_array.Item(j).chart_path; wxString CompressedCacheFilePath = CompressedCachePath(filename); double distance = ct_array.Item(j).distance; ChartBase *pchart = ChartData->OpenChartFromDBAndLock( filename, FULL_INIT ); if(!pchart) /* probably a corrupt chart */ continue; // bad things if more than one texfactory for a chart g_glTextureManager->PurgeChartTextures( pchart, true ); // msgt.Printf( _T("Starting chart compression on thread %d, count %d "), t, pprog_count); ChartBaseBSB *pBSBChart = dynamic_cast<ChartBaseBSB*>( pchart ); if(pBSBChart) { glTexFactory *tex_fact = new glTexFactory(pchart, g_raster_format); bool skip = false; wxString msg; msg.Printf( _("Distance from Ownship: %4.0f NMi"), distance); if(pprog_size.x > 600){ msg += _T(" Chart:"); msg += pchart->GetFullPath(); } // wxString cntmsg = wxString::Format(_T("%04d/%04d "), 0, origcnt); prog.Update(j, msg, &skip ); prog.SetSize(pprog_size); if(skip) { g_glTextureManager->PurgeJobList(); ChartData->DeleteCacheChart(pchart); delete tex_fact; break; } int size_X = pBSBChart->GetSize_X(); int size_Y = pBSBChart->GetSize_Y(); int tex_dim = g_GLOptions.m_iTextureDimension; int nx_tex = ceil( (float)size_X / tex_dim ); int ny_tex = ceil( (float)size_Y / tex_dim ); int nt = ny_tex * nx_tex; wxRect rect; rect.y = 0; rect.width = tex_dim; rect.height = tex_dim; for( int y = 0; y < ny_tex; y++ ) { rect.x = 0; for( int x = 0; x < nx_tex; x++ ) { for(int level = 0; level < g_mipmap_max_level + 1; level++ ) if(!tex_fact->IsLevelInCache( level, rect, global_color_scheme )) goto schedule; rect.x += rect.width; } rect.y += rect.height; } // Free all possible memory ChartData->DeleteCacheChart(pchart); delete tex_fact; continue; schedule: g_glTextureManager->ScheduleJob(tex_fact, wxRect(), 0, false, true, true, false); while(!skip) { ::wxYield(); int cnt = g_glTextureManager->GetJobCount() - g_glTextureManager->GetRunningJobCount(); if(!cnt) break; wxThread::Sleep(1); } } } while(g_glTextureManager->GetRunningJobCount()) { wxThread::Sleep(1); ::wxYield(); } b_inCompressAllCharts = false; }
void about::CreateControls( void ) { // Set the nominal vertical size of the embedded controls int v_size = g_bresponsive ? -1 : 300; wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL ); SetSizer( mainSizer ); wxStaticText *pST1 = new wxStaticText( this, -1, _("The Open Source Chart Plotter/Navigator"), wxDefaultPosition, wxSize( -1, 50 /* 500, 30 */ ), wxALIGN_CENTRE /* | wxALIGN_CENTER_VERTICAL */ ); wxFont *qFont = GetOCPNScaledFont(_("Dialog")); wxFont *headerFont = FontMgr::Get().FindOrCreateFont( 14, wxFONTFAMILY_DEFAULT, qFont->GetStyle(), wxFONTWEIGHT_BOLD, false, qFont->GetFaceName() ); pST1->SetFont( *headerFont ); mainSizer->Add( pST1, 0, wxALL | wxEXPAND, 8 ); #ifndef __OCPN__ANDROID__ wxSizer *buttonSizer = new wxBoxSizer( m_displaySize.x < m_displaySize.y ? wxVERTICAL : wxHORIZONTAL ); mainSizer->Add( buttonSizer, 0, wxALL, 0 ); wxButton* donateButton = new wxBitmapButton( this, ID_DONATE, g_StyleManager->GetCurrentStyle()->GetIcon( _T("donate") ), wxDefaultPosition, wxDefaultSize, 0 ); buttonSizer->Add( new wxButton( this, ID_COPYLOG, _("Copy Log File to Clipboard") ), 1, wxALL | wxEXPAND, 3 ); buttonSizer->Add( new wxButton( this, ID_COPYINI, _("Copy Settings File to Clipboard") ), 1, wxALL | wxEXPAND, 3 ); buttonSizer->Add( donateButton, 1, wxALL | wxEXPAND | wxALIGN_RIGHT, 3 ); #endif // Main Notebook pNotebook = new wxNotebook( this, ID_NOTEBOOK_HELP, wxDefaultPosition, wxSize( -1, -1 ), wxNB_TOP ); pNotebook->InheritAttributes(); mainSizer->Add( pNotebook, 1, wxALIGN_CENTER_VERTICAL | wxEXPAND | wxALL, 5 ); // About Panel itemPanelAbout = new wxPanel( pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); itemPanelAbout->InheritAttributes(); pNotebook->AddPage( itemPanelAbout, _("About"), TRUE /* Default page */ ); pAboutHTMLCtl = new wxHtmlWindow( itemPanelAbout, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO | wxHW_NO_SELECTION); pAboutHTMLCtl->SetBorders( 5 ); wxBoxSizer* aboutSizer = new wxBoxSizer( wxVERTICAL ); aboutSizer->Add( pAboutHTMLCtl, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL, 5 ); itemPanelAbout->SetSizer( aboutSizer ); // Authors Panel itemPanelAuthors = new wxPanel( pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); itemPanelAuthors->InheritAttributes(); pNotebook->AddPage( itemPanelAuthors, _("Authors") ); pAuthorHTMLCtl = new wxHtmlWindow( itemPanelAuthors, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO | wxHW_NO_SELECTION); pAuthorHTMLCtl->SetBorders( 5 ); wxBoxSizer* authorSizer = new wxBoxSizer( wxVERTICAL ); authorSizer->Add( pAuthorHTMLCtl, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL, 5 ); itemPanelAuthors->SetSizer( authorSizer ); // License Panel itemPanelLicense = new wxPanel( pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); itemPanelLicense->InheritAttributes(); pNotebook->AddPage( itemPanelLicense, _("License") ); pLicenseHTMLCtl = new wxHtmlWindow( itemPanelLicense, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO | wxHW_NO_SELECTION); pLicenseHTMLCtl->SetBorders( 5 ); wxBoxSizer* licenseSizer = new wxBoxSizer( wxVERTICAL ); licenseSizer->Add( pLicenseHTMLCtl, 1, wxALIGN_CENTER_HORIZONTAL | wxEXPAND | wxALL, 5 ); itemPanelLicense->SetSizer( licenseSizer ); // Help Panel itemPanelTips = new wxPanel( pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxTAB_TRAVERSAL ); itemPanelTips->InheritAttributes(); pNotebook->AddPage( itemPanelTips, _("Help") ); wxBoxSizer* helpSizer = new wxBoxSizer( wxVERTICAL ); itemPanelTips->SetSizer( helpSizer ); // Close Button wxButton* closeButton = new wxButton( this, xID_OK, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); closeButton->SetDefault(); closeButton->InheritAttributes(); mainSizer->Add( closeButton, 0, wxALIGN_RIGHT | wxALL, 5 ); }
CanvasOptions::CanvasOptions( wxWindow *parent) :wxDialog() { m_ENCAvail = true; wxFont *qFont = GetOCPNScaledFont(_("Dialog")); SetFont( *qFont ); //SetBackgroundStyle( wxBG_STYLE_TRANSPARENT ); long mstyle = wxNO_BORDER | wxFRAME_NO_TASKBAR | wxFRAME_SHAPED; wxDialog::Create(parent, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, mstyle); wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); SetSizer(topsizer); m_sWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL | wxSUNKEN_BORDER); topsizer->Add(m_sWindow, 1, wxEXPAND ); m_sWindow->SetScrollRate(0, 5); int border_size = 4; int group_item_spacing = 0; int interGroupSpace = border_size * 2; wxSizerFlags verticleInputFlags = wxSizerFlags(0).Align(wxALIGN_LEFT).Border(wxALL, group_item_spacing); wxSizerFlags inputFlags = wxSizerFlags(0).Align(wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL).Border(wxALL, group_item_spacing); wxScrolledWindow *pDisplayPanel = m_sWindow; wxBoxSizer* generalSizer = new wxBoxSizer(wxVERTICAL); pDisplayPanel->SetSizer(generalSizer); // Options Label wxStaticText* optionsLabelBox = new wxStaticText(pDisplayPanel, wxID_ANY, _("Chart Panel Options")); generalSizer->Add(optionsLabelBox, 0, wxALL | wxEXPAND , border_size); wxStaticLine *m_staticLine121 = new wxStaticLine(pDisplayPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL); generalSizer->Add(m_staticLine121, 0, wxALL | wxEXPAND , border_size); // spacer generalSizer->Add(0, interGroupSpace); // Control Options // wxStaticBoxSizer* boxCont = new wxStaticBoxSizer(new wxStaticBox(pDisplayPanel, wxID_ANY, _("Control Options")), wxVERTICAL); // generalSizer->Add(boxCont, 0, wxALL | wxEXPAND, border_size); // pCBToolbar = new wxCheckBox(pDisplayPanel, ID_TOOLBARCHECKBOX, _("Show Toolbar")); // boxCont->Add(pCBToolbar, verticleInputFlags); // pCBToolbar->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); // // // spacer // generalSizer->Add(0, interGroupSpace); // Nav Mode wxStaticBoxSizer* boxNavMode = new wxStaticBoxSizer(new wxStaticBox(pDisplayPanel, wxID_ANY, _("Navigation Mode")), wxVERTICAL); generalSizer->Add(boxNavMode, 0, wxALL | wxEXPAND, border_size); wxBoxSizer* rowOrientation = new wxBoxSizer(wxHORIZONTAL); boxNavMode->Add(rowOrientation); pCBNorthUp = new wxRadioButton(pDisplayPanel, wxID_ANY, _("North Up")); rowOrientation->Add(pCBNorthUp, inputFlags); pCBNorthUp->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBCourseUp = new wxRadioButton(pDisplayPanel, ID_COURSEUPCHECKBOX, _("Course Up")); rowOrientation->Add(pCBCourseUp, wxSizerFlags(0).Align(wxALIGN_CENTRE_VERTICAL).Border(wxLEFT, group_item_spacing * 2)); pCBCourseUp->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBLookAhead = new wxCheckBox(pDisplayPanel, ID_CHECK_LOOKAHEAD, _("Look Ahead Mode")); boxNavMode->Add(pCBLookAhead, verticleInputFlags); pCBLookAhead->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); // spacer generalSizer->Add(0, interGroupSpace); // Display Options wxStaticBoxSizer* boxDisp = new wxStaticBoxSizer(new wxStaticBox(pDisplayPanel, wxID_ANY, _("Display Options")), wxVERTICAL); generalSizer->Add(boxDisp, 0, wxALL | wxEXPAND, border_size); pCDOQuilting = new wxCheckBox(pDisplayPanel, ID_QUILTCHECKBOX1, _("Enable Chart Quilting")); boxDisp->Add(pCDOQuilting, verticleInputFlags); pCDOQuilting->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pSDisplayGrid = new wxCheckBox(pDisplayPanel, ID_CHECK_DISPLAYGRID, _("Show Grid")); boxDisp->Add(pSDisplayGrid, verticleInputFlags); pSDisplayGrid->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCDOOutlines = new wxCheckBox(pDisplayPanel, ID_OUTLINECHECKBOX1, _("Show Chart Outlines")); boxDisp->Add(pCDOOutlines, verticleInputFlags); pCDOOutlines->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pSDepthUnits = new wxCheckBox(pDisplayPanel, ID_SHOWDEPTHUNITSBOX1, _("Show Depth Units")); boxDisp->Add(pSDepthUnits, verticleInputFlags); pSDepthUnits->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); // AIS Options wxStaticBoxSizer* boxAIS = new wxStaticBoxSizer(new wxStaticBox(pDisplayPanel, wxID_ANY, _("AIS")), wxVERTICAL); generalSizer->Add(boxAIS, 0, wxALL | wxEXPAND, border_size); pCBShowAIS = new wxCheckBox(pDisplayPanel, ID_SHOW_AIS_CHECKBOX, _("Show AIS targets")); boxAIS->Add(pCBShowAIS, verticleInputFlags); pCBShowAIS->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBAttenAIS = new wxCheckBox(pDisplayPanel, ID_ATTEN_AIS_CHECKBOX, _("Minimize less critical targets")); boxAIS->Add(pCBAttenAIS, verticleInputFlags); pCBAttenAIS->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); // spacer generalSizer->Add(0, interGroupSpace); // Tide/Current Options wxStaticBoxSizer* boxTC = new wxStaticBoxSizer(new wxStaticBox(pDisplayPanel, wxID_ANY, _("Tides and Currents")), wxVERTICAL); generalSizer->Add(boxTC, 0, wxALL | wxEXPAND, border_size); pCDOTides = new wxCheckBox(pDisplayPanel, ID_TIDES_CHECKBOX, _("Show Tide stations")); boxTC->Add(pCDOTides, verticleInputFlags); pCDOTides->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCDOCurrents = new wxCheckBox(pDisplayPanel, ID_CURRENTS_CHECKBOX, _("Show Currents")); boxTC->Add(pCDOCurrents, verticleInputFlags); pCDOCurrents->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); // spacer generalSizer->Add(0, interGroupSpace); // ENC Options wxStaticBoxSizer* boxENC = new wxStaticBoxSizer(new wxStaticBox(pDisplayPanel, wxID_ANY, _("Vector Charts")), wxVERTICAL); generalSizer->Add(boxENC, 0, wxALL | wxEXPAND, border_size); pCDOENCText = new wxCheckBox(pDisplayPanel, ID_ENCTEXT_CHECKBOX1, _("Show text")); boxENC->Add(pCDOENCText, verticleInputFlags); pCDOENCText->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBENCDepth = new wxCheckBox(pDisplayPanel, ID_ENCDEPTH_CHECKBOX1, _("Show depths")); boxENC->Add(pCBENCDepth, verticleInputFlags); pCBENCDepth->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBENCBuoyLabels = new wxCheckBox(pDisplayPanel, ID_ENCBUOYLABEL_CHECKBOX1, _("Buoy/Light Labels")); boxENC->Add(pCBENCBuoyLabels, verticleInputFlags); pCBENCBuoyLabels->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBENCLights = new wxCheckBox(pDisplayPanel, ID_ENCBUOYLABEL_CHECKBOX1, _("Lights")); boxENC->Add(pCBENCLights, verticleInputFlags); pCBENCLights->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBENCLightDesc = new wxCheckBox(pDisplayPanel, ID_ENCBUOY_CHECKBOX1, _("Light Descriptions")); boxENC->Add(pCBENCLightDesc, verticleInputFlags); pCBENCLightDesc->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); pCBENCAnchorDetails = new wxCheckBox(pDisplayPanel, ID_ENCANCHOR_CHECKBOX1, _("Anchoring Info")); boxENC->Add(pCBENCAnchorDetails, verticleInputFlags); pCBENCAnchorDetails->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); // spacer boxENC->Add(0, interGroupSpace); // display category boxENC->Add( new wxStaticText(pDisplayPanel, wxID_ANY, _("Display Category")), verticleInputFlags); wxString pDispCatStrings[] = {_("Base"), _("Standard"), _("All"), _("User Standard")}; m_pDispCat = new wxChoice(pDisplayPanel, ID_CODISPCAT, wxDefaultPosition, wxDefaultSize, 4, pDispCatStrings); boxENC->Add(m_pDispCat, 0, wxLEFT, 4*GetCharWidth()); m_pDispCat->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( CanvasOptions::OnOptionChange ), NULL, this ); RefreshControlValues(); SetAutoLayout( true ); topsizer->Fit( this ); }