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 ); }
Request::RequestDialog::RequestDialog(const char *title, const char *primary, const char *secondary, const char *ok_text, GCallback ok_cb, const char *cancel_text, GCallback cancel_cb, void *user_data) : SplitDialog(title), ok_cb(ok_cb), cancel_cb(cancel_cb), user_data(user_data) { SetColorScheme("generalwindow"); lbox = new CppConsUI::ListBox(AUTOSIZE, AUTOSIZE); if (primary) lbox->AppendWidget(*(new CppConsUI::Label(AUTOSIZE, 1, primary))); if (primary && secondary) lbox->AppendWidget(*(new CppConsUI::Spacer(AUTOSIZE, 1))); if (secondary) lbox->AppendWidget(*(new CppConsUI::Label(AUTOSIZE, 1, secondary))); if (primary || secondary) lbox->AppendWidget(*(new CppConsUI::HorizontalLine(AUTOSIZE))); SetContainer(*lbox); if (ok_text) AddButton(ok_text, RESPONSE_OK); if (ok_text && cancel_text) AddSeparator(); if (cancel_text) AddButton(cancel_text, RESPONSE_CANCEL); signal_response.connect(sigc::mem_fun(this, &RequestDialog::ResponseHandler)); }
BuddyList::BuddyList() : Window(0, 0, 80, 24) { SetColorScheme("buddylist"); CppConsUI::HorizontalListBox *lbox = new CppConsUI::HorizontalListBox(AUTOSIZE, AUTOSIZE); lbox->AppendWidget(*(new CppConsUI::Spacer(1, AUTOSIZE))); treeview = new CppConsUI::TreeView(AUTOSIZE, AUTOSIZE); lbox->AppendWidget(*treeview); lbox->AppendWidget(*(new CppConsUI::Spacer(1, AUTOSIZE))); AddWidget(*lbox, 0, 0); /* TODO Check if this has been moved to purple_blist_init(). Remove these * lines if it was as this will probably move to purple_init(), the * buddylist object should be available a lot more early and the uiops * should be set a lot more early. (All in all a lot of work.) */ buddylist = purple_blist_new(); buddylist->ui_data = this; purple_set_blist(buddylist); // load the pounces purple_pounces_load(); // init prefs purple_prefs_add_none(CONF_PREFIX "/blist"); purple_prefs_add_bool(CONF_PREFIX "/blist/show_empty_groups", false); purple_prefs_add_bool(CONF_PREFIX "/blist/show_offline_buddies", true); purple_prefs_add_string(CONF_PREFIX "/blist/colorization_mode", "none"); UpdateCachedPreference(CONF_PREFIX "/blist/show_empty_groups"); UpdateCachedPreference(CONF_PREFIX "/blist/show_offline_buddies"); UpdateCachedPreference(CONF_PREFIX "/blist/colorization_mode"); // connect callbacks purple_prefs_connect_callback(this, CONF_PREFIX "/blist", blist_pref_change_, this); // setup the callbacks for the buddylist memset(¢erim_blist_ui_ops, 0, sizeof(centerim_blist_ui_ops)); centerim_blist_ui_ops.new_list = new_list_; centerim_blist_ui_ops.new_node = new_node_; //centerim_blist_ui_ops.show = show_; centerim_blist_ui_ops.update = update_; centerim_blist_ui_ops.remove = remove_; centerim_blist_ui_ops.destroy = destroy_; //centerim_blist_ui_ops.set_visible = set_visible_; centerim_blist_ui_ops.request_add_buddy = request_add_buddy_; centerim_blist_ui_ops.request_add_chat = request_add_chat_; centerim_blist_ui_ops.request_add_group = request_add_group_; // since libpurple 2.6.0 //centerim_blist_ui_ops.save_node = save_node_; //centerim_blist_ui_ops.remove_node = remove_node_; //centerim_blist_ui_ops.save_account = save_account_; purple_blist_set_ui_ops(¢erim_blist_ui_ops); COREMANAGER->TimeoutOnceConnect(sigc::mem_fun(this, &BuddyList::Load), 0); }
void watchdog_pi::RearrangeWindow() { if (NULL == m_WatchdogDialog) return; SetColorScheme(PI_ColorScheme()); m_WatchdogDialog->Fit(); }
WiFiStatWin::WiFiStatWin(wxFrame *frame): wxWindow(frame, wxID_ANY,wxPoint(20,20), wxSize(5,5), wxSIMPLE_BORDER) { SetBackgroundStyle(wxBG_STYLE_CUSTOM); // on WXMSW, this prevents flashing on color scheme change SetColorScheme((ColorScheme)0); for(int ista = 0 ; ista < NSIGBARS ; ista++) m_quality[ista] = 0; m_bserverstat = true; }
bool AISTargetQueryDialog::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 ); if( !wxDialog::Create( parent, id, caption, pos, size, wstyle ) ) return false; m_parent = parent; wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetQuery") ); int font_size = wxMax(8, dFont->GetPointSize()); //wxLogMessage("%d",dFont->GetPointSize()); wxString face = dFont->GetFaceName(); #ifdef __WXGTK__ face = _T("Monospace"); #endif m_basefont = wxTheFontList->FindOrCreateFont( font_size, wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, dFont->GetWeight(), false, face ); SetFont( *m_basefont ); m_adjustedFontSize = 12;//dFont->GetPointSize(); m_control_font_size = 10;//dFont->GetPointSize(); //wxLogMessage("%d", dFont->GetPointSize()); CreateControls(); SetColorScheme( global_color_scheme ); //Set the maximum size of the entire settings dialog wxSize sz = g_Platform->getDisplaySize(); SetSizeHints( 50, 50, sz.x-20, sz.y-40 ); if(!m_bautosize){ Fit(); // Sets the horizontal size OK SetSize( -1, m_adjustedFontSize * 30); // Estimated vertical size } return true; }
void GoToPositionDialog::CreateControls() { GoToPositionDialog* itemDialog1 = this; wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL ); itemDialog1->SetSizer( itemBoxSizer2 ); wxStaticBox* itemStaticBoxSizer4Static = new wxStaticBox( itemDialog1, wxID_ANY, _("Position") ); wxStaticBoxSizer* itemStaticBoxSizer4 = new wxStaticBoxSizer( itemStaticBoxSizer4Static, wxVERTICAL ); itemBoxSizer2->Add( itemStaticBoxSizer4, 0, wxEXPAND | wxALL, 5 ); wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Latitude"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer4->Add( itemStaticText5, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5 ); m_MarkLatCtl = new LatLonTextCtrl( itemDialog1, ID_LATCTRL, _T(""), wxDefaultPosition, wxSize( 180, -1 ), 0 ); itemStaticBoxSizer4->Add( m_MarkLatCtl, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 ); wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("Longitude"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer4->Add( itemStaticText6, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5 ); m_MarkLonCtl = new LatLonTextCtrl( itemDialog1, ID_LONCTRL, _T(""), wxDefaultPosition, wxSize( 180, -1 ), 0 ); itemStaticBoxSizer4->Add( m_MarkLonCtl, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 ); wxBoxSizer* itemBoxSizer16 = new wxBoxSizer( wxHORIZONTAL ); itemBoxSizer2->Add( itemBoxSizer16, 0, wxALIGN_RIGHT | wxALL, 5 ); m_CancelButton = new wxButton( itemDialog1, ID_GOTOPOS_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer16->Add( m_CancelButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_OKButton = new wxButton( itemDialog1, ID_GOTOPOS_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer16->Add( m_OKButton, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_OKButton->SetDefault(); SetColorScheme( (ColorScheme) 0 ); }
void findit_pi::OnToolbarToolCallback(int id) { SendPluginMessage(_T("LOGBOOK_IS_READY_FOR_REQUEST"), wxEmptyString); if(NULL == m_pFindItWindow) m_pFindItWindow = new MainDialog(this->m_parent_window,this); else { if(m_pFindItWindow->IsIconized()) m_pFindItWindow->Iconize(false); } SetColorScheme(PI_ColorScheme()); m_pFindItWindow->Show(); m_pFindItWindow->SetFocus(); }
void pfGUIControlMod::Read( hsStream *s, hsResMgr *mgr ) { plSingleModifier::Read(s, mgr); s->ReadLE( &fTagID ); fVisible = s->ReadBool(); // Read the handler in ISetHandler( pfGUICtrlProcWriteableObject::Read( s ) ); // Read in the dynTextMap if there is one if( s->ReadBool() ) { mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextLayer ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefDynTextMap ), plRefFlags::kActiveRef ); } else { fDynTextLayer = nil; fDynTextMap = nil; } if( s->ReadBool() ) { SetColorScheme( nil ); fColorScheme = new pfGUIColorScheme(); fColorScheme->Read( s ); } // Read in our sound indices uint8_t i, count = s->ReadByte(); if( count == 0 ) fSoundIndices.Reset(); else { fSoundIndices.SetCountAndZero( count ); for( i = 0; i < count; i++ ) fSoundIndices[ i ] = (int)s->ReadLE32(); } if( HasFlag( kHasProxy ) ) mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefProxy ), plRefFlags::kActiveRef ); mgr->ReadKeyNotifyMe( s, new plGenRefMsg( GetKey(), plRefMsg::kOnCreate, -1, kRefSkin ), plRefFlags::kActiveRef ); }
void AISTargetQueryDialog::UpdateText() { wxString html; if( !m_pQueryTextCtl ) return; int scroll_x, scroll_y; m_pQueryTextCtl->GetViewStart(&scroll_x, &scroll_y); AIS_Target_Data *td = g_pAIS->Get_Target_Data_From_MMSI( m_MMSI ); AdjustBestSize(td); DimeControl( this ); wxColor bg = GetBackgroundColour(); m_pQueryTextCtl->SetBackgroundColour( bg ); SetBackgroundColour( bg ); if( td ) { if( td->b_PersistTrack ) m_createTrkBtn->SetLabel(_("Stop Tracking")); else m_createTrkBtn->SetLabel(_("Record Track")); m_createWptBtn->Enable( td->b_positionOnceValid ); m_createTrkBtn->Enable( td->b_show_track ); RenderHTMLQuery(td); } #ifdef __WXQT__ SetColorScheme( m_colorscheme ); #endif m_pQueryTextCtl->Scroll(scroll_x, scroll_y); }
bool AISTargetQueryDialog::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 ); if( !wxDialog::Create( parent, id, caption, pos, size, wstyle ) ) return false; wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetQuery") ); 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(); SetColorScheme( global_color_scheme ); // This ensures that the dialog cannot be sized smaller // than the minimum size GetSizer()->SetSizeHints( this ); return true; }
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(); }
pfGUIControlMod::~pfGUIControlMod() { ISetHandler( nil ); SetDropTargetHdlr( nil ); SetColorScheme( nil ); }
void AISTargetQueryDialog::UpdateText() { wxString html; if( !m_pQueryTextCtl ) return; int scroll_x, scroll_y; m_pQueryTextCtl->GetViewStart(&scroll_x, &scroll_y); DimeControl( this ); wxColor bg = GetBackgroundColour(); m_pQueryTextCtl->SetBackgroundColour( bg ); SetBackgroundColour( bg ); // if( m_MMSI == 0 ) { // Faulty MMSI could be reported as 0 AIS_Target_Data *td = g_pAIS->Get_Target_Data_From_MMSI( m_MMSI ); if( td ) { if( td->b_PersistTrack ) { m_createTrkBtn->SetLabel(_("Stop Tracking")); } else { m_createTrkBtn->SetLabel(_("Record Track")); } wxFont *dFont = FontMgr::Get().GetFont( _("AISTargetQuery") ); wxString face = dFont->GetFaceName(); int sizes[7]; for( int i=-2; i<5; i++ ) { sizes[i+2] = dFont->GetPointSize() + i + (i>0?i:0); } html.Printf( _T("<html><body bgcolor=#%02x%02x%02x><center>"), bg.Red(), bg.Green(), bg.Blue() ); html << td->BuildQueryResult(); html << _T("</center></font></body></html>"); m_pQueryTextCtl->SetFonts( face, face, sizes ); wxCharBuffer buf = html.ToUTF8(); if( buf.data() ) // string OK? m_pQueryTextCtl->SetPage( html ); if(!m_bsize_set){ SetBestSize(); m_bsize_set = true; } m_createWptBtn->Enable( td->b_positionOnceValid ); m_createTrkBtn->Enable( td->b_show_track ); } // } #ifdef __WXQT__ SetColorScheme( m_colorscheme ); #endif m_pQueryTextCtl->Scroll(scroll_x, scroll_y); }
void about::Populate( void ) { wxColor bg = GetBackgroundColour(); wxColor fg = wxColour( 0, 0, 0 ); // The HTML Header wxString aboutText = wxString::Format( _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") ); // Do weird font size calculation int points = dFont->GetPointSize(); #ifndef __WXOSX__ ++points; #endif int sizes[7]; for ( int i = -2; i < 5; i++ ) { sizes[i+2] = points + i + ( i > 0 ? i : 0 ); } wxString face = dFont->GetFaceName(); pAboutHTMLCtl->SetFonts( face, face, sizes ); if( wxFONTSTYLE_ITALIC == dFont->GetStyle() ) aboutText.Append( _T("<i>") ); #ifdef __OCPN__ANDROID__ aboutText.Append( AboutText + Komodo Exercise 2016VersionAndroid + Komodo Exercise 2016InfoAlt ); #else aboutText.Append( AboutText + OpenCPNVersion + OpenCPNInfo ); #endif // Show where the log file is going to be placed wxString log_string = _T("Logfile location: ") + g_Platform->GetLogFileName(); log_string.Replace(_T("/"), _T("/ ")); // allow line breaks, in a cheap way... aboutText.Append( log_string ); // Show where the config file is going to be placed wxString config_string = _T("<br><br>Config file location: ") + g_Platform->GetConfigFileName(); config_string.Replace(_T("/"), _T("/ ")); // allow line breaks, in a cheap way... aboutText.Append( config_string ); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText.Append( _T("</i>") ); // The HTML Footer aboutText.Append( _T("</font></body></html>") ); pAboutHTMLCtl->SetPage( aboutText ); ///Authors page // The HTML Header wxString authorText = wxString::Format( _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); pAuthorHTMLCtl->SetFonts( face, face, sizes ); wxString authorFixText = AuthorText; authorFixText.Replace(_T("\n"), _T("<br>")); authorText.Append( authorFixText ); // The HTML Footer authorText.Append( _T("</font></body></html>") ); pAuthorHTMLCtl->SetPage( authorFixText ); ///License page // The HTML Header wxString licenseText = wxString::Format( _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); pLicenseHTMLCtl->SetFonts( face, face, sizes ); wxTextFile license_filea( m_DataLocn + _T("license.txt") ); if ( license_filea.Open() ) { for ( wxString str = license_filea.GetFirstLine(); !license_filea.Eof() ; str = license_filea.GetNextLine() ) licenseText.Append( str + _T("<br>") ); license_filea.Close(); } else { wxLogMessage( _T("Could not open License file: ") + m_DataLocn ); } wxString suppLicense = g_Platform->GetSupplementalLicenseString(); wxStringTokenizer st(suppLicense, _T("\n"), wxTOKEN_DEFAULT); while( st.HasMoreTokens() ) { wxString s1 = st.GetNextToken(); licenseText.Append( s1 + _T("<br>") ); } // The HTML Footer licenseText.Append( _T("</font></body></html>") ); pLicenseHTMLCtl->SetPage( licenseText ); #if 0 wxTextFile license_file( m_DataLocn + _T("license.txt") ); if ( license_file.Open() ) { for ( wxString str = license_file.GetFirstLine(); !license_file.Eof() ; str = license_file.GetNextLine() ) pLicenseTextCtl->AppendText( str + '\n' ); license_file.Close(); } else { wxLogMessage( _T("Could not open License file: ") + m_DataLocn ); } wxString suppLicense = g_Platform->GetSupplementalLicenseString(); pLicenseTextCtl->AppendText( suppLicense ); pLicenseTextCtl->SetInsertionPoint( 0 ); #endif SetColorScheme(); }
void S57QueryDialog::SetHTMLPage( wxString& page ) { m_phtml->SetPage( page ); SetColorScheme(); }
void about::Update() { wxColor bg = GetBackgroundColour(); wxColor fg = wxColour(0,0,0); //FontMgr::Get().GetFontColor( _("Dialog") ); wxString aboutText; aboutText.Printf( _T("<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>"), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") ); wxString face = dFont->GetFaceName(); #ifdef __WXOSX__ int points = dFont->GetPointSize(); #else int points = dFont->GetPointSize() + 1; #endif int sizes[7]; for ( int i=-2; i<5; i++ ) { sizes[i+2] = points + i + (i>0?i:0); } pAboutHTMLCtl->SetFonts(face, face, sizes); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText += _T("<i>"); wxString *pAboutString = new wxString( AboutText, wxConvUTF8 ); pAboutString->Append( OpenCPNVersion ); pAboutString->Append( wxString( OpenCPNInfo, wxConvUTF8 ) ); // Show the user where the log file is going to be wxString log = _T(" Logfile location: "); log.Append( g_Platform->GetLogFileName() ); pAboutString->Append(log); // Show the user where the config file is going to be wxString conf = _T("<br><br> Config file location: "); conf.Append( g_Platform->GetConfigFileName() ); pAboutString->Append(conf); aboutText << *pAboutString; delete pAboutString; aboutText << _T("</font>"); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText << _T("</i>"); aboutText << _T("</body></html>"); pAboutHTMLCtl->SetPage( aboutText ); pAuthorTextCtl->Clear(); wxString *pAuthorsString = new wxString( AuthorText, wxConvUTF8 ); pAuthorTextCtl->WriteText( *pAuthorsString ); pAuthorTextCtl->SetInsertionPoint( 0 ); delete pAuthorsString; pLicenseTextCtl->Clear(); wxString license_loc(m_DataLocn ); license_loc.Append( _T("license.txt") ); wxTextFile license_file( license_loc ); if( license_file.Open() ) { wxString str; str = license_file.GetFirstLine(); pLicenseTextCtl->WriteText( str ); while( !license_file.Eof() ) { str = license_file.GetNextLine(); str.Append( _T("\n") ); pLicenseTextCtl->AppendText( str ); } license_file.Close(); } else { wxString msg( _T("Could not open License file: ") ); msg.Append( license_loc ); wxLogMessage( msg ); } pLicenseTextCtl->SetInsertionPoint( 0 ); SetColorScheme(); }
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 ); } }
void PathProp::CreateControls() { wxBoxSizer* itemBoxSizer1 = new wxBoxSizer( wxVERTICAL ); SetSizer( itemBoxSizer1 ); itemDialog1 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL); itemDialog1->SetScrollRate(5, 5); itemBoxSizer1->Add( itemDialog1, 1, wxEXPAND | wxALL, 0 ); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL ); itemDialog1->SetSizer( itemBoxSizer2 ); wxStaticBox* itemStaticBoxSizer3Static = new wxStaticBox( itemDialog1, wxID_ANY, _("Properties") ); wxStaticBoxSizer* itemStaticBoxSizer3 = new wxStaticBoxSizer( itemStaticBoxSizer3Static, wxVERTICAL ); itemBoxSizer2->Add( itemStaticBoxSizer3, 0, wxEXPAND | wxALL, 5 ); wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Name"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer3->Add( itemStaticText4, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_PathNameCtl = new wxTextCtrl( itemDialog1, ID_PATHPROP_TEXTCTRL, _T(""), wxDefaultPosition, wxSize( 710, -1 ), 0 ); itemStaticBoxSizer3->Add( m_PathNameCtl, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM | wxEXPAND, 5 ); // wxFlexGridSizer* itemFlexGridSizer6 = new wxFlexGridSizer( 2, 2, 0, 0 ); // itemStaticBoxSizer3->Add( itemFlexGridSizer6, 1, wxALIGN_LEFT | wxALL, 5 ); wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("Description"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer3->Add( itemStaticText7, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 5 ); m_textDescription = new wxTextCtrl( itemDialog1, wxID_ANY , wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); m_textDescription->SetMinSize( wxSize( -1, 60 ) ); itemStaticBoxSizer3->Add( m_textDescription, 1, wxALL | wxEXPAND, 5 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Total Length"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer3->Add( itemStaticText8, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_TotalDistCtl = new wxTextCtrl( itemDialog1, ID_PATHPROP_TEXTCTRL3, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY ); itemStaticBoxSizer3->Add( m_TotalDistCtl, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); m_pPathActive = new wxCheckBox( itemDialog1, ID_PATHPROP_ACTIVE, _("Active") ); itemStaticBoxSizer3->Add( m_pPathActive, 0 ); //wxFlexGridSizer* itemFlexGridSizer6a = new wxFlexGridSizer( 2, 4, 0, 0 ); //itemStaticBoxSizer3->Add( itemFlexGridSizer6a, 1, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* bSizer2; bSizer2 = new wxBoxSizer( wxHORIZONTAL ); m_staticText1 = new wxStaticText( itemDialog1, wxID_ANY, _("Line Colour:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1->Wrap( -1 ); bSizer2->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxString m_chColorChoices[] = { _("Default color"), _("Black"), _("Dark Red"), _("Dark Green"), _("Dark Yellow"), _("Dark Blue"), _("Dark Magenta"), _("Dark Cyan"), _("Light Gray"), _("Dark Gray"), _("Red"), _("Green"), _("Yellow"), _("Blue"), _("Magenta"), _("Cyan"), _("White") }; int m_chColorNChoices = sizeof( m_chColorChoices ) / sizeof(wxString); m_chColor = new wxChoice( itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_chColorNChoices, m_chColorChoices, 0 ); m_chColor->SetSelection( 0 ); bSizer2->Add( m_chColor, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_staticText2 = new wxStaticText( itemDialog1, wxID_ANY, _("Fill Colour:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); bSizer2->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_chLineColor = new wxChoice( itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_chColorNChoices, m_chColorChoices, 0 ); m_chLineColor->SetSelection( 0 ); bSizer2->Add( m_chLineColor, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_staticText3 = new wxStaticText( itemDialog1, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText3->Wrap( -1 ); bSizer2->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxString m_chStyleChoices[] = { _("Default"), _("Solid"), _("Dot"), _("Long dash"), _("Short dash"), _("Dot dash") }; int m_chStyleNChoices = sizeof( m_chStyleChoices ) / sizeof(wxString); m_chStyle = new wxChoice( itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_chStyleNChoices, m_chStyleChoices, 0 ); m_chStyle->SetSelection( 0 ); bSizer2->Add( m_chStyle, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_staticText4 = new wxStaticText( itemDialog1, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText4->Wrap( -1 ); bSizer2->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxString m_chWidthChoices[] = { _("Default"), _("1 pixel"), _("2 pixels"), _("3 pixels"), _("4 pixels"), _("5 pixels"), _("6 pixels"), _("7 pixels"), _("8 pixels"), _("9 pixels"), _("10 pixels") }; int m_chWidthNChoices = sizeof( m_chWidthChoices ) / sizeof(wxString); m_chWidth = new wxChoice( itemDialog1, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_chWidthNChoices, m_chWidthChoices, 0 ); m_chWidth->SetSelection( 0 ); bSizer2->Add( m_chWidth, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); itemStaticBoxSizer3->Add( bSizer2, 1, wxEXPAND, 0 ); wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox( itemDialog1, wxID_ANY, _("ODPoints") ); m_pListSizer = new wxStaticBoxSizer( itemStaticBoxSizer14Static, wxVERTICAL ); itemBoxSizer2->Add( m_pListSizer, 1, wxEXPAND | wxALL, 5 ); wxBoxSizer* itemBoxSizerBottom = new wxBoxSizer( wxHORIZONTAL ); itemBoxSizer1->Add( itemBoxSizerBottom, 0, wxALIGN_LEFT | wxALL | wxEXPAND, 5 ); wxBoxSizer* itemBoxSizerAux = new wxBoxSizer( wxHORIZONTAL ); itemBoxSizerBottom->Add( itemBoxSizerAux, 1, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer16 = new wxBoxSizer( wxHORIZONTAL ); itemBoxSizerBottom->Add( itemBoxSizer16, 0, wxALIGN_RIGHT | wxALL, 5 ); m_CancelButton = new wxButton( this, ID_PATHPROP_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer16->Add( m_CancelButton, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_OKButton = new wxButton( this, ID_PATHPROP_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemBoxSizer16->Add( m_OKButton, 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL | wxALL, 5 ); m_OKButton->SetDefault(); // To correct a bug in MSW commctl32, we need to catch column width drag events, and do a Refresh() // Otherwise, the column heading disappear..... // Does no harm for GTK builds, so no need for conditional Connect( wxEVT_COMMAND_LIST_COL_END_DRAG, (wxObjectEventFunction) (wxEventFunction) &PathProp::OnEvtColDragEnd ); // Create the list control m_opList = new wxListCtrl( itemDialog1, ID_PATHPROP_LISTCTRL, wxDefaultPosition, wxSize( 800, 200 ), wxLC_REPORT | wxLC_HRULES | wxLC_VRULES | wxLC_EDIT_LABELS ); int char_size = GetCharWidth(); m_opList->InsertColumn( 0, _("Leg"), wxLIST_FORMAT_LEFT, char_size * 6 ); m_opList->InsertColumn( 1, _("To Point"), wxLIST_FORMAT_LEFT, char_size * 14 ); m_opList->InsertColumn( 2, _("Distance"), wxLIST_FORMAT_RIGHT, char_size * 9 ); if(g_bShowMag) m_opList->InsertColumn( 3, _("Bearing (M)"), wxLIST_FORMAT_LEFT, char_size * 10 ); else m_opList->InsertColumn( 3, _("Bearing"), wxLIST_FORMAT_LEFT, char_size * 10 ); m_opList->InsertColumn( 4, _("Latitude"), wxLIST_FORMAT_LEFT, char_size * 11 ); m_opList->InsertColumn( 5, _("Longitude"), wxLIST_FORMAT_LEFT, char_size * 11 ); m_opList->InsertColumn( 6, _("Next tide event"), wxLIST_FORMAT_LEFT, char_size * 11 ); if(g_bShowMag) m_opList->InsertColumn( 7, _("Course (M)"), wxLIST_FORMAT_LEFT, char_size * 10 ); else m_opList->InsertColumn( 7, _("Course"), wxLIST_FORMAT_LEFT, char_size * 10 ); m_opList->InsertColumn( 8, _("Description"), wxLIST_FORMAT_LEFT, char_size * 11 ); // m_opList->Hide(); m_pListSizer->Add( m_opList, 2, wxEXPAND | wxALL, 5 ); //Set the maximum size of the entire dialog int width, height; ::wxDisplaySize( &width, &height ); SetSizeHints( -1, -1, width-100, height-100 ); Connect( wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, wxListEventHandler(PathProp::OnPathPropRightClick), NULL, this ); Connect( wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PathProp::OnPathPropMenuSelected), NULL, this ); Connect( wxEVT_LIST_ITEM_ACTIVATED, wxListEventHandler(PathProp::OnPathPropDoubleClick), NULL, this ); // Fetch any config file values /* if( g_StartTimeTZ == 0 ) m_prb_tzUTC->SetValue( true); else if( g_StartTimeTZ == 1 ) m_prb_tzLocal->SetValue( true); else if( g_StartTimeTZ == 2 ) m_prb_tzLMT->SetValue( true); */ SetColorScheme( (ColorScheme) 0 ); }