MyFrame::MyFrame(wxFrame *frame, const wxString&title, const wxPoint&pos, const wxSize&size)
        : wxFrame(frame, wxID_ANY, title, pos, size)
{
    m_canvas = NULL;
    m_previewModality = wxPreviewFrame_AppModal;

#if wxUSE_STATUSBAR
    // Give us a status line
    CreateStatusBar(2);
    SetStatusText(wxT("Printing demo"));
#endif // wxUSE_STATUSBAR

    // Load icon and bitmap
    SetIcon( wxICON( sample) );

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(wxID_PRINT, wxT("&Print..."),                 wxT("Print"));
    file_menu->Append(WXPRINT_PAGE_SETUP, wxT("Page Set&up..."),    wxT("Page setup"));
#ifdef __WXMAC__
    file_menu->Append(WXPRINT_PAGE_MARGINS, wxT("Page Margins..."), wxT("Page margins"));
#endif
    file_menu->Append(wxID_PREVIEW, wxT("Print Pre&view"),          wxT("Preview"));

    wxMenu * const menuModalKind = new wxMenu;
    menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_APP, "&App modal");
    menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_WIN, "&Window modal");
    menuModalKind->AppendRadioItem(WXPRINT_FRAME_MODAL_NON, "&Not modal");
    file_menu->AppendSubMenu(menuModalKind, "Preview frame &modal kind");
#if wxUSE_ACCEL
    // Accelerators
    wxAcceleratorEntry entries[1];
    entries[0].Set(wxACCEL_CTRL, (int) 'V', wxID_PREVIEW);
    wxAcceleratorTable accel(1, entries);
    SetAcceleratorTable(accel);
#endif

#if defined(__WXMSW__) &&wxTEST_POSTSCRIPT_IN_MSW
    file_menu->AppendSeparator();
    file_menu->Append(WXPRINT_PRINT_PS, wxT("Print PostScript..."),           wxT("Print (PostScript)"));
    file_menu->Append(WXPRINT_PAGE_SETUP_PS, wxT("Page Setup PostScript..."), wxT("Page setup (PostScript)"));
    file_menu->Append(WXPRINT_PREVIEW_PS, wxT("Print Preview PostScript"),    wxT("Preview (PostScript)"));
#endif

    file_menu->AppendSeparator();
    file_menu->Append(WXPRINT_ANGLEUP, wxT("Angle up\tAlt-U"),                wxT("Raise rotated text angle"));
    file_menu->Append(WXPRINT_ANGLEDOWN, wxT("Angle down\tAlt-D"),            wxT("Lower rotated text angle"));
    file_menu->AppendSeparator();
    file_menu->Append(wxID_EXIT, wxT("E&xit"),                                wxT("Exit program"));

    wxMenu *help_menu = new wxMenu;
    help_menu->Append(wxID_ABOUT, wxT("&About"),                              wxT("About this demo"));

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu, wxT("&File"));
    menu_bar->Append(help_menu, wxT("&Help"));

    // Associate the menu bar with the frame
    SetMenuBar(menu_bar);


    // create the canvas
    // -----------------

    m_canvas = new MyCanvas(this, wxPoint(0, 0), wxSize(100, 100),
                            wxRETAINED|wxHSCROLL|wxVSCROLL);

    // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction
    m_canvas->SetScrollbars(20, 20, 50, 50);
}
Beispiel #2
0
MainFrame_base::MainFrame_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetForegroundColour( wxColour( 238, 238, 242 ) );
	this->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	m_mgr.SetManagedWindow(this);
	m_mgr.SetFlags(wxAUI_MGR_ALLOW_ACTIVE_PANE|wxAUI_MGR_ALLOW_FLOATING|wxAUI_MGR_HINT_FADE|wxAUI_MGR_LIVE_RESIZE|wxAUI_MGR_NO_VENETIAN_BLINDS_FADE|wxAUI_MGR_TRANSPARENT_DRAG|wxAUI_MGR_TRANSPARENT_HINT);
	
	m_statusbar = this->CreateStatusBar( 4, wxST_SIZEGRIP, wxID_ANY );
	m_statusbar->SetForegroundColour( wxColour( 238, 238, 242 ) );
	m_statusbar->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	
	m_menubar = new wxMenuBar( 0 );
	m_file_menu = new wxMenu();
	wxMenuItem* m_menu_exit;
	m_menu_exit = new wxMenuItem( m_file_menu, ID_MENU_EXIT, wxString( wxT("E&xit") ) + wxT('\t') + wxT("Alt+F4"), wxT("Exit the application"), wxITEM_NORMAL );
	m_file_menu->Append( m_menu_exit );
	
	m_menubar->Append( m_file_menu, wxT("&File") ); 
	
	m_process_menu = new wxMenu();
	wxMenuItem* m_menu_reconstruct;
	m_menu_reconstruct = new wxMenuItem( m_process_menu, ID_RECONSTRUCT, wxString( wxT("&Reconstruct") ) + wxT('\t') + wxT("Alt+r"), wxT("Compute 3d geometry from images"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_reconstruct->SetBitmaps( wxIcon("start_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_reconstruct->SetBitmap( wxICON( start_icon ) );
	#endif
	m_process_menu->Append( m_menu_reconstruct );
	
	m_menubar->Append( m_process_menu, wxT("&Process") ); 
	
	m_view_menu = new wxMenu();
	wxMenuItem* m_menu_view_image_browser;
	m_menu_view_image_browser = new wxMenuItem( m_view_menu, ID_VIEW_IMAGE_BROWSER, wxString( wxT("&Image browser") ) + wxT('\t') + wxT("Alt+i"), wxT("Show image browser window"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_view_image_browser->SetBitmaps( wxIcon("image_browser_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_view_image_browser->SetBitmap( wxICON( image_browser_icon ) );
	#endif
	m_view_menu->Append( m_menu_view_image_browser );
	
	wxMenuItem* m_menu_view_image_preview;
	m_menu_view_image_preview = new wxMenuItem( m_view_menu, ID_VIEW_IMAGE_PREVIEW, wxString( wxT("Image &preview") ) + wxT('\t') + wxT("Alt+p"), wxT("Show image preview window"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_view_image_preview->SetBitmaps( wxIcon("image_preview_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_view_image_preview->SetBitmap( wxICON( image_preview_icon ) );
	#endif
	m_view_menu->Append( m_menu_view_image_preview );
	
	wxMenuItem* m_menu_view_options;
	m_menu_view_options = new wxMenuItem( m_view_menu, ID_VIEW_OPTIONS, wxString( wxT("&Options") ) + wxT('\t') + wxT("Alt+o"), wxT("Show options window"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_view_options->SetBitmaps( wxIcon("options_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_view_options->SetBitmap( wxICON( options_icon ) );
	#endif
	m_view_menu->Append( m_menu_view_options );
	
	wxMenuItem* m_menu_view_log;
	m_menu_view_log = new wxMenuItem( m_view_menu, ID_VIEW_LOG, wxString( wxT("&Log") ) + wxT('\t') + wxT("Alt+l"), wxT("Show log window"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_view_log->SetBitmaps( wxIcon("log_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_view_log->SetBitmap( wxICON( log_icon ) );
	#endif
	m_view_menu->Append( m_menu_view_log );
	
	m_view_menu->AppendSeparator();
	
	wxMenuItem* m_menu_reset_3d_viewport;
	m_menu_reset_3d_viewport = new wxMenuItem( m_view_menu, ID_RESET_3D_VIEWPORT, wxString( wxT("Reset 3d viewport") ) + wxT('\t') + wxT("Alt+h"), wxT("Reset the 3d viewport"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_reset_3d_viewport->SetBitmaps( wxIcon("home_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_reset_3d_viewport->SetBitmap( wxICON( home_icon ) );
	#endif
	m_view_menu->Append( m_menu_reset_3d_viewport );
	
	wxMenuItem* m_menu_toggle_turntable_animation;
	m_menu_toggle_turntable_animation = new wxMenuItem( m_view_menu, ID_TOGGLE_TURNTABLE_ANIMATION, wxString( wxT("Tur&ntable") ) + wxT('\t') + wxT("Alt+n"), wxT("Toggle turntable animation"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_toggle_turntable_animation->SetBitmaps( wxIcon("turntable_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_toggle_turntable_animation->SetBitmap( wxICON( turntable_icon ) );
	#endif
	m_view_menu->Append( m_menu_toggle_turntable_animation );
	
	m_view_menu->AppendSeparator();
	
	wxMenuItem* m_menu_toggle_trackball_visibility;
	m_menu_toggle_trackball_visibility = new wxMenuItem( m_view_menu, ID_TOGGLE_TRACKBALL_VISIBILITY, wxString( wxT("Trackball") ) + wxT('\t') + wxT("Alt+v"), wxT("Toggle trackball visibility"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_toggle_trackball_visibility->SetBitmaps( wxIcon("trackball_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_toggle_trackball_visibility->SetBitmap( wxICON( trackball_icon ) );
	#endif
	m_view_menu->Append( m_menu_toggle_trackball_visibility );
	
	wxMenuItem* m_menu_toggle_grid_visibility;
	m_menu_toggle_grid_visibility = new wxMenuItem( m_view_menu, ID_TOGGLE_GRID_VISIBILITY, wxString( wxT("&Grid") ) + wxT('\t') + wxT("Alt+g"), wxT("Toggle grid visibility"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_toggle_grid_visibility->SetBitmaps( wxIcon("grid_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_toggle_grid_visibility->SetBitmap( wxICON( grid_icon ) );
	#endif
	m_view_menu->Append( m_menu_toggle_grid_visibility );
	
	wxMenuItem* m_menu_toggle_points_visibility;
	m_menu_toggle_points_visibility = new wxMenuItem( m_view_menu, ID_TOGGLE_POINTS_VISIBILITY, wxString( wxT("Points") ) , wxT("Toggle points visibility"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_toggle_points_visibility->SetBitmaps( wxIcon("points_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_toggle_points_visibility->SetBitmap( wxICON( points_icon ) );
	#endif
	m_view_menu->Append( m_menu_toggle_points_visibility );
	
	wxMenuItem* m_menu_toggle_cameras_visibility;
	m_menu_toggle_cameras_visibility = new wxMenuItem( m_view_menu, ID_TOGGLE_CAMERAS_VISIBILITY, wxString( wxT("Cameras") ) , wxT("Toggle cameras visibility"), wxITEM_NORMAL );
	#ifdef __WXMSW__
	m_menu_toggle_cameras_visibility->SetBitmaps( wxIcon("camera_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22) );
	#elif defined( __WXGTK__ )
	m_menu_toggle_cameras_visibility->SetBitmap( wxICON( camera_icon ) );
	#endif
	m_view_menu->Append( m_menu_toggle_cameras_visibility );
	
	m_menubar->Append( m_view_menu, wxT("&View") ); 
	
	m_export_menu = new wxMenu();
	wxMenuItem* m_menu_export_tracks;
	m_menu_export_tracks = new wxMenuItem( m_export_menu, ID_EXPORT_TRACKS, wxString( wxT("Tracks") ) , wxT("Export tracks to textfile"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_tracks );
	
	wxMenuItem* m_menu_export_matches;
	m_menu_export_matches = new wxMenuItem( m_export_menu, ID_EXPORT_MATCHES, wxString( wxT("Matches") ) , wxT("Export matches to textfile"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_matches );
	
	m_export_menu->AppendSeparator();
	
	wxMenuItem* m_menu_export_cmvs;
	m_menu_export_cmvs = new wxMenuItem( m_export_menu, ID_EXPORT_CMVS, wxString( wxT("CMVS") ) , wxT("Export to CMVS"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_cmvs );
	
	wxMenuItem* m_menu_export_bundle_file;
	m_menu_export_bundle_file = new wxMenuItem( m_export_menu, ID_EXPORT_BUNDLE_FILE, wxString( wxT("Bundle file") ) , wxT("Export to bundle.rd.out"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_bundle_file );
	
	wxMenuItem* m_menu_export_ply_file;
	m_menu_export_ply_file = new wxMenuItem( m_export_menu, ID_EXPORT_PLY_FILE, wxString( wxT("Ply file") ) , wxT("Export reconstruction as .ply file"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_ply_file );
	
	wxMenuItem* m_menu_export_meshlab_file;
	m_menu_export_meshlab_file = new wxMenuItem( m_export_menu, ID_EXPORT_MESHLAB_FILE, wxString( wxT("Meshlab file") ) , wxT("Export reconstruction as .mlp file"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_meshlab_file );
	
	wxMenuItem* m_menu_export_maya;
	m_menu_export_maya = new wxMenuItem( m_export_menu, ID_EXPORT_MAYA_FILE, wxString( wxT("Maya file") ) , wxT("Export reconstruction as .ma file"), wxITEM_NORMAL );
	m_export_menu->Append( m_menu_export_maya );
	
	m_menubar->Append( m_export_menu, wxT("&Export") ); 
	
	m_help_menu = new wxMenu();
	wxMenuItem* m_menu_about;
	m_menu_about = new wxMenuItem( m_help_menu, ID_VIEW_ABOUT, wxString( wxT("About RoboStruct...") ) + wxT('\t') + wxT("F1"), wxT("Show info about this application"), wxITEM_NORMAL );
	m_help_menu->Append( m_menu_about );
	
	m_menubar->Append( m_help_menu, wxT("&Help") ); 
	
	this->SetMenuBar( m_menubar );
	
	m_toolbar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT|wxNO_BORDER ); 
	m_toolbar->AddTool(ID_RECONSTRUCT,        "Reconstruct", wxIcon("start_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),         wxNullBitmap, wxITEM_NORMAL, "Compute 3d geometry from images", "Compute 3d geometry from images", NULL);
	m_toolbar->AddSeparator(); 
	m_toolbar->AddTool(ID_VIEW_IMAGE_BROWSER, "Browser",     wxIcon("image_browser_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Show image browser window",       "Show image browser window", NULL);
	m_toolbar->AddTool(ID_VIEW_IMAGE_PREVIEW, "Preview",     wxIcon("image_preview_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Show image preview window",       "Show image preview window", NULL);
	m_toolbar->AddTool(ID_VIEW_OPTIONS,       "Options",     wxIcon("options_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),       wxNullBitmap, wxITEM_NORMAL, "Show options window",             "Show options window", NULL);
	m_toolbar->AddTool(ID_VIEW_LOG,           "Log",         wxIcon("log_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),           wxNullBitmap, wxITEM_NORMAL, "Show log window",                 "Show log window", NULL);
	
	m_toolbar->Realize();
	m_mgr.AddPane( m_toolbar, wxAuiPaneInfo().Top().CaptionVisible( false ).CloseButton( false ).PaneBorder( false ).Movable( false ).Dock().Resizable().FloatingSize( wxSize( -1,-1 ) ).BottomDockable( false ).TopDockable( false ).LeftDockable( false ).RightDockable( false ).Floatable( false ).Layer( 10 ) );
	
	m_window_viewport = new wxAuiMyNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_EXTERNAL_MOVE|wxAUI_NB_TAB_SPLIT|wxAUI_NB_BOTTOM|wxNO_BORDER);
	m_mgr.AddPane(m_window_viewport, wxAuiPaneInfo().CentrePane().Name("Viewport").Caption("Viewport").CaptionVisible(true).MaximizeButton(true).MinimizeButton(false).PinButton(false).CloseButton(false));
	
	m_panel8 = new wxPanel( m_window_viewport, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
	wxBoxSizer* bSizer8;
	bSizer8 = new wxBoxSizer( wxHORIZONTAL );
	
	int GLCanvasAttributes[] = {WX_GL_RGBA, 1, WX_GL_DOUBLEBUFFER, 1, WX_GL_SAMPLES, 8, 0};
	m_gl_canvas = new wxGLCanvas(m_panel8, -1, GLCanvasAttributes);
	m_gl_canvas->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	
	bSizer8->Add( m_gl_canvas, 1, wxEXPAND, 5 );

    
    m_toolbar_viewport = new wxAuiToolBar( m_panel8, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_VERTICAL ); 
	m_toolbar_viewport->AddTool(ID_RESET_3D_VIEWPORT,           "Reset 3d viewport", wxIcon("home_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),      wxNullBitmap, wxITEM_NORMAL, "Reset the 3d viewport",       "Reset the 3d viewport", NULL);
	m_toolbar_viewport->AddTool(ID_TOGGLE_TURNTABLE_ANIMATION,  "Turntable",         wxIcon("turntable_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Toggle turntable animation",  "Toggle turntable animation", NULL);
	m_toolbar_viewport->AddTool(ID_TOGGLE_GRID_VISIBILITY,      "Grid",              wxIcon("grid_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),      wxNullBitmap, wxITEM_NORMAL, "Toggle grid visibility",      "Toggle grid visibility", NULL);
	m_toolbar_viewport->AddTool(ID_TOGGLE_TRACKBALL_VISIBILITY, "Trackball",         wxIcon("trackball_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Toggle trackball visibility", "Toggle trackball visibility", NULL);
	m_toolbar_viewport->AddTool(ID_TOGGLE_POINTS_VISIBILITY,    "Points",            wxIcon("points_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),    wxNullBitmap, wxITEM_NORMAL, "Toggle points visibility",    "Toggle points visibility", NULL);
	m_toolbar_viewport->AddTool(ID_TOGGLE_CAMERAS_VISIBILITY,   "Cameras",           wxIcon("camera_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22),    wxNullBitmap, wxITEM_NORMAL, "Toggle cameras visibility",   "Toggle cameras visibility", NULL);
	
	m_toolbar_viewport->Realize(); 
	
	bSizer8->Add( m_toolbar_viewport, 0, wxEXPAND, 5 );
	

    m_panel8->SetSizer( bSizer8 );
	m_panel8->Layout();
	bSizer8->Fit( m_panel8 );
	m_window_viewport->AddPage( m_panel8, wxT("3d view"), true, wxNullBitmap );
	m_pane_matches = new wxPanel( m_window_viewport, ID_PANE_MATCHES, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
	wxBoxSizer* bSizer5;
	bSizer5 = new wxBoxSizer( wxVERTICAL );
	
	m_pane_matches_view = new wxPanel( m_pane_matches, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
	m_pane_matches_view->Enable( false );
	
	bSizer5->Add( m_pane_matches_view, 1, wxEXPAND, 5 );
	
	wxBoxSizer* bSizer6;
	bSizer6 = new wxBoxSizer( wxHORIZONTAL );
	
	m_cb_matches_left = new wxComboBox( m_pane_matches, wxID_ANY, wxT("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
	bSizer6->Add( m_cb_matches_left, 1, wxEXPAND|wxALL, 5 );
	
	m_cb_matches_right = new wxComboBox( m_pane_matches, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); 
	bSizer6->Add( m_cb_matches_right, 1, wxALL|wxEXPAND, 5 );
	
	
	bSizer5->Add( bSizer6, 0, wxEXPAND, 5 );
	
	
	m_pane_matches->SetSizer( bSizer5 );
	m_pane_matches->Layout();
	bSizer5->Fit( m_pane_matches );
	m_window_viewport->AddPage( m_pane_matches, wxT("Matches"), false, wxNullBitmap );
	
	m_window_image_browser = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 370,200 ), wxTAB_TRAVERSAL );
	m_window_image_browser->SetMinSize( wxSize( 370,200 ) );
	
	m_mgr.AddPane( m_window_image_browser, wxAuiPaneInfo() .Name( wxT("Image browser") ).Left() .Caption( wxT("Image browser") ).MaximizeButton( true ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxSize( 386,234 ) ).DockFixed( false ).Layer( 1 ) );
	
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );
	
	m_dir_picker = new wxDirPickerCtrl( m_window_image_browser, wxID_ANY, wxT("D:\\Reconstruct\\TestData\\"), wxT("Select a folder"), wxDefaultPosition, wxDefaultSize, wxDIRP_DEFAULT_STYLE|wxNO_BORDER );
	m_dir_picker->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	m_dir_picker->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	
	bSizer1->Add( m_dir_picker, 0, wxEXPAND|wxALL, 5 );
	
	m_img_ctrl = new wxListCtrl( m_window_image_browser, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES|wxNO_BORDER );
	m_img_ctrl->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	
	bSizer1->Add( m_img_ctrl, 1, wxEXPAND, 5 );
	
	
	m_window_image_browser->SetSizer( bSizer1 );
	m_window_image_browser->Layout();
	m_window_image_preview = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 370,200 ), wxNO_BORDER|wxTAB_TRAVERSAL );
	m_window_image_preview->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	m_window_image_preview->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	m_window_image_preview->SetMinSize( wxSize( 370,200 ) );
	
	m_mgr.AddPane( m_window_image_preview, wxAuiPaneInfo() .Name( wxT("Image preview") ).Left() .Caption( wxT("Image preview") ).MaximizeButton( true ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxSize( 386,234 ) ).DockFixed( false ).Layer( 1 ) );
	
	m_window_options = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 370,200 ), wxNO_BORDER|wxTAB_TRAVERSAL );
	m_window_options->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	m_window_options->SetMinSize( wxSize( 370,200 ) );
	
	m_mgr.AddPane( m_window_options, wxAuiPaneInfo() .Name( wxT("Options") ).Left() .Caption( wxT("Options") ).MaximizeButton( true ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxSize( 439,316 ) ).DockFixed( false ).Layer( 1 ) );
	
	wxBoxSizer* bSizer2;
	bSizer2 = new wxBoxSizer( wxVERTICAL );
	
	m_toolbar_options = new wxAuiToolBar( m_window_options, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_HORZ_LAYOUT|wxNO_BORDER );
	m_toolbar_options->SetToolBitmapSize( wxSize( 22,22 ) );
	m_toolbar_options->SetToolPacking( 2 );
	m_toolbar_options->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	
	m_toolbar_options->AddTool(ID_RESET_OPTIONS, wxT("Reset options"), wxIcon("reset_icon",  wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Reset options", "Reset options", NULL); 
	m_toolbar_options->AddTool(ID_SAVE_OPTIONS,  wxT("Save options"),  wxIcon("floppy_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Save options",  "Save options",  NULL); 
	
	m_toolbar_options->Realize(); 
	
	bSizer2->Add( m_toolbar_options, 0, wxEXPAND, 5 );
	
	m_pg_options = new wxPropertyGrid(m_window_options, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPG_BOLD_MODIFIED | wxPG_DEFAULT_STYLE | wxNO_BORDER);
	
	m_pg_options->SetBackgroundColour( wxColour( 238, 238, 242 ) );
	
	bSizer2->Add( m_pg_options, 1, wxEXPAND, 5 );
	
	
	m_window_options->SetSizer( bSizer2 );
	m_window_options->Layout();
	m_window_log = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 150,150 ), wxTAB_TRAVERSAL );
	m_window_log->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	m_window_log->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	m_window_log->SetMinSize( wxSize( 150,150 ) );
	
	m_mgr.AddPane( m_window_log, wxAuiPaneInfo() .Name( wxT("Log") ).Bottom() .Caption( wxT("Log") ).MaximizeButton( true ).PaneBorder( false ).Dock().Resizable().FloatingSize( wxSize( 596,244 ) ).DockFixed( false ).Row( 0 ).Layer( 0 ) );
	
	wxBoxSizer* bSizer3;
	bSizer3 = new wxBoxSizer( wxHORIZONTAL );
	
	m_tc_log = new wxTextCtrl( m_window_log, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_DONTWRAP|wxTE_MULTILINE|wxTE_READONLY|wxNO_BORDER );
	m_tc_log->SetMaxLength( 0 ); 
	m_tc_log->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT ) );
	m_tc_log->SetBackgroundColour( wxColour( 245, 245, 245 ) );
	
	bSizer3->Add( m_tc_log, 1, wxEXPAND, 5 );
	
	m_toolbar_log = new wxAuiToolBar( m_window_log, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_TB_VERTICAL|wxNO_BORDER );
	m_toolbar_log->SetToolBitmapSize( wxSize( 22,22 ) );
	m_toolbar_log->SetToolPacking( 2 );
	m_toolbar_log->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
	
	m_toolbar_log->AddTool(ID_SAVE_LOG,	 "Save Log",  wxIcon("floppy_icon",    wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Save the log to a .txt file", "Save the log to a .txt file", NULL);
	m_toolbar_log->AddTool(ID_CLEAR_LOG, "Clear log", wxIcon("clear_log_icon", wxBITMAP_TYPE_ICO_RESOURCE, 22, 22), wxNullBitmap, wxITEM_NORMAL, "Clear the log window", "Clear the log window", NULL);
	
	m_toolbar_log->Realize(); 
	
	bSizer3->Add( m_toolbar_log, 0, wxEXPAND, 5 );
	
	
	m_window_log->SetSizer( bSizer3 );
	m_window_log->Layout();
	m_window_about = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
	m_mgr.AddPane( m_window_about, wxAuiPaneInfo() .Name( wxT("About") ).Left() .Caption( wxT("About RoboStruct") ).Hide().Float().FloatingPosition( wxPoint( 643,334 ) ).Resizable().FloatingSize( wxSize( 300,300 ) ).DockFixed( false ).BottomDockable( false ).TopDockable( false ).LeftDockable( false ).RightDockable( false ).Floatable( false ) );
	
	wxBoxSizer* bSizer7;
	bSizer7 = new wxBoxSizer( wxVERTICAL );
	
	m_tc_about = new wxTextCtrl( m_window_about, wxID_ANY, wxT("This is awesome!\nLicense(s)\nIcons (Tango, Crystal project...)\nGLocyte"), wxDefaultPosition, wxDefaultSize, wxTE_CENTRE|wxTE_MULTILINE|wxTE_NO_VSCROLL|wxTE_READONLY|wxNO_BORDER );
	m_tc_about->SetMaxLength( 0 ); 
	bSizer7->Add( m_tc_about, 1, wxEXPAND, 5 );
	
	
	m_window_about->SetSizer( bSizer7 );
	m_window_about->Layout();
	bSizer7->Fit( m_window_about );
	
	m_mgr.Update();
	this->Centre( wxBOTH );
	
	// Connect Events
	this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( MainFrame_base::OnUpdateUI ) );
	this->Connect( m_menu_exit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnMenuExit ) );
	this->Connect( m_menu_reconstruct->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnReconstruct ) );
	this->Connect( m_menu_view_image_browser->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( m_menu_view_image_preview->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( m_menu_view_options->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( m_menu_view_log->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( m_menu_reset_3d_viewport->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnReset3dViewport ) );
	this->Connect( m_menu_toggle_turntable_animation->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnToggleTurntableAnimation ) );
	this->Connect( m_menu_toggle_trackball_visibility->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( m_menu_toggle_grid_visibility->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( m_menu_toggle_points_visibility->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( m_menu_toggle_cameras_visibility->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( m_menu_export_tracks->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_export_matches->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_export_cmvs->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_export_bundle_file->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_export_ply_file->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_export_meshlab_file->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_export_maya->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnExport ) );
	this->Connect( m_menu_about->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( ID_RECONSTRUCT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnReconstruct ) );
	this->Connect( ID_VIEW_IMAGE_BROWSER, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( ID_VIEW_IMAGE_PREVIEW, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( ID_VIEW_OPTIONS, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( ID_VIEW_LOG, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnViewWindows ) );
	this->Connect( ID_RESET_3D_VIEWPORT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnReset3dViewport ) );
	this->Connect( ID_TOGGLE_TURNTABLE_ANIMATION, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnToggleTurntableAnimation ) );
	this->Connect( ID_TOGGLE_GRID_VISIBILITY, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( ID_TOGGLE_TRACKBALL_VISIBILITY, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( ID_TOGGLE_POINTS_VISIBILITY, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	this->Connect( ID_TOGGLE_CAMERAS_VISIBILITY, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnToggleVisibility ) );
	m_gl_canvas->Connect( wxEVT_ERASE_BACKGROUND, wxEraseEventHandler( MainFrame_base::OnGLCanvasEraseBackground ), NULL, this );
	m_gl_canvas->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_MIDDLE_UP, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_MOTION, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( MainFrame_base::OnGLCanvasMouse ), NULL, this );
	m_gl_canvas->Connect( wxEVT_PAINT, wxPaintEventHandler( MainFrame_base::OnGLCanvasPaint ), NULL, this );
	m_gl_canvas->Connect( wxEVT_SIZE, wxSizeEventHandler( MainFrame_base::OnGLCanvasSize ), NULL, this );
	m_pane_matches_view->Connect( wxEVT_PAINT, wxPaintEventHandler( MainFrame_base::OnMatchesViewPaint ), NULL, this );
	m_pane_matches_view->Connect( wxEVT_SIZE, wxSizeEventHandler( MainFrame_base::OnMatchesViewResize ), NULL, this );
	m_cb_matches_left->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrame_base::OnSelectMatchImage ), NULL, this );
	m_cb_matches_right->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( MainFrame_base::OnSelectMatchImage ), NULL, this );
	m_dir_picker->Connect( wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler( MainFrame_base::OnSelectDirectory ), NULL, this );
	m_img_ctrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( MainFrame_base::OnSelectPreviewImage ), NULL, this );
	m_window_image_preview->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_LEFT_UP, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_MIDDLE_UP, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_MOTION, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_MIDDLE_DCLICK, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_RIGHT_DCLICK, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( MainFrame_base::OnImagePreviewMouse ), NULL, this );
	m_window_image_preview->Connect( wxEVT_PAINT, wxPaintEventHandler( MainFrame_base::OnImagePreviewPaint ), NULL, this );
	m_window_image_preview->Connect( wxEVT_SIZE, wxSizeEventHandler( MainFrame_base::OnImagePreviewResize ), NULL, this );
	this->Connect( ID_RESET_OPTIONS, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnResetOptions ) );
	this->Connect( ID_SAVE_LOG, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnSaveLog ) );
	this->Connect( ID_CLEAR_LOG, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainFrame_base::OnClearLog ) );
}
Beispiel #3
0
bool CBOINCGUIApp::OnInit() {
    // Initialize globals
#ifdef SANDBOX
    g_use_sandbox = true;
#else
    g_use_sandbox = false;
#endif

    s_bSkipExitConfirmation = false;
    m_bFilterEvents = false;
    m_bAboutDialogIsOpen = false;

    // Initialize class variables
    m_pLocale = NULL;
    m_pSkinManager = NULL;
    m_pFrame = NULL;
    m_pDocument = NULL;
    m_pTaskBarIcon = NULL;
    m_pEventLog = NULL;
#ifdef __WXMAC__
    m_pMacDockIcon = NULL;
#endif
    m_strBOINCMGRExecutableName = wxEmptyString;
    m_strBOINCMGRRootDirectory = wxEmptyString;
    m_strBOINCMGRDataDirectory = wxEmptyString;
    m_strHostNameArg = wxEmptyString;
    m_strPasswordArg = wxEmptyString;
    m_iRPCPortArg = GUI_RPC_PORT;
    m_strBOINCArguments = wxEmptyString;
    m_bGUIVisible = true;
    m_bDebugSkins = false;
    m_bMultipleInstancesOK = false;
    m_bBOINCMGRAutoStarted = false;
    m_iBOINCMGRDisableAutoStart = 0;
    m_iShutdownCoreClient = 0;
    m_iDisplayExitDialog = 1;
    m_iGUISelected = BOINC_SIMPLEGUI;
    m_bSafeMessageBoxDisplayed = 0;
#ifdef __WXMSW__
    m_hClientLibraryDll = NULL;
#endif

    // Initialize local variables
    int      iErrorCode = 0;
    int      iSelectedLanguage = 0;
    bool     bOpenEventLog = false;
    wxString strDesiredSkinName = wxEmptyString;
    wxString strDialogMessage = wxEmptyString;
    bool     success = false;

    // Configure wxWidgets platform specific code
#ifdef __WXMSW__
    wxSystemOptions::SetOption(wxT("msw.staticbox.optimized-paint"), 0);
#endif
#ifdef __WXMAC__
    // In wxMac-2.8.7, default wxListCtrl::RefreshItem() does not work
    // so use traditional generic implementation.
    // This has been fixed in wxMac-2.8.8, but the Mac native implementation:
    //  - takes 3 times the CPU time as the Mac generic version.
    //  - seems to always redraw entire control even if asked to refresh only one row.
    //  - causes major flicker of progress bars, (probably due to full redraws.)
    wxSystemOptions::SetOption(wxT("mac.listctrl.always_use_generic"), 1);

    AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, NewAEEventHandlerUPP((AEEventHandlerProcPtr)QuitAppleEventHandler), 0, false );

    // Cache the current process serial number
    GetCurrentProcess(&m_psnCurrentProcess);
#endif


    // Commandline parsing is done in wxApp::OnInit()
    if (!wxApp::OnInit()) {
        return false;
    }

    if (g_use_sandbox) {
        wxCHANGE_UMASK(2);  // Set file creation mask to be writable by both user and group
                            // Our umask will be inherited by all our child processes
    }

    // Setup application and company information
    SetAppName(wxT("BOINC Manager"));
    SetVendorName(wxT("Space Sciences Laboratory, U.C. Berkeley"));


    // Initialize the configuration storage module
    m_pConfig = new wxConfig(GetAppName());
    wxConfigBase::Set(m_pConfig);
    wxASSERT(m_pConfig);


    // Restore Application State
    m_pConfig->SetPath(wxT("/"));
    m_pConfig->Read(wxT("AutomaticallyShutdownClient"), &m_iShutdownCoreClient, 0L);
    m_pConfig->Read(wxT("DisplayShutdownClientDialog"), &m_iDisplayExitDialog, 1L);
    m_pConfig->Read(wxT("DisableAutoStart"), &m_iBOINCMGRDisableAutoStart, 0L);
    m_pConfig->Read(wxT("Language"), &iSelectedLanguage, 0L);
    m_pConfig->Read(wxT("GUISelection"), &m_iGUISelected, BOINC_SIMPLEGUI);
    m_pConfig->Read(wxT("EventLogOpen"), &bOpenEventLog);


    // Should we abort the BOINC Manager startup process?
    if (m_bBOINCMGRAutoStarted && m_iBOINCMGRDisableAutoStart) {
        return false;
    }

    // Detect where BOINC Manager executable name.
    DetectExecutableName();

    // Detect where BOINC Manager was installed too.
    DetectRootDirectory();

    // Detect where the BOINC Data files are.
    DetectDataDirectory();


    // Switch the current directory to the BOINC Data directory
    if (!GetDataDirectory().IsEmpty()) {
    	success = wxSetWorkingDirectory(GetDataDirectory());
        if (!success) {
            if (!g_use_sandbox) {
                if (!wxDirExists(GetDataDirectory())) {
                    success = wxMkdir(GetDataDirectory(), 0777);    // Does nothing if dir exists
                }
            }
        }
    }

    if (!success) iErrorCode = -1016;

    // Initialize the BOINC Diagnostics Framework
    int dwDiagnosticsFlags =
        BOINC_DIAG_DUMPCALLSTACKENABLED | 
        BOINC_DIAG_HEAPCHECKENABLED |
        BOINC_DIAG_MEMORYLEAKCHECKENABLED |
#if defined(__WXMSW__) || defined(__WXMAC__)
        BOINC_DIAG_REDIRECTSTDERR |
        BOINC_DIAG_REDIRECTSTDOUT |
#endif
        BOINC_DIAG_TRACETOSTDOUT;

    diagnostics_init(
        dwDiagnosticsFlags,
        "stdoutgui",
        "stderrgui"
    );


    // Enable Logging and Trace Masks
    m_pLog = new wxLogBOINC();
    wxLog::SetActiveTarget(m_pLog);

    m_pLog->AddTraceMask(wxT("Function Start/End"));
    m_pLog->AddTraceMask(wxT("Function Status"));


    // Initialize the internationalization module
#ifdef __WXMSW__
    // On Windows, set all locales for this thread on a per-thread basis
    _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
#endif
    m_pLocale = new wxLocale();
    wxASSERT(m_pLocale);

    // Look for the localization files by absolute and relative locations.
    //   preference given to the absolute location.
    m_pLocale->Init(iSelectedLanguage);
    if (!m_strBOINCMGRRootDirectory.IsEmpty()) {
        m_pLocale->AddCatalogLookupPathPrefix(
            wxString(m_strBOINCMGRRootDirectory + wxT("locale"))
        );
    }
    m_pLocale->AddCatalogLookupPathPrefix(wxT("locale"));
    m_pLocale->AddCatalog(wxT("BOINC-Manager"));
    m_pLocale->AddCatalog(wxT("BOINC-Client"));
    m_pLocale->AddCatalog(wxT("BOINC-Web"));

    InitSupportedLanguages();

	language = m_pLocale->GetCanonicalName();

    // Note: JAWS for Windows will only speak the context-sensitive
    // help if you use this help provider:
    wxHelpProvider::Set(new wxHelpControllerHelpProvider());

    // Enable known image types
    wxInitAllImageHandlers();

    // Initialize the skin manager
    m_pSkinManager = new CSkinManager(m_bDebugSkins);
    wxASSERT(m_pSkinManager);


    // Load desired manager skin
    m_pConfig->Read(wxT("Skin"), &strDesiredSkinName, m_pSkinManager->GetDefaultSkinName());
    m_pSkinManager->ReloadSkin(strDesiredSkinName);


#ifdef SANDBOX
    // Make sure owners, groups and permissions are correct for the current setting of g_use_sandbox
    char path_to_error[MAXPATHLEN];
    path_to_error[0] = '\0';
    
    if (!iErrorCode) {
#if (defined(__WXMAC__) && defined(_DEBUG))     // TODO: implement this for other platforms
        // GDB can't attach to applications which are running as a different user   
        //  or group, so fix up data with current user and group during debugging
        if (check_security(g_use_sandbox, true, NULL, 0)) {
            CreateBOINCUsersAndGroups();
            SetBOINCDataOwnersGroupsAndPermissions();
            SetBOINCAppOwnersGroupsAndPermissions(NULL);
        }
#endif
        iErrorCode = check_security(
            g_use_sandbox, true, path_to_error, sizeof(path_to_error)
        );
    }

    if (iErrorCode) {

        ShowApplication(true);

        if (iErrorCode == -1099) {
            strDialogMessage.Printf(
                _("You currently are not authorized to manage the client.\n\nTo run %s as this user, please:\n  - reinstall %s answering \"Yes\" to the question about\n     non-administrative users\n or\n  - contact your administrator to add you to the 'boinc_master'\n     user group."),
                m_pSkinManager->GetAdvanced()->GetApplicationShortName().c_str(),
                m_pSkinManager->GetAdvanced()->GetApplicationShortName().c_str()
            );
        } else {
            strDialogMessage.Printf(
                _("%s ownership or permissions are not set properly; please reinstall %s.\n(Error code %d"),
                m_pSkinManager->GetAdvanced()->GetApplicationShortName().c_str(),
                m_pSkinManager->GetAdvanced()->GetApplicationShortName().c_str(),
                iErrorCode
            );
            if (path_to_error[0]) {
                strDialogMessage += _(" at ");
                strDialogMessage += wxString::FromUTF8(path_to_error);
            }
            strDialogMessage += _(")");
            
            fprintf(stderr, "%s\n", (const char*)strDialogMessage.utf8_str());
        }

        wxMessageDialog* pDlg = new wxMessageDialog(
                                    NULL, 
                                    strDialogMessage, 
                                    m_pSkinManager->GetAdvanced()->GetApplicationName(), 
                                    wxOK
                                    );

        pDlg->ShowModal();
        if (pDlg)
            pDlg->Destroy();

        return false;
    }
#endif      // SANDBOX


#ifdef __WXMSW__
    // Perform any last minute checks that should keep the manager
    // from starting up.
    wxString strRebootPendingFile = 
        GetRootDirectory() + wxFileName::GetPathSeparator() + wxT("RebootPending.txt");
    
    if (wxFile::Exists(strRebootPendingFile)) {
        wxMessageDialog dialog(
            NULL,
            _("A reboot is required in order for BOINC to run properly.\nPlease reboot your computer and try again."),
            _("BOINC Manager"),
            wxOK|wxICON_ERROR
        );

        dialog.ShowModal();
        return false;
    }
#endif

    // Detect if BOINC Manager is already running, if so, bring it into the
    // foreground and then exit.
    if (!m_bMultipleInstancesOK) {
        if (DetectDuplicateInstance()) {
            return false;
        }
    }

    // Initialize the main document
    m_pDocument = new CMainDocument();
    wxASSERT(m_pDocument);

    m_pDocument->OnInit();


    // Is there a condition in which the Simple GUI should not be used?
    if (BOINC_SIMPLEGUI == m_iGUISelected) {
        // Screen too small?
        if (wxGetDisplaySize().GetHeight() < 600) {
            m_iGUISelected = BOINC_ADVANCEDGUI;
        }
    }


    // Initialize the task bar icon
	m_pTaskBarIcon = new CTaskBarIcon(
        m_pSkinManager->GetAdvanced()->GetApplicationName(), 
#ifdef __WXMSW__
        new wxIcon(wxICON(BOINCGUIAPP)),
#else
        m_pSkinManager->GetAdvanced()->GetApplicationIcon(),
#endif
        m_pSkinManager->GetAdvanced()->GetApplicationDisconnectedIcon(),
        m_pSkinManager->GetAdvanced()->GetApplicationSnoozeIcon()
#ifdef __WXMAC__
        , wxTBI_CUSTOM_STATUSITEM
#endif
    );
#ifdef __WXMAC__
    m_pMacDockIcon = new CTaskBarIcon(
        m_pSkinManager->GetAdvanced()->GetApplicationName(), 
        m_pSkinManager->GetAdvanced()->GetApplicationIcon(),
        m_pSkinManager->GetAdvanced()->GetApplicationDisconnectedIcon(),
        m_pSkinManager->GetAdvanced()->GetApplicationSnoozeIcon()
        , wxTBI_DOCK
    );
    wxASSERT(m_pMacDockIcon);
#endif
    wxASSERT(m_pTaskBarIcon);

    // Startup the System Idle Detection code
    IdleTrackerAttach();
    
#ifdef __WXMAC__
    ProcessSerialNumber psn;
    ProcessInfoRec pInfo;
    OSStatus err;
    
    memset(&pInfo, 0, sizeof(pInfo));
    pInfo.processInfoLength = sizeof( ProcessInfoRec );
    err = GetProcessInformation(&m_psnCurrentProcess, &pInfo);
    if (!err) {
        psn = pInfo.processLauncher;
        memset(&pInfo, 0, sizeof(pInfo));
        pInfo.processInfoLength = sizeof( ProcessInfoRec );
        err = GetProcessInformation(&psn, &pInfo);
    }
    // Don't open main window if we were started automatically at login
    if (pInfo.processSignature == 'lgnw') {  // Login Window app
        m_bGUIVisible = false;

        // If the system was just started, we usually get a "Connection 
        // failed" error if we try to connect too soon, so delay a bit.
        sleep(10);
    }
#endif

    // Show the UI
    SetActiveGUI(m_iGUISelected, m_bGUIVisible);

    if (!m_bGUIVisible) {
#ifdef __WXMAC__
        // We don't call Hide() or Show(false) for the main frame
        // under wxCocoa 2.9.5 because it bounces the Dock icon
        // (as in notification.)  We work around this by moving
        // the main window/frame off screen here.
        // The position will be restored in one of these methods:
        // CBOINCGUIApp::OnActivateApp(), CSimpleFrame::SaveState()
        // or CAdvancedFrame::SaveWindowDimensions().
        if (m_pFrame) {
            m_pFrame->MoveFrameOffScreen();
            m_pFrame->Show();
        }
#endif
        ShowApplication(false);
	}

    if (bOpenEventLog) {
        DisplayEventLog(m_bGUIVisible);
        if (m_bGUIVisible && m_pFrame) {
            m_pFrame->Raise();
        }
    }
    
    return true;
}
Beispiel #4
0
LyricsWindow::LyricsWindow(AudacityProject *parent):
   wxFrame(parent, -1,
            wxString::Format(_("Audacity Karaoke%s"),
                              ((parent->GetName() == wxEmptyString) ?
                                 wxT("") :
                                 wxString::Format(
                                   wxT(" - %s"),
                                   parent->GetName()))),
            wxPoint(100, 300), gSize,
            //v Bug in wxFRAME_FLOAT_ON_PARENT:
            // If both the project frame and LyricsWindow are minimized and you restore LyricsWindow,
            // you can't restore project frame until you close LyricsWindow, but then project frame and
            // LyricsWindow are restored but LyricsWindow is unresponsive because it thinks it's not shown.
            //    wxDEFAULT_FRAME_STYLE | wxFRAME_FLOAT_ON_PARENT)
            wxDEFAULT_FRAME_STYLE)
{
   //vvv Still necessary? It's commented out in ToolManager and Meter, so I did so here.
   //   #ifdef __WXMAC__
   //      // WXMAC doesn't support wxFRAME_FLOAT_ON_PARENT, so we do
   //      SetWindowClass((WindowRef) MacGetWindowRef(), kFloatingWindowClass);
   //   #endif
   mProject = parent;

   // loads either the XPM or the windows resource, depending on the platform
   #if !defined(__WXMAC__) && !defined(__WXX11__)
      wxIcon *ic;
      #ifdef __WXMSW__
         ic = new wxIcon(wxICON(AudacityLogo));
      #else
         ic = new wxIcon(wxICON(AudacityLogo48x48));
      #endif
      SetIcon(*ic);
      delete ic;
   #endif

   wxPoint panelPos(0, 0);
   wxSize panelSize = gSize;

   //vvv not yet working right in ported version, so choice is disabled.
   // It seems when you select highlight style, the TrackPanel timer stops working, but
   // going back to bouncing ball style starts it up again (!!!), per breakpoints in TrackPanel::OnTimer().
   //
   //wxToolBar* pToolBar = this->CreateToolBar();
   //const int kHorizMargin = 8;
   //wxASSERT(pToolBar); // To justify safenew
   //wxRadioButton* pRadioButton_BouncingBall =
   //   safenew wxRadioButton(pToolBar, kID_RadioButton_BouncingBall, _("Bouncing Ball"), wxPoint(kHorizMargin, 4),
   //       wxDefaultSize, wxRB_GROUP);
   //// Reposition to center vertically.
   //wxSize tbSize = pToolBar->GetSize();
   //wxSize btnSize = pRadioButton_BouncingBall->GetSize();
   //int top = (tbSize.GetHeight() - btnSize.GetHeight()) / 2;
   //pRadioButton_BouncingBall->Move(kHorizMargin, top);
   //pToolBar->AddControl(pRadioButton_BouncingBall);
   //
   //int left = kHorizMargin + btnSize.GetWidth() + kHorizMargin; //vvv Doesn't actually work. Probably need sizers.
   //wxRadioButton* pRadioButton_Highlight =
   //   safenew wxRadioButton(pToolBar, kID_RadioButton_Highlight, _("Highlight"), wxPoint(left, top));
   //pToolBar->AddControl(pRadioButton_Highlight);
   //
   //panelPos.x += tbSize.GetHeight();
   //panelSize.y -= tbSize.GetHeight();
   //
   //#if defined(__WXMAC__)
   //   wxColour face = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
   //   pRadioButton_BouncingBall->SetBackgroundColour(face);
   //   pRadioButton_Highlight->SetBackgroundColour(face);
   //#endif
   //
   //pToolBar->Realize();

   mLyricsPanel = safenew Lyrics(this, -1, panelPos, panelSize);

   //vvv Highlight style is broken in ported version.
   //switch (mLyricsPanel->GetLyricsStyle())
   //{
   //   case Lyrics::kBouncingBallLyrics:
   //      pRadioButton_BouncingBall->SetValue(true); break;
   //   case Lyrics::kHighlightLyrics:
   //   default:
   //      pRadioButton_Highlight->SetValue(true); break;
   //}

   // Events from the project don't propagate directly to this other frame, so...
   mProject->Connect(EVT_TRACK_PANEL_TIMER,
      wxCommandEventHandler(LyricsWindow::OnTimer),
      NULL,
      this);
}
Beispiel #5
0
AppFrame::AppFrame() :
        wxFrame(NULL, wxID_ANY, CUBICSDR_TITLE), activeDemodulator(NULL) {

#ifdef __linux__
    SetIcon(wxICON(cubicsdr));
#endif

    wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *demodVisuals = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *demodTray = new wxBoxSizer(wxHORIZONTAL);
    wxBoxSizer *demodScopeTray = new wxBoxSizer(wxVERTICAL);

    int attribList[] = { WX_GL_RGBA, WX_GL_STENCIL_SIZE, 8, WX_GL_BUFFER_SIZE, 24, WX_GL_DOUBLEBUFFER, 0 };

    demodModeSelector = new ModeSelectorCanvas(this, attribList);
    demodModeSelector->addChoice(DEMOD_TYPE_FM, "FM");
    demodModeSelector->addChoice(DEMOD_TYPE_AM, "AM");
    demodModeSelector->addChoice(DEMOD_TYPE_LSB, "LSB");
    demodModeSelector->addChoice(DEMOD_TYPE_USB, "USB");
    demodModeSelector->addChoice(DEMOD_TYPE_DSB, "DSB");
    demodModeSelector->addChoice(DEMOD_TYPE_RAW, "I/Q");
    demodModeSelector->setSelection(DEMOD_TYPE_FM);
    demodModeSelector->setHelpTip("Choose modulation type: Frequency Modulation, Amplitude Modulation and Lower, Upper or Double Side-Band.");
    demodTray->Add(demodModeSelector, 2, wxEXPAND | wxALL, 0);

//    demodTray->AddSpacer(2);

    demodSpectrumCanvas = new SpectrumCanvas(this, attribList);
    demodSpectrumCanvas->setup(1024);
    demodSpectrumCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
    demodVisuals->Add(demodSpectrumCanvas, 3, wxEXPAND | wxALL, 0);

    demodVisuals->AddSpacer(1);

    demodWaterfallCanvas = new WaterfallCanvas(this, attribList);
    demodWaterfallCanvas->setup(1024, 128);
    demodWaterfallCanvas->setView(wxGetApp().getConfig()->getCenterFreq(), 300000);
    demodWaterfallCanvas->attachSpectrumCanvas(demodSpectrumCanvas);
    demodSpectrumCanvas->attachWaterfallCanvas(demodWaterfallCanvas);
    demodVisuals->Add(demodWaterfallCanvas, 6, wxEXPAND | wxALL, 0);

    demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);

    demodTray->AddSpacer(1);

    demodSignalMeter = new MeterCanvas(this, attribList);
    demodSignalMeter->setMax(0.5);
    demodSignalMeter->setHelpTip("Current Signal Level.  Click / Drag to set Squelch level.");
    demodTray->Add(demodSignalMeter, 1, wxEXPAND | wxALL, 0);

    demodTray->AddSpacer(1);

    scopeCanvas = new ScopeCanvas(this, attribList);
    demodScopeTray->Add(scopeCanvas, 8, wxEXPAND | wxALL, 0);

    demodScopeTray->AddSpacer(1);

    demodTuner = new TuningCanvas(this, attribList);
    demodTuner->setHelpTip("Testing tuner");
    demodScopeTray->Add(demodTuner, 1, wxEXPAND | wxALL, 0);

    demodTray->Add(demodScopeTray, 30, wxEXPAND | wxALL, 0);

    demodTray->AddSpacer(1);

    demodGainMeter = new MeterCanvas(this, attribList);
    demodGainMeter->setMax(2.0);
    demodGainMeter->setHelpTip("Current Demodulator Gain Level.  Click / Drag to set Gain level.");
    demodTray->Add(demodGainMeter, 1, wxEXPAND | wxALL, 0);

    vbox->Add(demodTray, 12, wxEXPAND | wxALL, 0);
    vbox->AddSpacer(1);
    spectrumCanvas = new SpectrumCanvas(this, attribList);
    spectrumCanvas->setup(2048);
    vbox->Add(spectrumCanvas, 5, wxEXPAND | wxALL, 0);
    vbox->AddSpacer(1);
    waterfallCanvas = new WaterfallCanvas(this, attribList);
    waterfallCanvas->setup(2048, 512);
    waterfallCanvas->attachSpectrumCanvas(spectrumCanvas);
    waterfallCanvas->attachWaterfallCanvas(demodWaterfallCanvas);
    spectrumCanvas->attachWaterfallCanvas(waterfallCanvas);
    vbox->Add(waterfallCanvas, 20, wxEXPAND | wxALL, 0);

    this->SetSizer(vbox);

    //    waterfallCanvas->SetFocusFromKbd();
    waterfallCanvas->SetFocus();

    //    SetIcon(wxICON(sample));

    // Make a menubar
    wxMenuBar *menuBar = new wxMenuBar;
    wxMenu *menu = new wxMenu;
    
    menu->Append(wxID_OPEN, "&Open Session");
    menu->Append(wxID_SAVE, "&Save Session");
    menu->Append(wxID_SAVEAS, "Save Session &As..");
    menu->AppendSeparator();
    menu->Append(wxID_RESET, "&Reset Session");
            
#ifndef __APPLE__
    menu->AppendSeparator();
    menu->Append(wxID_CLOSE);
#endif
            
    menuBar->Append(menu, wxT("&File"));
            
    menu = new wxMenu;
    
    menu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset");
    menu->Append(wxID_SET_PPM, "Device PPM");
    iqSwapMenuItem = menu->AppendCheckItem(wxID_SET_SWAP_IQ, "Swap I/Q");
            
    wxMenu *dsMenu = new wxMenu;
    
    directSamplingMenuItems[0] = dsMenu->AppendRadioItem(wxID_SET_DS_OFF, "Off");
    directSamplingMenuItems[1] = dsMenu->AppendRadioItem(wxID_SET_DS_I, "I-ADC");
    directSamplingMenuItems[2] = dsMenu->AppendRadioItem(wxID_SET_DS_Q, "Q-ADC");
    
    menu->AppendSubMenu(dsMenu, "Direct Sampling");

    menuBar->Append(menu, wxT("&Settings"));
            
    menu = new wxMenu;

    std::vector<RtAudio::DeviceInfo>::iterator devices_i;
    std::map<int, RtAudio::DeviceInfo>::iterator mdevices_i;
    AudioThread::enumerateDevices(devices);

    int i = 0;

    for (devices_i = devices.begin(); devices_i != devices.end(); devices_i++) {
        if (devices_i->inputChannels) {
            inputDevices[i] = *devices_i;
        }
        if (devices_i->outputChannels) {
            outputDevices[i] = *devices_i;
        }
        i++;
    }

    for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
        wxMenuItem *itm = menu->AppendRadioItem(wxID_RT_AUDIO_DEVICE + mdevices_i->first, mdevices_i->second.name, wxT("Description?"));
        itm->SetId(wxID_RT_AUDIO_DEVICE + mdevices_i->first);
        if (mdevices_i->second.isDefaultOutput) {
            itm->Check(true);
        }
        outputDeviceMenuItems[mdevices_i->first] = itm;
    }

    menuBar->Append(menu, wxT("Audio &Output"));

    menu = new wxMenu;

    int themeId = wxGetApp().getConfig()->getTheme();
            
    menu->AppendRadioItem(wxID_THEME_DEFAULT, "Default")->Check(themeId==COLOR_THEME_DEFAULT);
    menu->AppendRadioItem(wxID_THEME_RADAR, "RADAR")->Check(themeId==COLOR_THEME_RADAR);
    menu->AppendRadioItem(wxID_THEME_BW, "Black & White")->Check(themeId==COLOR_THEME_BW);
    menu->AppendRadioItem(wxID_THEME_SHARP, "Sharp")->Check(themeId==COLOR_THEME_SHARP);
    menu->AppendRadioItem(wxID_THEME_RAD, "Rad")->Check(themeId==COLOR_THEME_RAD);
    menu->AppendRadioItem(wxID_THEME_TOUCH, "Touch")->Check(themeId==COLOR_THEME_TOUCH);
    menu->AppendRadioItem(wxID_THEME_HD, "HD")->Check(themeId==COLOR_THEME_HD);

    menuBar->Append(menu, wxT("&Color Scheme"));

    menu = new wxMenu;
            
    sampleRateMenuItems[wxID_BANDWIDTH_250K] = menu->AppendRadioItem(wxID_BANDWIDTH_250K, "250k");
    sampleRateMenuItems[wxID_BANDWIDTH_1000M] = menu->AppendRadioItem(wxID_BANDWIDTH_1000M, "1.0M");
    sampleRateMenuItems[wxID_BANDWIDTH_1500M] = menu->AppendRadioItem(wxID_BANDWIDTH_1024M, "1.024M");
    sampleRateMenuItems[wxID_BANDWIDTH_1024M] = menu->AppendRadioItem(wxID_BANDWIDTH_1500M, "1.5M");
    sampleRateMenuItems[wxID_BANDWIDTH_1800M] = menu->AppendRadioItem(wxID_BANDWIDTH_1800M, "1.8M");
    sampleRateMenuItems[wxID_BANDWIDTH_1920M] = menu->AppendRadioItem(wxID_BANDWIDTH_1920M, "1.92M");
    sampleRateMenuItems[wxID_BANDWIDTH_2000M] = menu->AppendRadioItem(wxID_BANDWIDTH_2000M, "2.0M");
    sampleRateMenuItems[wxID_BANDWIDTH_2048M] = menu->AppendRadioItem(wxID_BANDWIDTH_2048M, "2.048M");
    sampleRateMenuItems[wxID_BANDWIDTH_2160M] = menu->AppendRadioItem(wxID_BANDWIDTH_2160M, "2.16M");
    sampleRateMenuItems[wxID_BANDWIDTH_2400M] = menu->AppendRadioItem(wxID_BANDWIDTH_2400M, "2.4M");
    sampleRateMenuItems[wxID_BANDWIDTH_2560M] = menu->AppendRadioItem(wxID_BANDWIDTH_2560M, "2.56M");
    sampleRateMenuItems[wxID_BANDWIDTH_2880M] = menu->AppendRadioItem(wxID_BANDWIDTH_2880M, "2.88M");
//    sampleRateMenuItems[wxID_BANDWIDTH_3000M] = menu->AppendRadioItem(wxID_BANDWIDTH_3000M, "3.0M");
    sampleRateMenuItems[wxID_BANDWIDTH_3200M] = menu->AppendRadioItem(wxID_BANDWIDTH_3200M, "3.2M");

    sampleRateMenuItems[wxID_BANDWIDTH_2400M]->Check(true);

    menuBar->Append(menu, wxT("&Input Bandwidth"));

    std::vector<SDRDeviceInfo *> *devs = wxGetApp().getDevices();
    std::vector<SDRDeviceInfo *>::iterator devs_i;

    if (devs->size() > 1) {

        menu = new wxMenu;

        int p = 0;
        for (devs_i = devs->begin(); devs_i != devs->end(); devs_i++) {
            std::string devName = (*devs_i)->getName();
            if ((*devs_i)->isAvailable()) {
                devName.append(": ");
                devName.append((*devs_i)->getProduct());
                devName.append(" [");
                devName.append((*devs_i)->getSerial());
                devName.append("]");
            } else {
                devName.append(" (In Use?)");
            }

            menu->AppendRadioItem(wxID_DEVICE_ID + p, devName)->Check(wxGetApp().getDevice() == p);
            p++;
        }

        menuBar->Append(menu, wxT("Input &Device"));
    }

    menu = new wxMenu;

#define NUM_RATES_DEFAULT 4
    int desired_rates[NUM_RATES_DEFAULT] = { 48000, 44100, 96000, 192000 };

    for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
        int desired_rate = 0;
        int desired_rank = NUM_RATES_DEFAULT + 1;

        for (std::vector<unsigned int>::iterator srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end();
                srate++) {
            for (i = 0; i < NUM_RATES_DEFAULT; i++) {
                if (desired_rates[i] == (*srate)) {
                    if (desired_rank > i) {
                        desired_rank = i;
                        desired_rate = (*srate);
                    }
                }
            }
        }

        if (desired_rank > NUM_RATES_DEFAULT) {
            desired_rate = mdevices_i->second.sampleRates.back();
        }
        AudioThread::deviceSampleRate[mdevices_i->first] = desired_rate;
    }

    for (mdevices_i = outputDevices.begin(); mdevices_i != outputDevices.end(); mdevices_i++) {
        new wxMenu;
        int menu_id = wxID_AUDIO_BANDWIDTH_BASE + wxID_AUDIO_DEVICE_MULTIPLIER * mdevices_i->first;
        wxMenu *subMenu = new wxMenu;
        menu->AppendSubMenu(subMenu, mdevices_i->second.name, wxT("Description?"));

        int j = 0;
        for (std::vector<unsigned int>::iterator srate = mdevices_i->second.sampleRates.begin(); srate != mdevices_i->second.sampleRates.end();
                srate++) {
            std::stringstream srateName;
            srateName << ((float) (*srate) / 1000.0f) << "kHz";
            wxMenuItem *itm = subMenu->AppendRadioItem(menu_id + j, srateName.str(), wxT("Description?"));

            if ((*srate) == AudioThread::deviceSampleRate[mdevices_i->first]) {
                itm->Check(true);
            }
            audioSampleRateMenuItems[menu_id + j] = itm;

            j++;
        }
    }

    menuBar->Append(menu, wxT("Audio &Bandwidth"));

    SetMenuBar(menuBar);

    CreateStatusBar();

    wxRect *win = wxGetApp().getConfig()->getWindow();
    if (win) {
        this->SetPosition(win->GetPosition());
        this->SetClientSize(win->GetSize());
    } else {
        SetClientSize(1280, 600);
        Centre();
    }
    bool max = wxGetApp().getConfig()->getWindowMaximized();

    if (max) {
        this->Maximize();
    }

    long long freqSnap = wxGetApp().getConfig()->getSnap();
    wxGetApp().setFrequencySnap(freqSnap);
            
    ThemeMgr::mgr.setTheme(wxGetApp().getConfig()->getTheme());

    Show();

#ifdef _WIN32
    SetIcon(wxICON(frame_icon));
#endif

    wxAcceleratorEntry entries[3];
    entries[0].Set(wxACCEL_CTRL, (int) 'O', wxID_OPEN);
    entries[1].Set(wxACCEL_CTRL, (int) 'S', wxID_SAVE);
    entries[2].Set(wxACCEL_CTRL, (int) 'A', wxID_SAVEAS);

    wxAcceleratorTable accel(3, entries);
    SetAcceleratorTable(accel);

//    static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
//    wxLogStatus("Double-buffered display %s supported", wxGLCanvas::IsDisplaySupported(attribs) ? "is" : "not");
//    ShowFullScreen(true);
}
Beispiel #6
0
wxFrame *MyApp::CreateChildFrame(wxView *view, bool isCanvas)
{
    // create a child frame of appropriate class for the current mode
    wxFrame *subframe;
    wxDocument *doc = view->GetDocument();
#if wxUSE_MDI_ARCHITECTURE
    if ( GetMode() == Mode_MDI )
    {
        subframe = new wxDocMDIChildFrame
                       (
                            doc,
                            view,
                            wxStaticCast(GetTopWindow(), wxDocMDIParentFrame),
                            wxID_ANY,
                            "Child Frame",
                            wxDefaultPosition,
                            wxSize(300, 300)
                       );
    }
    else
#endif // wxUSE_MDI_ARCHITECTURE
    {
        subframe = new wxDocChildFrame
                       (
                            doc,
                            view,
                            wxStaticCast(GetTopWindow(), wxDocParentFrame),
                            wxID_ANY,
                            "Child Frame",
                            wxDefaultPosition,
                            wxSize(300, 300)
                       );

        subframe->Centre();
    }

    wxMenu *menuFile = new wxMenu;

    menuFile->Append(wxID_NEW);
    menuFile->Append(wxID_OPEN);
    AppendDocumentFileCommands(menuFile, isCanvas);
    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT);

    wxMenu *menuEdit;
    if ( isCanvas )
    {
        menuEdit = CreateDrawingEditMenu();

        doc->GetCommandProcessor()->SetEditMenu(menuEdit);
        doc->GetCommandProcessor()->Initialize();
    }
    else // text frame
    {
        menuEdit = new wxMenu;
        menuEdit->Append(wxID_COPY);
        menuEdit->Append(wxID_PASTE);
        menuEdit->Append(wxID_SELECTALL);
    }

    CreateMenuBarForFrame(subframe, menuFile, menuEdit);

    subframe->SetIcon(isCanvas ? wxICON(chrt) : wxICON(notepad));

    return subframe;
}
Beispiel #7
0
NyqBench::NyqBench(wxWindow * parent)
:  wxFrame(NULL,
           wxID_ANY,
           wxEmptyString,
           wxDefaultPosition,
           wxDefaultSize,
           wxDEFAULT_FRAME_STYLE |
           wxMINIMIZE_BOX |
           wxMAXIMIZE_BOX |
           wxRESIZE_BORDER)
{
   mFindDlg = NULL;
   mRunning = false;
   mScriptBox = NULL;
   mOutputBox = NULL;
   mScript = NULL;
   mOutput = NULL;

   // No need to delete...EffectManager will do it
   mEffect = new NyquistEffect(wxT("===nyquistworker==="));
   EffectManager::Get().RegisterEffect(mEffect);

   mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString);
   mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0);
   mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0);
   mLargeIcons = (gPrefs->Read(wxT("NyqBench/LargeIcons"), 0L) != 0);
   mSplitMode = gPrefs->Read(wxT("NyqBench/SplitMode"), wxSPLIT_VERTICAL);
   mShowCode = (gPrefs->Read(wxT("NyqBench/ShowScript"), true) != 0);
   mShowOutput = (gPrefs->Read(wxT("NyqBench/ShowOutput"), true) != 0);

   SetIcon(wxICON(AudacityLogo));
   SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
   ShuttleGui S(this, eIsCreating);
   PopulateOrExchange(S);
   wxMenuBar *bar = new wxMenuBar();

   wxMenu *menu = new wxMenu();
   menu->Append(wxID_NEW, wxT("&New\tCtrl+N"));
   menu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O"));
   menu->Append(wxID_SAVE, wxT("&Save...\tCtrl+S"));
   menu->Append(wxID_SAVEAS, wxT("Save &As...\tCtrl+Shift+S"));
   menu->AppendSeparator();
   menu->Append(wxID_REVERT_TO_SAVED, _T("&Revert to Saved"));
   menu->AppendSeparator();
   menu->AppendCheckItem(ID_AUTOLOAD, _T("Auto &Load Last File"))->Check(mAutoLoad);
   menu->AppendSeparator();
   menu->Append(wxID_CLOSE, wxT("&Close Window\tCtrl+W"));
   bar->Append(menu, wxT("&File"));

   menu = new wxMenu();
   menu->Append(wxID_UNDO, _("&Undo\tCtrl+Z"));
   menu->Append(wxID_REDO, _("&Redo\tCtrl+Y"));
   menu->AppendSeparator();
   menu->Append(wxID_CUT, _("Cu&t\tCtrl+X"));
   menu->Append(wxID_COPY, _("&Copy\tCtrl+C"));
   menu->Append(wxID_PASTE, _("&Paste\tCtrl+V"));
   menu->Append(wxID_CLEAR, _("Cle&ar\tCtrl+L"));
   menu->AppendSeparator();
   menu->Append(wxID_SELECTALL, _("Select A&ll\tCtrl+A"));
   menu->AppendSeparator();
   menu->Append(wxID_FIND, _("&Find...\tCtrl+F"));
   menu->AppendSeparator();
   wxMenu *sub = new wxMenu();
   sub->Append(ID_MATCH, _("&Matching Paren\tF8"));
   sub->Append(ID_TOP, _("&Top S-expr\tF9"));
   sub->Append(ID_UP, _("&Higher S-expr\tF10"));
   sub->Append(ID_PREVIOUS, _("&Previous S-expr\tF11"));
   sub->Append(ID_NEXT, _("&Next S-expr\tF12"));
   menu->AppendSubMenu(sub, _("&Go to"));
   menu->AppendSeparator();
   menu->AppendCheckItem(ID_AUTOWRAP, _T("Auto &Wrap"))->Check(mAutoWrap);
   bar->Append(menu, wxT("&Edit"));

   menu = new wxMenu();
   menu->Append(ID_FONT, _("Select &Font..."));
   menu->AppendSeparator();
   menu->Append(ID_SPLITV, _("Split &Vertically"));
   menu->Append(ID_SPLITH, _("Split &Horizontally"));
   menu->AppendSeparator();
   menu->AppendCheckItem(ID_TOGGLECODE, _("Show S&cript"));
   menu->AppendCheckItem(ID_TOGGLEOUTPUT, _("Show &Output"));
   menu->AppendSeparator();
   sub = new wxMenu();
   sub->AppendRadioItem(ID_LARGEICONS, _("&Large Icons"));
   sub->AppendRadioItem(ID_SMALLICONS, _("&Small Icons"));
   menu->AppendSubMenu(sub, _("Toolbar"));
   bar->Append(menu, wxT("&View"));

   menu = new wxMenu();
   menu->Append(ID_GO, _("&Go\tF5"));
   menu->Append(ID_STOP, _("&Stop\tF6"));
   bar->Append(menu, wxT("&Run"));

#if defined(__WXMAC__)
   menu->Append(wxID_ABOUT, _("&About"));
#else
   menu = new wxMenu();
   menu->Append(wxID_ABOUT, _("&About"));
   bar->Append(menu, wxT("Help"));
#endif

   SetMenuBar(bar);

   RecreateToolbar(mLargeIcons);

   wxRect r;
   r.SetX(gPrefs->Read(wxT("NyqBench/Window/X"), -1));
   r.SetY(gPrefs->Read(wxT("NyqBench/Window/Y"), -1));
   r.SetWidth(gPrefs->Read(wxT("NyqBench/Window/Width"), -1));
   r.SetHeight(gPrefs->Read(wxT("NyqBench/Window/Height"), -1));
   if (r == wxRect(-1, -1, -1, -1)) {
      Center();
   }
   else {
      SetSize(r);
   }

   bool maximized = false;
   gPrefs->Read(wxT("NyqBench/Window/Maximized"), maximized);
   if (maximized) {
      Maximize();
   }

   long sashpos;
   sashpos = gPrefs->Read(wxT("NyqBench/SplitX"), 0l);
   if (sashpos > 0) {
      mSplitter->SetSashPosition(sashpos);
   }

   wxString dflt = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT).GetNativeFontInfoDesc();
   wxString desc;
   wxTextAttr attr;

   desc = gPrefs->Read(wxT("NyqBench/ScriptFont"), dflt);
   mScriptFont.SetNativeFontInfo(desc);
#if defined(__WXMSW__)
   // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
   // I don't know if this is something I'm doing wrong, but I'll have to look at this
   // later if I get bored.
   mScriptFont.SetEncoding(wxFONTENCODING_SYSTEM);
#endif
   attr.SetFont(mScriptFont);
   mScript->SetDefaultStyle(attr);

   desc = gPrefs->Read(wxT("NyqBench/OutputFont"), dflt);
   mOutputFont.SetNativeFontInfo(desc);
#if defined(__WXMSW__)
   // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
   // I don't know if this is something I'm doing wrong, but I'll have to look at this
   // later if I get bored.
   mOutputFont.SetEncoding(wxFONTENCODING_SYSTEM);
#endif
   attr.SetFont(mOutputFont);
   mOutput->SetDefaultStyle(attr);

   if (mAutoLoad && !mPath.GetFullPath().IsEmpty()) {
      LoadFile();
   }

   SetWindowTitle();
}
Beispiel #8
0
void MyFrame::Draw(wxDC& dc)
{
    // This routine just draws a bunch of random stuff on the screen so that we
    // can check that different types of object are being drawn consistently
    // between the screen image, the print preview image (at various zoom
    // levels), and the printed page.
    dc.SetBackground(*wxWHITE_BRUSH);
    dc.Clear();
    dc.SetFont(wxGetApp().m_testFont);

    dc.SetBackgroundMode(wxTRANSPARENT);

    dc.SetPen(*wxBLACK_PEN);
    dc.SetBrush(*wxLIGHT_GREY_BRUSH);
//    dc.SetBackground(*wxWHITE_BRUSH);
    dc.DrawRectangle(0, 0, 230, 350);
    dc.DrawLine(0, 0, 229, 349);
    dc.DrawLine(229, 0, 0, 349);
    dc.SetBrush(*wxTRANSPARENT_BRUSH);

    dc.SetBrush(*wxCYAN_BRUSH);
    dc.SetPen(*wxRED_PEN);

    dc.DrawRoundedRectangle(0, 20, 200, 80, 20);

    dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40);

    dc.SetPen( wxPen(*wxBLACK,0,wxDOT_DASH) );
    dc.DrawEllipse(50, 140, 100, 50);
    dc.SetPen(*wxRED_PEN);

    dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180);
    
#if wxUSE_UNICODE
    //char *test = "Hebrew    שלום -- Japanese (日本語)";
    //wxString tmp = wxConvUTF8.cMB2WC( test );
    //dc.DrawText( tmp, 10, 200 );
#endif

    wxPoint points[5];
    points[0].x = 0;
    points[0].y = 0;
    points[1].x = 20;
    points[1].y = 0;
    points[2].x = 20;
    points[2].y = 20;
    points[3].x = 10;
    points[3].y = 20;
    points[4].x = 10;
    points[4].y = -20;
    dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE );
    dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE );

    dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 );

    points[0].x = 150;
    points[0].y = 250;
    points[1].x = 180;
    points[1].y = 250;
    points[2].x = 180;
    points[2].y = 220;
    points[3].x = 200;
    points[3].y = 220;
    dc.DrawSpline( 4, points );

    dc.DrawArc( 20,10, 10,10, 25,40 );
        
    wxString str;
    int i = 0;
    str.Printf( wxT("---- Text at angle %d ----"), i );
    dc.DrawRotatedText( str, 100, 300, i );

    i = m_angle;
    str.Printf( wxT("---- Text at angle %d ----"), i );
    dc.DrawRotatedText( str, 100, 300, i );

    wxIcon my_icon = wxICON(mondrian) ;

    dc.DrawIcon( my_icon, 100, 100);

    if (m_bitmap.Ok())
    {
      dc.DrawBitmap(m_bitmap, 10, 25);
    }
    if (m_imgUp.Ok())
    {
      dc.DrawBitmap(m_imgUp, 300, 200);
      dc.DrawBitmap(m_imgUp, 300, 250, true);
    }
}
Beispiel #9
0
bool MyApp::OnInit(void)
{
  wxInitAllImageHandlers();

  // Set the font path and working directory
  wxFileName exePath = wxStandardPaths::Get().GetExecutablePath();
#ifdef __WXMAC__
  wxString fontPath = exePath.GetPathWithSep() + wxT("../../../../../lib/fonts");
  wxString cwdPath  = exePath.GetPathWithSep() + wxT("../../..");
#else
  wxString fontPath = exePath.GetPathWithSep() + wxT("../../lib/fonts");
  wxString cwdPath  = exePath.GetPath();
#endif
  wxPdfFontManager::GetFontManager()->AddSearchPath(fontPath);
  wxSetWorkingDirectory(cwdPath);

#if wxCHECK_VERSION(2,9,0)
    m_testFont.Create(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
#else
    m_testFont.Create(10, wxSWISS, wxNORMAL, wxNORMAL);
#endif

    g_printData = new wxPrintData;
    // You could set an initial paper size here
//    g_printData->SetPaperId(wxPAPER_LETTER); // for Americans
//    g_printData->SetPaperId(wxPAPER_A4);    // for everyone else    

    g_pageSetupData = new wxPageSetupDialogData;
    // copy over initial paper size from print record
    (*g_pageSetupData) = *g_printData;
    // Set some initial page margins in mm. 
    g_pageSetupData->SetMarginTopLeft(wxPoint(15, 15));
    g_pageSetupData->SetMarginBottomRight(wxPoint(15, 15));

    // Create the main frame window
    frame = new MyFrame((wxFrame *) NULL, _T("wxWidgets Printing Demo"), 
        wxPoint(0, 0), wxSize(400, 400));

#if wxUSE_STATUSBAR
    // Give it a status line
    frame->CreateStatusBar(2);
#endif // wxUSE_STATUSBAR

    // Load icon and bitmap
    frame->SetIcon( wxICON( mondrian) );

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(WXPRINT_PRINT, _T("&Print..."),              _T("Print"));
    file_menu->Append(WXPRINT_PDF, _T("PDF..."),              _T("PDF"));
    file_menu->Append(WXPRINT_PAGE_SETUP, _T("Page Set&up..."),              _T("Page setup"));
#ifdef __WXMAC__
    file_menu->Append(WXPRINT_PAGE_MARGINS, _T("Page Margins..."), _T("Page margins"));
#endif
    file_menu->Append(WXPRINT_PREVIEW, _T("Print Pre&view"),              _T("Preview"));

#if wxUSE_ACCEL
    // Accelerators
    wxAcceleratorEntry entries[1];
    entries[0].Set(wxACCEL_CTRL, (int) 'V', WXPRINT_PREVIEW);
    wxAcceleratorTable accel(1, entries);
    frame->SetAcceleratorTable(accel);
#endif

#if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
    file_menu->AppendSeparator();
    file_menu->Append(WXPRINT_PRINT_PS, _T("Print PostScript..."),              _T("Print (PostScript)"));
    file_menu->Append(WXPRINT_PAGE_SETUP_PS, _T("Page Setup PostScript..."),              _T("Page setup (PostScript)"));
    file_menu->Append(WXPRINT_PREVIEW_PS, _T("Print Preview PostScript"),              _T("Preview (PostScript)"));
#endif

    file_menu->AppendSeparator();
    file_menu->Append(WXPRINT_ANGLEUP, _T("Angle up\tAlt-U"),                _T("Raise rotated text angle"));
    file_menu->Append(WXPRINT_ANGLEDOWN, _T("Angle down\tAlt-D"),            _T("Lower rotated text angle"));
    file_menu->AppendSeparator();
    file_menu->Append(WXPRINT_QUIT, _T("E&xit"),                _T("Exit program"));

    wxMenu *help_menu = new wxMenu;
    help_menu->Append(WXPRINT_ABOUT, _T("&About"),              _T("About this demo"));

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu, _T("&File"));
    menu_bar->Append(help_menu, _T("&Help"));

    // Associate the menu bar with the frame
    frame->SetMenuBar(menu_bar);

    MyCanvas *canvas = new MyCanvas(frame, wxPoint(0, 0), wxSize(100, 100), wxRETAINED|wxHSCROLL|wxVSCROLL);

    // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction
    canvas->SetScrollbars(20, 20, 50, 50);

    frame->canvas = canvas;

    frame->Centre(wxBOTH);
    frame->Show();

#if wxUSE_STATUSBAR
    frame->SetStatusText(_T("Printing demo"));
#endif // wxUSE_STATUSBAR

    SetTopWindow(frame);

    return true;
}
Beispiel #10
0
sfxFrame::sfxFrame(wxWindow* parent,wxWindowID id)
{
    //(*Initialize(sfxFrame)
    wxMenuItem* MenuItem2;
    wxMenuItem* MenuItem1;
    wxBoxSizer* BoxSizer2;
    wxMenu* Menu1;
    wxBoxSizer* BoxSizer1;
    wxMenuBar* MenuBar1;
    wxBoxSizer* BoxSizer3;
    wxMenu* Menu2;

    Create(parent, wxID_ANY, _("SFX 1.32"), wxDefaultPosition, wxDefaultSize, wxSTAY_ON_TOP|wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
    SetClientSize(wxSize(979,363));
    SetBackgroundColour(wxColour(137,234,72));
    BoxSizer1 = new wxBoxSizer(wxVERTICAL);
    BoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
    SearchTextCtrl = new wxTextCtrl(this, ID_SEARCHTEXT, wxEmptyString, wxDefaultPosition, wxSize(303,21), wxTE_PROCESS_ENTER, wxDefaultValidator, _T("ID_SEARCHTEXT"));
    SearchTextCtrl->SetMinSize(wxDLG_UNIT(this,wxSize(200,12)));
    SearchTextCtrl->SetMaxSize(wxDLG_UNIT(this,wxSize(1000,12)));
    BoxSizer2->Add(SearchTextCtrl, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    SearchButton = new wxButton(this, ID_SEARCH, _("Search"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_SEARCH"));
    SearchButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12)));
    SearchButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12)));
    BoxSizer2->Add(SearchButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    AndRadioButton = new wxRadioButton(this, ID_ANDRADIOBUTTON, _("AND"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(30,12)), wxRB_GROUP, wxDefaultValidator, _T("ID_ANDRADIOBUTTON"));
    AndRadioButton->SetValue(true);
    AndRadioButton->SetMinSize(wxDLG_UNIT(this,wxSize(30,12)));
    AndRadioButton->SetMaxSize(wxDLG_UNIT(this,wxSize(30,12)));
    BoxSizer2->Add(AndRadioButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    OrRadioButton = new wxRadioButton(this, ID_ORRADIOBUTTON, _("OR"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(30,12)), 0, wxDefaultValidator, _T("ID_ORRADIOBUTTON"));
    OrRadioButton->SetMinSize(wxDLG_UNIT(this,wxSize(30,12)));
    OrRadioButton->SetMaxSize(wxDLG_UNIT(this,wxSize(30,12)));
    BoxSizer2->Add(OrRadioButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    PlayButton = new wxButton(this, ID_PLAYBUTTON, _("Play"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_PLAYBUTTON"));
    PlayButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12)));
    PlayButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12)));
    BoxSizer2->Add(PlayButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    StopButton = new wxButton(this, ID_STOPBUTTON, _("Stop"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_STOPBUTTON"));
    StopButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12)));
    StopButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12)));
    BoxSizer2->Add(StopButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    DetailButton = new wxButton(this, ID_DETAILBUTTON, _("Detail"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(35,12)), 0, wxDefaultValidator, _T("ID_DETAILBUTTON"));
    DetailButton->SetMinSize(wxDLG_UNIT(this,wxSize(35,12)));
    DetailButton->SetMaxSize(wxDLG_UNIT(this,wxSize(35,12)));
    BoxSizer2->Add(DetailButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    TopmostCheckBox = new wxCheckBox(this, ID_TOPMOSTCHECKBOX, _("Topmost"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(45,12)), 0, wxDefaultValidator, _T("ID_TOPMOSTCHECKBOX"));
    TopmostCheckBox->SetValue(true);
    TopmostCheckBox->SetMinSize(wxDLG_UNIT(this,wxSize(45,12)));
    TopmostCheckBox->SetMaxSize(wxDLG_UNIT(this,wxSize(45,12)));
    BoxSizer2->Add(TopmostCheckBox, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    SaveFolderButton = new wxButton(this, ID_SAVEFOLDERBUTTON, _("..."), wxDefaultPosition, wxDLG_UNIT(this,wxSize(20,12)), 0, wxDefaultValidator, _T("ID_SAVEFOLDERBUTTON"));
    SaveFolderButton->SetMinSize(wxDLG_UNIT(this,wxSize(20,12)));
    SaveFolderButton->SetMaxSize(wxDLG_UNIT(this,wxSize(20,12)));
    BoxSizer2->Add(SaveFolderButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    SaveToFolderButton = new wxButton(this, ID_SAVETOFOLDERBUTTON, _("Save to folder"), wxDefaultPosition, wxDLG_UNIT(this,wxSize(60,12)), 0, wxDefaultValidator, _T("ID_SAVETOFOLDERBUTTON"));
    SaveToFolderButton->SetMinSize(wxDLG_UNIT(this,wxSize(60,12)));
    SaveToFolderButton->SetMaxSize(wxDLG_UNIT(this,wxSize(60,12)));
    SaveToFolderButton->Disable();
    BoxSizer2->Add(SaveToFolderButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 2);
    BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 0);
    BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
    ResultsListCtrl = new wxListCtrl(this, ID_RESULTSLISTCTRL, wxDefaultPosition, wxSize(1183,319), wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL|wxVSCROLL|wxHSCROLL, wxDefaultValidator, _T("ID_RESULTSLISTCTRL"));
    wxFont ResultsListCtrlFont(14,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Arial"),wxFONTENCODING_DEFAULT);
    ResultsListCtrl->SetFont(ResultsListCtrlFont);
    BoxSizer3->Add(ResultsListCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 1);
    BoxSizer1->Add(BoxSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
    SetSizer(BoxSizer1);
    MenuBar1 = new wxMenuBar();
    Menu1 = new wxMenu();
    MenuItem1 = new wxMenuItem(Menu1, idMenuQuit, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
    Menu1->Append(MenuItem1);
    MenuBar1->Append(Menu1, _("&File"));
    Menu2 = new wxMenu();
    MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("Show info about this application"), wxITEM_NORMAL);
    Menu2->Append(MenuItem2);
    MenuBar1->Append(Menu2, _("Help"));
    SetMenuBar(MenuBar1);
    StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
    int __wxStatusBarWidths_1[1] = { -1 };
    int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
    StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
    StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
    SetStatusBar(StatusBar1);
    DirDialog1 = new wxDirDialog(this, _("Select directory"), wxEmptyString, wxDD_DEFAULT_STYLE, wxDefaultPosition, wxDefaultSize, _T("wxDirDialog"));
    SetSizer(BoxSizer1);
    Layout();

    Connect(ID_SEARCHTEXT,wxEVT_COMMAND_TEXT_ENTER,(wxObjectEventFunction)&sfxFrame::OnSearchTextCtrlTextEnter);
    Connect(ID_SEARCH,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnSearchButtonClick);
    Connect(ID_ANDRADIOBUTTON,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&sfxFrame::OnAndRadioButtonSelect);
    Connect(ID_ORRADIOBUTTON,wxEVT_COMMAND_RADIOBUTTON_SELECTED,(wxObjectEventFunction)&sfxFrame::OnOrRadioButtonSelect);
    Connect(ID_PLAYBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnPlayButtonClick);
    Connect(ID_STOPBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnStopButtonClick);
    Connect(ID_DETAILBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnDetailButtonClick);
    Connect(ID_TOPMOSTCHECKBOX,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&sfxFrame::OnTopmostCheckBoxClick);
    Connect(ID_SAVEFOLDERBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnSaveFolderButtonClick);
    Connect(ID_SAVETOFOLDERBUTTON,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&sfxFrame::OnSaveToFolderButtonClick);
    Connect(ID_RESULTSLISTCTRL,wxEVT_COMMAND_LIST_BEGIN_DRAG,(wxObjectEventFunction)&sfxFrame::OnResultsListCtrlBeginDrag);
    Connect(ID_RESULTSLISTCTRL,wxEVT_COMMAND_LIST_ITEM_SELECTED,(wxObjectEventFunction)&sfxFrame::OnResultsListCtrlItemSelect);
    Connect(idMenuQuit,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&sfxFrame::OnQuit);
    Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&sfxFrame::OnAbout);
    //*)

    // Report how many sounds were loaded.

    wxString s;
    s.Printf(_("%d sound effects found"), m_model.totalCount());
    StatusBar1->SetLabel(s);

    // Set the icon for this application (see .rc file).

    SetIcon(wxICON(aaaa));

    // Tooltips are annoying and slow us down for this application.

    wxToolTip::Enable(false);

    // That's not enough for the list control, so we disable tooltips the win32 lowlevel way too.

    const int LVM_SETEXTENDEDLISTVIEWSTYLE = 4150;
    const int LVM_GETEXTENDEDLISTVIEWSTYLE = 4151;
    const int LVS_EX_LABELTIP = 16384;

    long style = ::SendMessage((HWND)ResultsListCtrl->GetHandle(), LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
    style = style & (~LVS_EX_LABELTIP);
    ::SendMessage((HWND)ResultsListCtrl->GetHandle(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, style);

    // Check if model has correctly loaded everything.

    wxString description;

    if(m_model.hasDataError(description))
    {
        wxMessageBox(description, _("Error..."));
    }
}
Beispiel #11
0
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size, long style)
       : wxFrame(NULL, wxID_ANY, title, pos, size, style)
{
    m_textCtrl = NULL;

    SetAccessible(new FrameAccessible(this));

    // set the frame icon
    SetIcon(wxICON(sample));

#if wxUSE_MENUS
    // create a menu bar
    wxMenu *menuFile = new wxMenu;

    // the "About" item should be in the help menu
    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(AccessTest_About, wxT("&About"), wxT("Show about dialog"));

    menuFile->Append(AccessTest_Query, wxT("Query"), wxT("Query the window hierarchy"));
    menuFile->AppendSeparator();
    menuFile->Append(AccessTest_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));

    // now append the freshly created menu to the menu bar...
    wxMenuBar *menuBar = new wxMenuBar();
    menuBar->Append(menuFile, wxT("&File"));
    menuBar->Append(helpMenu, wxT("&Help"));

    // ... and attach this menu bar to the frame
    SetMenuBar(menuBar);
#endif // wxUSE_MENUS

#if 0 // wxUSE_STATUSBAR
    // create a status bar just for fun (by default with 1 pane only)
    CreateStatusBar(2);
    SetStatusText(wxT("Welcome to wxWidgets!"));
#endif // wxUSE_STATUSBAR


    wxSplitterWindow* splitter = new wxSplitterWindow(this, wxID_ANY);
    splitter->SetAccessible(new SplitterWindowAccessible(splitter));

    wxListBox* listBox = new wxListBox(splitter, wxID_ANY);
    listBox->Append(wxT("Cabbages"));
    listBox->Append(wxT("Kings"));
    listBox->Append(wxT("Sealing wax"));
    listBox->Append(wxT("Strings"));
    listBox->CreateAccessible();
    listBox->SetHelpText(wxT("This is a sample wxWidgets listbox, with a number of items in it."));

    m_textCtrl = new wxTextCtrl(splitter, wxID_ANY, wxT(""), wxDefaultPosition,
        wxDefaultSize, wxTE_MULTILINE);
    m_textCtrl->CreateAccessible();
    m_textCtrl->SetHelpText(wxT("This is a sample wxWidgets multiline text control."));

    splitter->SplitHorizontally(listBox, m_textCtrl, 150);

#if 0
    wxScrolledWindow* scrolledWindow = new wxScrolledWindow(this, wxID_ANY);
    scrolledWindow->SetAccessible(new ScrolledWindowAccessible(scrolledWindow));
#endif
}
Beispiel #12
0
CConfigTree::CConfigTree(wxWindow * parent, wxWindowID id, const wxPoint & pt, const wxSize & sz, long style)
:  CScrolledTreeCtrl(parent, id, pt, sz, style)
{
    m_imageList = new wxImageList(16, 16, true);
    m_iconDB.SetImageList(m_imageList);
    SetImageList(m_imageList);

    m_iconDB.AddInfo(wxT("Folder"), wxICON(closedfolder), 0, true);
    m_iconDB.AddInfo(wxT("Folder"), wxICON(closedfolder_dis), 0, false);

    m_iconDB.AddInfo(wxT("Library"), wxICON(library), 0, true);
    m_iconDB.AddInfo(wxT("Library"), wxICON(library_dis), 0, false);

    m_iconDB.AddInfo(wxT("Module"), wxICON(module), 0, true);
    m_iconDB.AddInfo(wxT("Module"), wxICON(module_dis), 0, false);

    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(checked), 0, true);
    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(checked_dis), 0, false);
    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(unchecked), 1, true);
    m_iconDB.AddInfo(wxT("Checkbox"), wxICON(unchecked_dis), 1, false);

    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radioon), 0, true);
    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radioon_dis), 0, false);
    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radiooff), 1, true);
    m_iconDB.AddInfo(wxT("Radiobox"), wxICON(radiooff_dis), 1, false);

    m_iconDB.AddInfo(wxT("Text"), wxICON(text), 0, true);
    m_iconDB.AddInfo(wxT("Text"), wxICON(text_dis), 0, false);

    m_iconDB.AddInfo(wxT("Enumerated"), wxICON(enumerated), 0, true);
    m_iconDB.AddInfo(wxT("Enumerated"), wxICON(enumerated_dis), 0, false);

    m_iconDB.AddInfo(wxT("Integer"), wxICON(integer), 0, true);
    m_iconDB.AddInfo(wxT("Integer"), wxICON(integer_dis), 0, false);
}
Beispiel #13
0
HtMainFrame::HtMainFrame (const wxString &title, const wxPoint &pos, const wxSize &size, long flags) :
   wxAuiMDIParentFrame(0, wxID_ANY, title, pos, size, flags | wxBORDER_NONE | wxFRAME_NO_WINDOW_MENU),
   history(9, HT_FileHistory_Base)
{
   // logger
   logger = new wxLogWindow(this, wxT("Logger"), false);
   wxLog::SetActiveTarget(logger);

   aui_manager.SetManagedWindow(this);
   SetIcon(wxICON(hterminator));

   HtArtProvider &art = wxGetApp().art_provider;
   art.Add(wxT("images/common.png"), HTArtId_Common, wxT("image/png"), true, wxSize(16, 15));
   art.Add(wxT("images/main_tb.png"), HTArtId_MainTb, wxT("image/png"), true, wxSize(16, 16));
   art.Add(wxT("images/view_tb.png"), HTArtId_ViewTb, wxT("image/png"), true, wxSize(16, 15));
   art.Add(wxT("images/nav_tb.png"), HTArtId_NavTb, wxT("image/png"), true, wxSize(16, 15));

#if wxUSE_MENUS
   CreateMenu(art);
#endif //~wxUSE_MENUS

   BookmarksPanel *bookmarks = new BookmarksPanel(this, wxID_ANY);

   wxAuiToolBar *tb_main = new wxAuiToolBar(this, HT_Toolbar_Main/*, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW*/);
   tb_main->SetToolBitmapSize(wxSize(16, 15));
   tb_main->AddTool(HT_FileNew, _("New"), art.GetBitmap(HTArtId_MainTb, HTArt_New), _("New (Ctrl+N)"));
   tb_main->AddTool(HT_FileOpen, _("Open"), art.GetBitmap(HTArtId_MainTb, HTArt_Open), _("Open (Ctrl+O)"));
   tb_main->AddTool(HT_FileSave, _("Save"), art.GetBitmap(HTArtId_MainTb, HTArt_Save), _("Save (Ctrl+S)"))->SetDisabledBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_SaveGr));
   tb_main->AddSeparator();
   tb_main->AddTool(HT_EditCut, _("Cut"), art.GetBitmap(HTArtId_MainTb, HTArt_Cut), _("Cut (Ctrl+X)"))->SetDisabledBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_CutGr));
   tb_main->AddTool(HT_EditCopy, _("Copy"), art.GetBitmap(HTArtId_MainTb, HTArt_Copy), _("Copy (Ctrl+C)"))->SetDisabledBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_CopyGr));
   tb_main->AddTool(HT_EditPaste, _("Paste"), art.GetBitmap(HTArtId_MainTb, HTArt_Paste), _("Paste (Ctrl+V)"))->SetDisabledBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_PasteGr));
   tb_main->AddSeparator();
   tb_main->AddTool(HT_EditUndo, _("Undo"), art.GetBitmap(HTArtId_MainTb, HTArt_Undo), _("Undo (Ctrl+Z)"))->SetDisabledBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_UndoGr));
   tb_main->AddTool(HT_EditRedo, _("Redo"), art.GetBitmap(HTArtId_MainTb, HTArt_Redo), _("Redo (Ctrl+Y)"))->SetDisabledBitmap(art.GetBitmap(HTArtId_MainTb, HTArt_RedoGr));
   tb_main->SetToolDropDown(HT_EditUndo, true);
   tb_main->SetToolDropDown(HT_FileOpen, true);
   tb_main->Realize();

   wxAuiToolBar *tb_view = new wxAuiToolBar(this, HT_Toolbar_View/*, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW*/);
   wxChoice *tablelist = new wxChoice(tb_view, HT_Tool_TableList);
   tb_view->AddControl(tablelist, _("Table"));
   tb_view->AddTool(HT_ViewAddTable, _("Add Table"), art.GetBitmap(HTArtId_ViewTb, HTArt_AddTable), _("Add table"));

   tablelist->Append(wxT("ASCII default"));
   tablelist->SetSelection(0);

   wxAuiToolBar *tb_nav = new wxAuiToolBar(this, HT_Toolbar_Navigation/*, wxDefaultPosition, wxDefaultSize, wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_OVERFLOW*/);
   tb_nav->SetToolBitmapSize(wxSize(16, 15));
   tb_nav->AddTool(HT_EditFindForw, _("Find backward"), art.GetBitmap(HTArtId_NavTb, HTArt_SearchBack), _("Find Backward"));
   tb_nav->AddControl(new wxComboBox(tb_nav, HT_Tool_SearchBox, wxT(""), wxDefaultPosition, wxSize(200, 20)));
   tb_nav->AddTool(HT_EditFindBack, _("Find forward"), art.GetBitmap(HTArtId_NavTb, HTArt_SearchForw), _("Find Forward"));
   wxComboBox *jump_hex = new wxComboBox(tb_nav, HT_Tool_JumpHex, wxT(""), wxDefaultPosition, wxSize(115, 20));
   jump_hex->SetForegroundColour(wxColor(128, 0, 0));
   tb_nav->AddControl(jump_hex, _("Jump hex"));
   wxComboBox *jump_dec = new wxComboBox(tb_nav, HT_Tool_JumpDec, wxT(""), wxDefaultPosition, wxSize(140, 20));
   //jump_dec->SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false));
   jump_dec->SetForegroundColour(wxColor(0, 0, 128));
   tb_nav->AddControl(jump_dec, _("Jump decimal"));
   tb_nav->Realize();

   aui_manager.AddPane(tb_main, wxAuiPaneInfo().ToolbarPane().Top().LeftDockable(false).RightDockable(false));
   aui_manager.AddPane(tb_view, wxAuiPaneInfo().ToolbarPane().Top().Position(1).LeftDockable(false).RightDockable(false));
   aui_manager.AddPane(tb_nav, wxAuiPaneInfo().ToolbarPane().Top().Row(1).LeftDockable(false).RightDockable(false));
   
   aui_manager.AddPane(bookmarks, wxAuiPaneInfo().Right().PinButton().CloseButton().MinimizeButton().MinSize(150, 100)
      .BestSize(180, 100).FloatingSize(250, 200).Caption("Bookmarks").Name("bookmarks"));

   statusbar = new wxStatusBar(this, wxID_ANY, wxSB_FLAT);
   statusbar->SetFieldsCount(1);
   statusbar->PushStatusText(_("Ready"));
   SetStatusBar(statusbar);
  
   wxAuiMDIParentFrame::GetClientWindow()->Connect(
      wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, wxAuiNotebookEventHandler(HtMainFrame::OnNotebookPageClose));

   jump_hex->Connect(wxEVT_TEXT_ENTER, wxCommandEventHandler(HtMainFrame::OnJumpHexTextEnter));
   //jump_hex->Connect(wxEVT_TEXT, wxCommandEventHandler(HtMainFrame::OnJumpHexTextEnter));


#ifdef WXDEBUG
   DebugPanel *debugPanel = new DebugPanel(this, HT_DebugPanel);
   
   aui_manager.AddPane(debugPanel, wxAuiPaneInfo().Right().PinButton().CloseButton().MinimizeButton()
      .MinSize(150, 100).BestSize(240, 100).FloatingSize(250, 200).Caption("Debug Info").Name("debug_pane"));

   aui_manager.GetPane("bookmarks").Hide();

   wxAuiMDIParentFrame::GetClientWindow()->Connect(
      wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler(HtMainFrame::OnNotebookPageChange));
#endif

   aui_manager.Update();

   // TEMP -----------------
   //DoOpenFile(wxT("D:/Projects/ricardojricken/trunk/hexterminator/test/1452 - Metroid - Zero Mission (EU) (M5).gba"));
   DoOpenFile("test/1452 - Metroid - Zero Mission (EU) (M5).gba");
}
RawDataVisualizeFrame::RawDataVisualizeFrame(const wxString& title,PMProbeBatch *RawData, wxWindow *parent):wxFrame(parent,wxID_ANY,title,wxDefaultPosition, wxDefaultSize,wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS)
{

  wxMenu *fileMenu = new wxMenu;
  wxMenu *drawMenu = new wxMenu;
  wxMenuBar *menuBar = new wxMenuBar();
  
  wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );


  //  fileMenu->Append(ID_PRINT_PREVIEW_CURRENTPLOT,wxT("Print Preview"),wxT("Print Preview Current Plot"));
  fileMenu->Append(ID_SAVE_CURRENT,wxT("Save"),wxT("Save Current Plot"));
  fileMenu->Append(ID_POSTSCRIPT_CURRENTPLOT,wxT("Print"),wxT("Print Current plot")); 
  fileMenu->AppendSeparator();
  fileMenu->Append(wxID_EXIT,wxT("E&xit\tAlt-X"),wxT("Quit the program"));




  drawMenu->Append(ID_VISUALIZE_BOXPLOT,wxT("&Boxplots"),wxT("Boxplots of Raw PM data"));
  drawMenu->Append(ID_VISUALIZE_DENSITY,wxT("&Density Plots"),wxT("Density plots of Raw PM data"));
  drawMenu->Append(ID_VISUALIZE_DENSITY_INDIVIDUAL,wxT("&Individual Density Plots"),wxT("Density plots of Raw PM data for each array separately"));
  menuBar->Append(fileMenu,wxT("&File"));
  menuBar->Append(drawMenu,wxT("&Draw"));

  SetMenuBar(menuBar);

  CreateStatusBar(2);
 
  MyWindow = new RawDataVisualizeDrawingWindow(this); //wxWindow(this,-1);

  
  item0->Add( MyWindow, 1, wxEXPAND | wxGROW | wxALL , 5 );



  this->SetAutoLayout( TRUE );
  this->SetSizer( item0 );

  MyWindow->SetBackgroundColour(*wxWHITE );
  MyWindow->Refresh();

  MyRawData = RawData;

  BoxplotStatistics = NULL;
  DensityPlotStatistics_y = NULL;
  currentplot = 0;

  whichdensity=0;

  
  g_printData = new wxPrintData;
  g_pageSetupData = new wxPageSetupDialogData;


  frame = this;
#if _WIN32
  SetIcon(wxICON(expressicon));
#else
  SetIcon(wxICON(RMAExpress));
#endif
}
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
                 long style)
    : wxFrame((wxWindow *) NULL, wxID_ANY, title, pos, size, style)
{
#if wxUSE_NOTEBOOK
    m_type = ID_BOOK_NOTEBOOK;
#elif wxUSE_CHOICEBOOK
    m_type = ID_BOOK_CHOICEBOOK;
#elif wxUSE_LISTBOOK
    m_type = ID_BOOK_LISTBOOK;
#elif
#error "Don't use Notebook sample without any book enabled in wxWidgets build!"
#endif

    m_orient = ID_ORIENT_DEFAULT;
    m_chkShowImages = true;
    m_multi = false;

    SetIcon(wxICON(sample));

    // menu of the sample
    wxMenu *menuType = new wxMenu;
#if wxUSE_NOTEBOOK
    menuType->AppendRadioItem(ID_BOOK_NOTEBOOK,   wxT("&Notebook\tCtrl-1"));
#endif
#if wxUSE_LISTBOOK
    menuType->AppendRadioItem(ID_BOOK_LISTBOOK,   wxT("&Listbook\tCtrl-2"));
#endif
#if wxUSE_CHOICEBOOK
    menuType->AppendRadioItem(ID_BOOK_CHOICEBOOK, wxT("&Choicebook\tCtrl-3"));
#endif
    menuType->Check(m_type, true);

    wxMenu *menuOrient = new wxMenu;
    menuOrient->AppendRadioItem(ID_ORIENT_DEFAULT, wxT("&Default\tCtrl-4"));
    menuOrient->AppendRadioItem(ID_ORIENT_TOP,     wxT("&Top\tCtrl-5"));
    menuOrient->AppendRadioItem(ID_ORIENT_BOTTOM,  wxT("&Bottom\tCtrl-6"));
    menuOrient->AppendRadioItem(ID_ORIENT_LEFT,    wxT("&Left\tCtrl-7"));
    menuOrient->AppendRadioItem(ID_ORIENT_RIGHT,   wxT("&Right\tCtrl-8"));

    wxMenu *menuDo = new wxMenu;
    menuDo->Append(ID_ADD_PAGE, wxT("&Add page\tAlt-A"));
    menuDo->Append(ID_INSERT_PAGE, wxT("&Insert page\tAlt-I"));
    menuDo->Append(ID_DELETE_CUR_PAGE, wxT("&Delete current page\tAlt-D"));
    menuDo->Append(ID_DELETE_LAST_PAGE, wxT("D&elete last page\tAlt-L"));
    menuDo->Append(ID_NEXT_PAGE, wxT("&Next page\tAlt-N"));

    wxMenu *menuFile = new wxMenu;
    menuFile->Append(wxID_ANY, wxT("&Type"), menuType, wxT("Type of control"));
    menuFile->Append(wxID_ANY, wxT("&Orientation"), menuOrient, wxT("Orientation of control"));
    menuFile->AppendCheckItem(ID_SHOW_IMAGES, wxT("&Show images\tAlt-S"));
    menuFile->AppendCheckItem(ID_MULTI, wxT("&Multiple lines\tAlt-M"));
    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT, wxT("E&xit"), wxT("Quits the application"));
    menuFile->Check(ID_SHOW_IMAGES, m_chkShowImages);
    menuFile->Check(ID_MULTI, m_multi);

    wxMenuBar *menuBar = new wxMenuBar;
    menuBar->Append(menuFile, wxT("&File"));
    menuBar->Append(menuDo, wxT("&Operations"));
    SetMenuBar(menuBar);

    // books creation

    m_panel      = (wxPanel *)      NULL;
#if wxUSE_NOTEBOOK
    m_notebook   = (wxNotebook *)   NULL;
#endif
#if wxUSE_CHOICEBOOK
    m_choicebook = (wxChoicebook *) NULL;
#endif
#if wxUSE_LISTBOOK
    m_listbook   = (wxListbook *)   NULL;
#endif

    // create a dummy image list with a few icons
    wxSize imageSize(32, 32);

    m_imageList
        = new wxImageList( imageSize.GetWidth(), imageSize.GetHeight() );

    m_imageList->Add
    (
        wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, imageSize)
    );

    m_imageList->Add
    (
        wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, imageSize)
    );

    m_imageList->Add
    (
        wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, imageSize)
    );

    m_imageList->Add
    (
        wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, imageSize)
    );

    m_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
                          wxTAB_TRAVERSAL | wxCLIP_CHILDREN | wxNO_BORDER | wxNO_FULL_REPAINT_ON_RESIZE);

#if USE_LOG
    m_text = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
                            wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxTE_READONLY);

    m_logTargetOld = wxLog::SetActiveTarget( new wxLogTextCtrl(m_text) );
#endif // USE_LOG

    // Set sizers
    m_sizerFrame = new wxBoxSizer(wxVERTICAL);

#if USE_LOG
    m_sizerFrame->Add(m_text, 1, wxEXPAND);
#endif // USE_LOG

    RecreateBooks();

    m_panel->SetSizer(m_sizerFrame);

    m_sizerFrame->Fit(this);
    m_sizerFrame->SetSizeHints(this);

    Centre(wxBOTH);
}
// Define my frame constructor
MyFrame::MyFrame(wxFrame *frame, const wxString& title)
        : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300))
{
    // Give it an icon
    SetIcon(wxICON(sample));

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(wxID_EXIT, wxT("&Quit\tCtrl-Q"));

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu, wxT("&File"));

    // Associate the menu bar with the frame
    SetMenuBar(menu_bar);

    // set a dialog background
    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));

    // add the controls to the frame
    wxString strs4[] =
    {
        IPC_SERVICE, wxT("...")
    };
    wxString strs5[] =
    {
        IPC_HOST, wxT("...")
    };
    wxString strs6[] =
    {
        IPC_TOPIC, wxT("...")
    };

    wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL );

    wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL );

    wxGridSizer *item2 = new wxGridSizer( 4, 0, 0 );

    wxButton *item3 = new wxButton( this, ID_START, wxT("Connect to server"), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    wxChoice *item5 = new wxChoice( this, ID_HOSTNAME, wxDefaultPosition, wxSize(100,-1), 2, strs5, 0 );
    item2->Add( item5, 0, wxALIGN_CENTER|wxALL, 5 );

    wxChoice *item4 = new wxChoice( this, ID_SERVERNAME, wxDefaultPosition, wxSize(100,-1), 2, strs4, 0 );
    item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    wxChoice *item6 = new wxChoice( this, ID_TOPIC, wxDefaultPosition, wxSize(100,-1), 2, strs6, 0 );
    item2->Add( item6, 0, wxALIGN_CENTER|wxALL, 5 );

    wxButton *item7 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect "), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    wxButton *item8 = new wxButton( this, ID_STARTADVISE, wxT("StartAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item8, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    wxButton *item9 = new wxButton( this, ID_STOPADVISE, wxT("StopAdvise"), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item9, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    wxButton *item10 = new wxButton( this, ID_EXECUTE, wxT("Execute"), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item10, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    wxButton *item11 = new wxButton( this, ID_POKE, wxT("Poke"), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item11, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    wxButton *item12 = new wxButton( this, ID_REQUEST, wxT("Request"), wxDefaultPosition, wxDefaultSize, 0 );
    item2->Add( item12, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 );

    item1->Add( item2, 1, wxALIGN_CENTER|wxALL, 5 );

    item0->Add( item1, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    wxStaticBox *item14 = new wxStaticBox( this, -1, wxT("Client log") );
    wxStaticBoxSizer *item13 = new wxStaticBoxSizer( item14, wxVERTICAL );

    wxTextCtrl *item15 = new wxTextCtrl( this, ID_LOG, wxEmptyString, wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE );
    item13->Add( item15, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    item0->Add( item13, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    this->SetSizer( item0 );
    item0->SetSizeHints( this );

    // status
    m_client = NULL;
    GetServername()->SetSelection(0);
    GetHostname()->SetSelection(0);
    GetTopic()->SetSelection(0);
    wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog());
    delete wxLog::SetActiveTarget(logWindow);
    wxLogMessage(wxT("Click on Connect to connect to the server"));
    EnableControls();
}
Beispiel #17
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    ::wxInitAllImageHandlers();

    // Fill in the application information fields before creating wxConfig.
    SetVendorName("wxWidgets");
    SetAppName("wx_docview_sample");
    SetAppDisplayName("wxWidgets DocView Sample");

    //// Create a document manager
    wxDocManager *docManager = new wxDocManager;

    //// Create a template relating drawing documents to their views
    new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw",
                      "Drawing Doc", "Drawing View",
                      CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));

    if ( m_mode == Mode_Single )
    {
        // If we've only got one window, we only get to edit one document at a
        // time. Therefore no text editing, just doodling.
        docManager->SetMaxDocsOpen(1);
    }
    else // multiple documents mode: allow documents of different types
    {
        // Create a template relating text documents to their views
        new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text",
                          "Text Doc", "Text View",
                          CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
        // Create a template relating image documents to their views
        new wxDocTemplate(docManager, "Image", "*.png;*.jpg", "", "png;jpg",
                          "Image Doc", "Image View",
                          CLASSINFO(ImageDocument), CLASSINFO(ImageView));
    }

    // create the main frame window
    wxFrame *frame;
#if wxUSE_MDI_ARCHITECTURE
    if ( m_mode == Mode_MDI )
    {
        frame = new wxDocMDIParentFrame(docManager, NULL, wxID_ANY,
                                        GetAppDisplayName(),
                                        wxDefaultPosition,
                                        wxSize(500, 400));
    }
    else
#endif // wxUSE_MDI_ARCHITECTURE
    {
        frame = new wxDocParentFrame(docManager, NULL, wxID_ANY,
                                     GetAppDisplayName(),
                                     wxDefaultPosition,
                                     wxSize(500, 400));
    }

    // and its menu bar
    wxMenu *menuFile = new wxMenu;

    menuFile->Append(wxID_NEW);
    menuFile->Append(wxID_OPEN);

    if ( m_mode == Mode_Single )
        AppendDocumentFileCommands(menuFile, true);

    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT);

    // A nice touch: a history of files visited. Use this menu.
    docManager->FileHistoryUseMenu(menuFile);
#if wxUSE_CONFIG
    docManager->FileHistoryLoad(*wxConfig::Get());
#endif // wxUSE_CONFIG


    if ( m_mode == Mode_Single )
    {
        m_canvas = new MyCanvas(NULL, frame);
        m_menuEdit = CreateDrawingEditMenu();
    }

    CreateMenuBarForFrame(frame, menuFile, m_menuEdit);

    frame->SetIcon(wxICON(doc));
    frame->Centre();
    frame->Show();

    if ( m_filesFromCmdLine.empty() )
    {
        docManager->CreateNewDocument();
    }
    else // we have files to open on command line
    {
        for ( size_t i = 0; i != m_filesFromCmdLine.size(); ++i )
            docManager->CreateDocument(m_filesFromCmdLine[i], wxDOC_SILENT);
    }

    return true;
}
Beispiel #18
0
FrameMain::FrameMain()
: wxFrame(nullptr, -1, "", wxDefaultPosition, wxSize(920,700), wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN)
, context(agi::util::make_unique<agi::Context>())
{
	StartupLog("Entering FrameMain constructor");

#ifdef __WXGTK__
	// XXX HACK XXX
	// We need to set LC_ALL to "" here for input methods to work reliably.
	setlocale(LC_ALL, "");

	// However LC_NUMERIC must be "C", otherwise some parsing fails.
	setlocale(LC_NUMERIC, "C");
#endif
#ifdef __APPLE__
	// When run from an app bundle, LC_CTYPE defaults to "C", which breaks on
	// anything involving unicode and in some cases number formatting.
	// The right thing to do here would be to query CoreFoundation for the user's
	// locale and add .UTF-8 to that, but :effort:
	LOG_D("locale") << setlocale(LC_ALL, nullptr);
	setlocale(LC_CTYPE, "en_US.UTF-8");
	LOG_D("locale") << setlocale(LC_ALL, nullptr);
#endif

	StartupLog("Initializing context models");
	memset(context.get(), 0, sizeof(*context));
	context->ass = new AssFile;

	StartupLog("Initializing context controls");
	context->subsController = new SubsController(context.get());
	context->ass->AddCommitListener(&FrameMain::UpdateTitle, this);
	context->subsController->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this);
	context->subsController->AddFileSaveListener(&FrameMain::UpdateTitle, this);

	context->audioController = new AudioController(context.get());
	context->audioController->AddAudioOpenListener(&FrameMain::OnAudioOpen, this);
	context->audioController->AddAudioCloseListener(&FrameMain::OnAudioClose, this);

	context->local_scripts = new Automation4::LocalScriptManager(context.get());

	// Initialized later due to that the selection controller is currently the subtitles grid
	context->selectionController = nullptr;

	context->videoController = VideoContext::Get(); // derp
	context->videoController->AddVideoOpenListener(&FrameMain::OnVideoOpen, this);

	StartupLog("Initializing context frames");
	context->parent = this;
	context->previousFocus = nullptr;

	StartupLog("Install PNG handler");
	wxImage::AddHandler(new wxPNGHandler);
#ifndef __APPLE__
	wxSafeYield();
#endif

	StartupLog("Apply saved Maximized state");
	if (OPT_GET("App/Maximized")->GetBool()) Maximize(true);

	StartupLog("Initialize toolbar");
	InitToolbar();

	StartupLog("Initialize menu bar");
	menu::GetMenuBar("main", this, context.get());

	StartupLog("Create status bar");
	CreateStatusBar(2);

	StartupLog("Set icon");
#ifdef _WIN32
	SetIcon(wxICON(wxicon));
#else
	wxIcon icon;
	icon.CopyFromBitmap(GETIMAGE(wxicon));
	SetIcon(icon);
#endif

	StartupLog("Create views and inner main window controls");
	context->dialog = new DialogManager;
	InitContents();
	OPT_SUB("Video/Detached/Enabled", &FrameMain::OnVideoDetach, this, agi::signal::_1);

	StartupLog("Complete context initialization");
	context->videoController->SetContext(context.get());

	StartupLog("Set up drag/drop target");
	SetDropTarget(new AegisubFileDropTarget(this));

	StartupLog("Load default file");
	context->subsController->Close();

	StartupLog("Display main window");
	AddFullScreenButton(this);
	Show();
	SetDisplayMode(1, 1);

	// Version checker
	StartupLog("Possibly perform automatic updates check");
	if (OPT_GET("App/First Start")->GetBool()) {
		OPT_SET("App/First Start")->SetBool(false);
#ifdef WITH_UPDATE_CHECKER
		int result = wxMessageBox(_("Do you want Aegisub to check for updates whenever it starts? You can still do it manually via the Help menu."),_("Check for updates?"), wxYES_NO | wxCENTER);
		OPT_SET("App/Auto/Check For Updates")->SetBool(result == wxYES);
		config::opt->Flush();
#endif
	}

#ifdef WITH_UPDATE_CHECKER
	PerformVersionCheck(false);
#endif

	Bind(FILE_LIST_DROPPED, &FrameMain::OnFilesDropped, this);

	StartupLog("Leaving FrameMain constructor");
}
Beispiel #19
0
// Define my frame constructor
MyFrame::MyFrame(wxWindow *parent,
                 const wxWindowID id,
                 const wxString& title,
                 const wxPoint& pos,
                 const wxSize& size,
                 const long style)
       : wxFrame(parent, id, title, pos, size,
                          style | wxNO_FULL_REPAINT_ON_RESIZE)
{
    SetIcon(wxICON(sample));

    // Make a menubar
    wxMenu *file_menu = new wxMenu;

#if wxUSE_FILEDLG
    file_menu->Append(wxID_OPEN, wxT("&Open Animation...\tCtrl+O"), wxT("Loads an animation"));
#endif // wxUSE_FILEDLG
    file_menu->Append(wxID_EXIT);

    wxMenu *play_menu = new wxMenu;
    play_menu->Append(ID_PLAY, wxT("Play\tCtrl+P"), wxT("Play the animation"));
    play_menu->Append(wxID_STOP, wxT("Stop\tCtrl+S"), wxT("Stop the animation"));
    play_menu->AppendSeparator();
    play_menu->Append(ID_SET_NULL_ANIMATION, wxT("Set null animation"),
                      wxT("Sets the empty animation in the control"));
    play_menu->AppendCheckItem(ID_SET_INACTIVE_BITMAP, wxT("Set inactive bitmap"),
                               wxT("Sets an inactive bitmap for the control"));
    play_menu->AppendCheckItem(ID_SET_NO_AUTO_RESIZE, wxT("Set no autoresize"),
                               wxT("Tells the control not to resize automatically"));
    play_menu->Append(ID_SET_BGCOLOR, wxT("Set background colour..."),
                      wxT("Sets the background colour of the control"));

    wxMenu *help_menu = new wxMenu;
    help_menu->Append(wxID_ABOUT);

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu, wxT("&File"));
    menu_bar->Append(play_menu, wxT("&Animation"));
    menu_bar->Append(help_menu, wxT("&Help"));

    // Associate the menu bar with this frame
    SetMenuBar(menu_bar);

#if wxUSE_STATUSBAR
    CreateStatusBar();
#endif // wxUSE_STATUSBAR

    // use a wxBoxSizer otherwise wxFrame will automatically
    // resize the m_animationCtrl to fill its client area on
    // user resizes
    wxSizer *sz = new wxBoxSizer(wxVERTICAL);
    sz->Add(new wxStaticText(this, wxID_ANY, wxT("wxAnimationCtrl:")),
            wxSizerFlags().Centre().Border());

    m_animationCtrl = new wxAnimationCtrl(this, wxID_ANY);
    if (m_animationCtrl->LoadFile(wxT("throbber.gif")))
        m_animationCtrl->Play();

    sz->Add(m_animationCtrl, wxSizerFlags().Centre().Border());
    SetSizer(sz);
}
Beispiel #20
0
bool EkstrApp::OnInit()
{
	//  READ PARAMS FROM CMD LINE
#if wxUSE_UNICODE
	libpar_read_cmdline_w(&argc, argv);
#else
	libpar_read_cmdline(&argc, argv);
#endif
	if (!szApp<>::OnInit())
		return false;

#if BOOST_FILESYSTEM_VERSION == 3
	boost::filesystem::wpath::imbue(std::locale("C")); 	
#else
	boost::filesystem::wpath_traits::imbue(std::locale("C")); 	
#endif

	SetProgName(_("Ekstraktor 3"));

	// SET LOCALE
	wxArrayString catalogs;
	catalogs.Add(_T("ekstraktor3"));
	catalogs.Add(_T("common"));
	catalogs.Add(_T("wx"));
	InitializeLocale(catalogs, locale);

	// GET LIBPAR STUFF
#ifndef MINGW32
	libpar_init();
#else
	wxString config_str =
	    GetSzarpDir() + wxFileName::GetPathSeparator() + _T("resources") +
	    wxFileName::GetPathSeparator() + _T("szarp.cfg");
	libpar_init_with_filename(SC::S2A(config_str).c_str(), 1);
#endif
	std::wstring ipk_prefix;
	char *_ipk_prefix = libpar_getpar("", "config_prefix", 0);
	if (_ipk_prefix) {
		ipk_prefix = SC::L2S(_ipk_prefix);
		free(_ipk_prefix);
	}
	std::map<wxString, std::pair<wxString, wxString> > m_probers_addresses;
#ifndef MINGW32
	m_probers_addresses = get_probers_addresses();
#endif
	szFrame::setDefaultIcon(wxICON(extr64));

	if (!base.IsEmpty()) {
		ipk_prefix = base.c_str();
	} else {
		if (ipk_prefix.empty()) {
			wxArrayString hidden_databases;
			wxString tmp;
			wxConfigBase *config = wxConfigBase::Get(true);
			if (config->Read(_T("HIDDEN_DATABASES"), &tmp)) {
				wxStringTokenizer tkz(tmp, _T(","), wxTOKEN_STRTOK);
				while (tkz.HasMoreTokens()) {
					wxString token = tkz.GetNextToken();
					token.Trim();
					if (!token.IsEmpty())
						hidden_databases.Add(token);
				}
			}
			if (ConfigDialog::SelectDatabase(base, &hidden_databases)) {
				ipk_prefix = base;
			} else
				return false;
		}
	}

	libpar_done();

#ifdef MINGW32
	WORD wVersionRequested = MAKEWORD(2, 2);
	WSADATA wsaData;
	WSAStartup(wVersionRequested, &wsaData);
#endif

	xmlInitParser();
	LIBXML_TEST_VERSION xmlSubstituteEntitiesDefault(1);

	// .. AND START THE MAIN WIDGET
	std::pair<wxString, wxString> prober_address;
	if (m_probers_addresses.find(ipk_prefix) != m_probers_addresses.end())
		prober_address = m_probers_addresses[ipk_prefix];
	EkstraktorWidget *ew = new EkstraktorWidget(ipk_prefix, geometry.IsEmpty() ? NULL : &geometry, prober_address, sz4);

	if (ew->IsConfigLoaded() == false) {
		delete ew;
		exit(1);
	}
	return true;

} // onInit()
Beispiel #21
0
// frame constructor
LifeFrame::LifeFrame() :
  wxFrame( (wxFrame *) NULL, wxID_ANY, _("Life!"), wxDefaultPosition ),
  m_navigator(NULL)
{
    // frame icon
    SetIcon(wxICON(mondrian));

    // menu bar
    wxMenu *menuFile = new wxMenu(wxMENU_TEAROFF);
    wxMenu *menuView = new wxMenu(wxMENU_TEAROFF);
    wxMenu *menuGame = new wxMenu(wxMENU_TEAROFF);
    wxMenu *menuHelp = new wxMenu(wxMENU_TEAROFF);

    menuFile->Append(wxID_NEW, wxGetStockLabel(wxID_NEW), _("Start a new game"));
#if wxUSE_FILEDLG
    menuFile->Append(wxID_OPEN, wxGetStockLabel(wxID_OPEN), _("Open an existing Life pattern"));
#endif
    menuFile->Append(ID_SAMPLES, _("&Sample game..."), _("Select a sample configuration"));
#if ! (defined(__SMARTPHONE__) || defined(__POCKETPC__))
    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT, wxGetStockLabel(wxID_EXIT, true, _T("Alt-X")), _("Quit this program"));

    menuView->Append(ID_SHOWNAV, _("Navigation &toolbox"), _("Show or hide toolbox"), wxITEM_CHECK);
    menuView->Check(ID_SHOWNAV, true);
    menuView->AppendSeparator();
#endif

    menuView->Append(ID_ORIGIN, _("&Absolute origin"), _("Go to (0, 0)"));
    menuView->Append(ID_CENTER, _("&Center of mass"), _("Find center of mass"));
    menuView->Append(ID_NORTH, _("&North"), _("Find northernmost cell"));
    menuView->Append(ID_SOUTH, _("&South"), _("Find southernmost cell"));
    menuView->Append(ID_EAST, _("&East"), _("Find easternmost cell"));
    menuView->Append(ID_WEST, _("&West"), _("Find westernmost cell"));
    menuView->AppendSeparator();
    menuView->Append(wxID_ZOOM_IN, wxGetStockLabel(wxID_ZOOM_IN, true, _T("Ctrl-I")), _("Zoom in"));
    menuView->Append(wxID_ZOOM_OUT, wxGetStockLabel(wxID_ZOOM_OUT, true, _T("Ctrl-O")), _("Zoom out"));
    menuView->Append(ID_INFO, _("&Description\tCtrl-D"), _("View pattern description"));

    menuGame->Append(ID_START, _("&Start\tCtrl-S"), _("Start"));
    menuGame->Append(ID_STEP, _("&Next\tCtrl-N"), _("Single step"));
    menuGame->Append(wxID_STOP, wxGetStockLabel(wxID_STOP, true, _T("Ctrl-T")), _("Stop"));
    menuGame->Enable(wxID_STOP, false);
    menuGame->AppendSeparator();
    menuGame->Append(ID_TOPSPEED, _("T&op speed!"), _("Go as fast as possible"));

    menuHelp->Append(wxID_ABOUT, _("&About\tCtrl-A"), _("Show about dialog"));

    wxMenuBar *menuBar = new wxMenuBar();
    menuBar->Append(menuFile, _("&File"));
    menuBar->Append(menuView, _("&View"));
    menuBar->Append(menuGame, _("&Game"));
    menuBar->Append(menuHelp, _("&Help"));
    SetMenuBar(menuBar);

    // tool bar
    wxBitmap tbBitmaps[7];

    tbBitmaps[0] = wxBITMAP(reset);
    tbBitmaps[1] = wxBITMAP(open);
    tbBitmaps[2] = wxBITMAP(zoomin);
    tbBitmaps[3] = wxBITMAP(zoomout);
    tbBitmaps[4] = wxBITMAP(info);
    tbBitmaps[5] = wxBITMAP(play);
    tbBitmaps[6] = wxBITMAP(stop);

    wxToolBar *toolBar = CreateToolBar();
    toolBar->SetMargins(5, 5);
    toolBar->SetToolBitmapSize(wxSize(16, 16));

    ADD_TOOL(wxID_NEW, tbBitmaps[0], wxGetStockLabel(wxID_NEW, false), _("Start a new game"));
#ifndef __POCKETPC__
#if wxUSE_FILEDLG
    ADD_TOOL(wxID_OPEN, tbBitmaps[1], wxGetStockLabel(wxID_OPEN, false), _("Open an existing Life pattern"));
#endif // wxUSE_FILEDLG

    toolBar->AddSeparator();
    ADD_TOOL(wxID_ZOOM_IN, tbBitmaps[2], wxGetStockLabel(wxID_ZOOM_IN, false), _("Zoom in"));
    ADD_TOOL(wxID_ZOOM_OUT, tbBitmaps[3], wxGetStockLabel(wxID_ZOOM_OUT, false), _("Zoom out"));
    ADD_TOOL(ID_INFO, tbBitmaps[4], _("Description"), _("Show description"));
    toolBar->AddSeparator();
#endif // __POCKETPC__
    ADD_TOOL(ID_START, tbBitmaps[5], _("Start"), _("Start"));
    ADD_TOOL(wxID_STOP, tbBitmaps[6], wxGetStockLabel(wxID_STOP, false), _("Stop"));

    toolBar->Realize();
    toolBar->EnableTool(wxID_STOP, false);    // must be after Realize() !

#if wxUSE_STATUSBAR
    // status bar
    CreateStatusBar(2);
    SetStatusText(_("Welcome to Life!"));
#endif // wxUSE_STATUSBAR

    // game and timer
    m_life     = new Life();
    m_timer    = new wxTimer(this, ID_TIMER);
    m_running  = false;
    m_topspeed = false;
    m_interval = 500;
    m_tics     = 0;

    // We use two different panels to reduce flicker in wxGTK, because
    // some widgets (like wxStaticText) don't have their own X11 window,
    // and thus updating the text would result in a refresh of the canvas
    // if they belong to the same parent.

    wxPanel *panel1 = new wxPanel(this, wxID_ANY);
    wxPanel *panel2 = new wxPanel(this, wxID_ANY);

    // canvas
    m_canvas = new LifeCanvas(panel1, m_life);

    // info panel
    m_text = new wxStaticText(panel2, wxID_ANY,
        wxEmptyString,
        wxDefaultPosition,
        wxDefaultSize,
        wxALIGN_CENTER | wxST_NO_AUTORESIZE);

    wxSlider *slider = new wxSlider(panel2, ID_SLIDER,
        5, 1, 10,
        wxDefaultPosition,
        wxSize(200, wxDefaultCoord),
        wxSL_HORIZONTAL | wxSL_AUTOTICKS);

    UpdateInfoText();

    // component layout
    wxBoxSizer *sizer1 = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *sizer2 = new wxBoxSizer(wxVERTICAL);
    wxBoxSizer *sizer3 = new wxBoxSizer(wxVERTICAL);

#if wxUSE_STATLINE
    sizer1->Add( new wxStaticLine(panel1, wxID_ANY), 0, wxGROW );
#endif // wxUSE_STATLINE
    sizer1->Add( m_canvas, 1, wxGROW | wxALL, 2 );
#if wxUSE_STATLINE
    sizer1->Add( new wxStaticLine(panel1, wxID_ANY), 0, wxGROW );
#endif // wxUSE_STATLINE
    panel1->SetSizer( sizer1 );
    sizer1->Fit( panel1 );

    sizer2->Add( m_text, 0, wxGROW | wxTOP, 4 );
    sizer2->Add( slider, 0, wxCENTRE | wxALL, 4 );

    panel2->SetSizer( sizer2 );
    sizer2->Fit( panel2 );

    sizer3->Add( panel1, 1, wxGROW );
    sizer3->Add( panel2, 0, wxGROW );
    SetSizer( sizer3 );

#ifndef __WXWINCE__
    sizer3->Fit( this );

    // set minimum frame size
    sizer3->SetSizeHints( this );

    // navigator frame - not appropriate for small devices
    m_navigator = new LifeNavigator(this);
#endif

}
Beispiel #22
0
bool MyApp::OnInit()
{
    if ( !wxApp::OnInit() )
        return false;

    SetAppName("DocView Sample");

    //// Create a document manager
    wxDocManager *docManager = new wxDocManager;

    //// Create a template relating drawing documents to their views
    new wxDocTemplate(docManager, "Drawing", "*.drw", "", "drw",
                      "Drawing Doc", "Drawing View",
                      CLASSINFO(DrawingDocument), CLASSINFO(DrawingView));
#if defined( __WXMAC__ )  && wxOSX_USE_CARBON
    wxFileName::MacRegisterDefaultTypeAndCreator("drw" , 'WXMB' , 'WXMA');
#endif

    if ( m_mode == Mode_Single )
    {
        // If we've only got one window, we only get to edit one document at a
        // time. Therefore no text editing, just doodling.
        docManager->SetMaxDocsOpen(1);
    }
    else // multiple documents mode: allow documents of different types
    {
        // Create a template relating text documents to their views
        new wxDocTemplate(docManager, "Text", "*.txt;*.text", "", "txt;text",
                          "Text Doc", "Text View",
                          CLASSINFO(TextEditDocument), CLASSINFO(TextEditView));
#if defined( __WXMAC__ ) && wxOSX_USE_CARBON
        wxFileName::MacRegisterDefaultTypeAndCreator("txt" , 'TEXT' , 'WXMA');
#endif
    }

    // create the main frame window
    wxFrame *frame;
#if wxUSE_MDI_ARCHITECTURE
    if ( m_mode == Mode_MDI )
    {
        frame = new wxDocMDIParentFrame(docManager, NULL, wxID_ANY,
                                        GetAppDisplayName(),
                                        wxDefaultPosition,
                                        wxSize(500, 400));
    }
    else
#endif // wxUSE_MDI_ARCHITECTURE
    {
        frame = new wxDocParentFrame(docManager, NULL, wxID_ANY,
                                     GetAppDisplayName(),
                                     wxDefaultPosition,
                                     wxSize(500, 400));
    }

    // and its menu bar
    wxMenu *menuFile = new wxMenu;

    menuFile->Append(wxID_NEW);
    menuFile->Append(wxID_OPEN);

    if ( m_mode == Mode_Single )
        AppendDocumentFileCommands(menuFile, true);

    menuFile->AppendSeparator();
    menuFile->Append(wxID_EXIT);

    // A nice touch: a history of files visited. Use this menu.
    docManager->FileHistoryUseMenu(menuFile);

    if ( m_mode == Mode_Single )
    {
        m_canvas = new MyCanvas(NULL, frame);
        m_menuEdit = CreateDrawingEditMenu();
    }

    CreateMenuBarForFrame(frame, menuFile, m_menuEdit);

    frame->SetIcon(wxICON(doc));
    frame->Centre(wxBOTH);
    frame->Show(true);

    SetTopWindow(frame);
    return true;
}
Beispiel #23
0
MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int h):
  wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h))
{
    m_log = NULL;
    m_col = NULL;

    m_ctrl[0] = NULL;
    m_ctrl[1] = NULL;
    m_ctrl[2] = NULL;
    m_ctrl[3] = NULL;

    SetIcon(wxICON(sample));


    // build the menus
    // ----------------

    wxMenu *style_menu = new wxMenu;
    //style_menu->AppendCheckItem(ID_SINGLE, "Single selection"));
    style_menu->AppendCheckItem(ID_MULTIPLE, "Multiple selection");
    style_menu->AppendCheckItem(ID_ROW_LINES, "Alternating colours");
    style_menu->AppendCheckItem(ID_HORIZ_RULES, "Display horizontal rules");
    style_menu->AppendCheckItem(ID_VERT_RULES, "Display vertical rules");

    wxMenu *file_menu = new wxMenu;
    file_menu->Append(ID_CLEARLOG, "&Clear log\tCtrl-L");
    file_menu->Append(ID_FOREGROUND_COLOUR, "Set &foreground colour...\tCtrl-S");
    file_menu->Append(ID_BACKGROUND_COLOUR, "Set &background colour...\tCtrl-B");
    file_menu->Append(ID_STYLE_MENU, "&Style", style_menu);
    file_menu->AppendSeparator();
    file_menu->Append(ID_EXIT, "E&xit");

    wxMenu *about_menu = new wxMenu;
    about_menu->Append(ID_ABOUT, "&About");

    wxMenuBar *menu_bar = new wxMenuBar;
    menu_bar->Append(file_menu, "&File");
    menu_bar->Append(about_menu, "&About");

    SetMenuBar(menu_bar);
    CreateStatusBar();


    // redirect logs from our event handlers to text control
    m_log = new wxTextCtrl( this, wxID_ANY, wxString(), wxDefaultPosition,
                            wxDefaultSize, wxTE_MULTILINE );
    m_log->SetMinSize(wxSize(-1, 100));
    m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_log));
    wxLogMessage( "This is the log window" );


    // first page of the notebook
    // --------------------------

    m_notebook = new wxNotebook( this, wxID_ANY );

    wxPanel *firstPanel = new wxPanel( m_notebook, wxID_ANY );

    BuildDataViewCtrl(firstPanel, 0);    // sets m_ctrl[0]

    const wxSizerFlags border = wxSizerFlags().DoubleBorder();

    wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
    button_sizer->Add( new wxButton( firstPanel, ID_ADD_MOZART,  "Add Mozart"),             border );
    button_sizer->Add( new wxButton( firstPanel, ID_DELETE_SEL,  "Delete selected"),        border );
    button_sizer->Add( new wxButton( firstPanel, ID_DELETE_YEAR, "Delete \"Year\" column"), border );
    button_sizer->Add( new wxButton( firstPanel, ID_SELECT_NINTH,"Select ninth symphony"),  border );
    button_sizer->Add( new wxButton( firstPanel, ID_COLLAPSE,    "Collapse"),               border );
    button_sizer->Add( new wxButton( firstPanel, ID_EXPAND,      "Expand"),                 border );

    wxBoxSizer *sizerCurrent = new wxBoxSizer(wxHORIZONTAL);
    sizerCurrent->Add(new wxButton(firstPanel, ID_SHOW_CURRENT,
                                   "&Show current"), border);
    sizerCurrent->Add(new wxButton(firstPanel, ID_SET_NINTH_CURRENT,
                                   "Make &ninth symphony current"), border);

    wxSizer *firstPanelSz = new wxBoxSizer( wxVERTICAL );
    m_ctrl[0]->SetMinSize(wxSize(-1, 200));
    firstPanelSz->Add(m_ctrl[0], 1, wxGROW|wxALL, 5);
    firstPanelSz->Add(
        new wxStaticText(firstPanel, wxID_ANY, "Most of the cells above are editable!"),
        0, wxGROW|wxALL, 5);
    firstPanelSz->Add(button_sizer);
    firstPanelSz->Add(sizerCurrent);
    firstPanel->SetSizerAndFit(firstPanelSz);


    // second page of the notebook
    // ---------------------------

    wxPanel *secondPanel = new wxPanel( m_notebook, wxID_ANY );

    BuildDataViewCtrl(secondPanel, 1);    // sets m_ctrl[1]

    wxBoxSizer *button_sizer2 = new wxBoxSizer( wxHORIZONTAL );
    button_sizer2->Add( new wxButton( secondPanel, ID_PREPEND_LIST,"Prepend"),                0, wxALL, 10 );
    button_sizer2->Add( new wxButton( secondPanel, ID_DELETE_LIST, "Delete selected"),        0, wxALL, 10 );
    button_sizer2->Add( new wxButton( secondPanel, ID_GOTO,        "Goto 50"),                0, wxALL, 10 );
    button_sizer2->Add( new wxButton( secondPanel, ID_ADD_MANY,    "Add 1000"),               0, wxALL, 10 );
    button_sizer2->Add( new wxButton( secondPanel, ID_HIDE_ATTRIBUTES,    "Hide attributes"), 0, wxALL, 10 );
    button_sizer2->Add( new wxButton( secondPanel, ID_SHOW_ATTRIBUTES,    "Show attributes"), 0, wxALL, 10 );

    wxSizer *secondPanelSz = new wxBoxSizer( wxVERTICAL );
    secondPanelSz->Add(m_ctrl[1], 1, wxGROW|wxALL, 5);
    secondPanelSz->Add(button_sizer2);
    secondPanel->SetSizerAndFit(secondPanelSz);


    // third page of the notebook
    // ---------------------------

    wxPanel *thirdPanel = new wxPanel( m_notebook, wxID_ANY );

    BuildDataViewCtrl(thirdPanel, 2);    // sets m_ctrl[2]

    wxSizer *thirdPanelSz = new wxBoxSizer( wxVERTICAL );
    thirdPanelSz->Add(m_ctrl[2], 1, wxGROW|wxALL, 5);
    thirdPanel->SetSizerAndFit(thirdPanelSz);


    // fourth page of the notebook
    // ---------------------------

    wxPanel *fourthPanel = new wxPanel( m_notebook, wxID_ANY );

    BuildDataViewCtrl(fourthPanel, 3);    // sets m_ctrl[3]
    // Buttons
    wxBoxSizer *button_sizer4 = new wxBoxSizer( wxHORIZONTAL );
    button_sizer4->Add( new wxButton( fourthPanel, ID_DELETE_TREE_ITEM, "Delete Selected"), 0, wxALL, 10 );
    button_sizer4->Add( new wxButton( fourthPanel, ID_DELETE_ALL_TREE_ITEMS, "Delete All"), 0, wxALL, 10 );
    button_sizer4->Add( new wxButton( fourthPanel, ID_ADD_TREE_ITEM, "Add Item"), 0, wxALL, 10 );
    button_sizer4->Add( new wxButton( fourthPanel, ID_ADD_TREE_CONTAINER_ITEM, "Add Container"), 0, wxALL, 10 );

    wxSizer *fourthPanelSz = new wxBoxSizer( wxVERTICAL );
    fourthPanelSz->Add(m_ctrl[3], 1, wxGROW|wxALL, 5);
    fourthPanelSz->Add(button_sizer4);
    fourthPanel->SetSizerAndFit(fourthPanelSz);



    // complete GUI
    // ------------

    m_notebook->AddPage(firstPanel, "MyMusicTreeModel");
    m_notebook->AddPage(secondPanel, "MyListModel");
    m_notebook->AddPage(thirdPanel, "wxDataViewListCtrl");
    m_notebook->AddPage(fourthPanel, "wxDataViewTreeCtrl");

    wxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);

    mainSizer->Add( m_notebook, 1, wxGROW );
    mainSizer->Add( m_log, 0, wxGROW );

    SetSizerAndFit(mainSizer);
}
Beispiel #24
0
// frame constructor
MyFrame::MyFrame(const wxString& title)
       : wxFrame(NULL, wxID_ANY, title)
{
    wxBoxSizer* topSizer;
    wxBoxSizer* topRowSizer;
    wxBoxSizer* colSizer;
    wxBoxSizer* rowSizer;

    // set the frame icon
    SetIcon(wxICON(sample));

#if wxUSE_MENUS
    // create a menu bar
    wxMenu *fileMenu = new wxMenu;

    // the "About" item should be in the help menu
    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(ComboCtrl_About, wxT("&About\tF1"), wxT("Show about dialog"));

    fileMenu->Append(ComboCtrl_Compare, wxT("&Compare against wxComboBox..."),
        wxT("Show some wxOwnerDrawnComboBoxes side-by-side with native wxComboBoxes."));
    fileMenu->AppendSeparator();
    fileMenu->Append(ComboCtrl_Quit, wxT("E&xit\tAlt-X"), wxT("Quit this program"));

    // now append the freshly created menu to the menu bar...
    wxMenuBar *menuBar = new wxMenuBar();
    menuBar->Append(fileMenu, wxT("&File"));
    menuBar->Append(helpMenu, wxT("&Help"));

    // ... and attach this menu bar to the frame
    SetMenuBar(menuBar);
#endif // wxUSE_MENUS

    wxPanel* panel = new wxPanel(this);

    // Prepare log window right away since it shows EVT_TEXTs
    m_logWin = new wxTextCtrl(panel, 105, wxEmptyString,
                              wxDefaultPosition,
                              wxSize(-1, 125),
                              wxTE_MULTILINE);
    wxLogTextCtrl* logger = new wxLogTextCtrl(m_logWin);
    m_logOld = logger->SetActiveTarget(logger);
    logger->DisableTimestamp();


    topSizer = new wxBoxSizer( wxVERTICAL );

    topRowSizer = new wxBoxSizer( wxHORIZONTAL );

    colSizer = new wxBoxSizer( wxVERTICAL );


    wxComboCtrl* cc;
    wxGenericComboCtrl* gcc;
    wxOwnerDrawnComboBox* odc;

    // Create common strings array
    m_arrItems.Add( wxT("Solid") );
    m_arrItems.Add( wxT("Transparent") );
    m_arrItems.Add( wxT("Dot") );
    m_arrItems.Add( wxT("Long Dash") );
    m_arrItems.Add( wxT("Short Dash") );
    m_arrItems.Add( wxT("Dot Dash") );
    m_arrItems.Add( wxT("Backward Diagonal Hatch") );
    m_arrItems.Add( wxT("Cross-diagonal Hatch") );
    m_arrItems.Add( wxT("Forward Diagonal Hatch") );
    m_arrItems.Add( wxT("Cross Hatch") );
    m_arrItems.Add( wxT("Horizontal Hatch") );
    m_arrItems.Add( wxT("Vertical Hatch") );


    //
    // Create pen selector ODComboBox with owner-drawn items
    //
    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    rowSizer->Add( new wxStaticText(panel,wxID_ANY,
                   wxT("OwnerDrawnComboBox with owner-drawn items:")), 1,
                   wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );

    rowSizer = new wxBoxSizer( wxHORIZONTAL );


    // When defining derivative class for callbacks, we need
    // to use two-stage creation (or redefine the common wx
    // constructor).
    odc = new wxPenStyleComboBox();
    odc->Create(panel,wxID_ANY,wxEmptyString,
                wxDefaultPosition, wxDefaultSize,
                m_arrItems,
                wxCB_READONLY //wxNO_BORDER | wxCB_READONLY
               );


    odc->SetSelection(0);

    rowSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 );
    rowSizer->AddStretchSpacer(1);
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );



    //
    // Same but with changed button position
    //
    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    rowSizer->Add( new wxStaticText(panel,wxID_ANY,
                   wxT("OwnerDrawnComboBox with owner-drawn items and button on the left:")), 1,
                   wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );

    rowSizer = new wxBoxSizer( wxHORIZONTAL );


    // When defining derivative class for callbacks, we need
    // to use two-stage creation (or redefine the common wx
    // constructor).
    odc = new wxPenStyleComboBox();
    odc->Create(panel,wxID_ANY,wxEmptyString,
                wxDefaultPosition, wxDefaultSize,
                m_arrItems,
                wxCB_READONLY //wxNO_BORDER | wxCB_READONLY
               );


    odc->SetSelection(0);

    // Use button size that is slightly smaller than the default.
    wxSize butSize = odc->GetButtonSize();
    odc->SetButtonPosition(butSize.x - 2, // button width
                           butSize.y - 6, // button height
                           wxLEFT, // side
                           2 // horizontal spacing
                          );

    rowSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 );
    rowSizer->AddStretchSpacer(1);
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );


    //
    // List View wxComboCtrl
    //

    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    rowSizer->Add( new wxStaticText(panel,
                        wxID_ANY,
                        "List View wxComboCtrl (custom animation):"),
                   1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
    rowSizer->Add( new wxStaticText(panel,wxID_ANY,wxT("Tree Ctrl wxComboCtrl:")), 1,
                   wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );

    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    cc = new wxComboCtrlWithCustomPopupAnim();

    // Let's set a custom style for the contained wxTextCtrl. We need to
    // use two-step creation for it to work properly.
    cc->SetTextCtrlStyle(wxTE_RIGHT);

    cc->Create(panel, wxID_ANY, wxEmptyString);

    // Make sure we use popup that allows focusing the listview.
    cc->UseAltPopupWindow();

    cc->SetPopupMinWidth(300);

    ListViewComboPopup* iface = new ListViewComboPopup();
    cc->SetPopupControl(iface);

    int i;
    for ( i=0; i<100; i++ )
        iface->AddSelection( wxString::Format(wxT("Item %02i"),i));

    rowSizer->Add( cc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );


    //
    // Tree Ctrl wxComboCtrl
    //

    // Note that we test that wxGenericComboCtrl works
    gcc = new wxGenericComboCtrl(panel,wxID_ANY,wxEmptyString,
                                 wxDefaultPosition, wxDefaultSize);

    // Make sure we use popup that allows focusing the treectrl.
    gcc->UseAltPopupWindow();

    // Set popup interface right away, otherwise some of the calls
    // below may fail
    TreeCtrlComboPopup* tcPopup = new TreeCtrlComboPopup();
    gcc->SetPopupControl(tcPopup);

    // Add items using wxTreeCtrl methods directly
    wxTreeItemId rootId = tcPopup->AddRoot(wxT("<hidden_root>"));

    wxTreeItemId groupId;

    for ( i=0; i<4; i++ )
    {
        groupId = tcPopup->AppendItem(rootId,
            wxString::Format(wxT("Branch %02i"),i));

        int n;
        for ( n=0; n<25; n++ )
            tcPopup->AppendItem(groupId,
                wxString::Format(wxT("Subitem %02i"),(i*25)+n));
    }

    gcc->SetValue(wxT("Subitem 05"));

    // Move button to left - it makes more sense for a tree ctrl
    gcc->SetButtonPosition(-1, // button width
                           -1, // button height
                           wxLEFT, // side
                           0 // horizontal spacing
                          );

    rowSizer->Add( gcc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );

    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );

#if wxUSE_IMAGE
    wxInitAllImageHandlers();

    //
    // Custom Dropbutton Bitmaps
    // (second one uses blank button background)
    //
    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    rowSizer->Add( new wxStaticText(panel,wxID_ANY,
                   wxT("OwnerDrawnComboBox with simple dropbutton graphics:")), 1,
                   wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );

    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );

    rowSizer = new wxBoxSizer( wxHORIZONTAL );

    odc = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString,
                                   wxDefaultPosition, wxDefaultSize,
                                   m_arrItems,
                                   (long)0 // wxCB_SORT // wxNO_BORDER | wxCB_READONLY
                                  );

    wxOwnerDrawnComboBox* odc2;
    odc2 = new wxOwnerDrawnComboBox(panel,wxID_ANY,wxEmptyString,
                                    wxDefaultPosition, wxDefaultSize,
                                    m_arrItems,
                                    (long)0 // wxCB_SORT // wxNO_BORDER | wxCB_READONLY
                                   );

    // Load images from disk
    wxImage imgNormal(wxT("dropbutn.png"));
    wxImage imgPressed(wxT("dropbutp.png"));
    wxImage imgHover(wxT("dropbuth.png"));

    if ( imgNormal.IsOk() && imgPressed.IsOk() && imgHover.IsOk() )
    {
        wxBitmap bmpNormal(imgNormal);
        wxBitmap bmpPressed(imgPressed);
        wxBitmap bmpHover(imgHover);
        odc->SetButtonBitmaps(bmpNormal,false,bmpPressed,bmpHover);
        odc2->SetButtonBitmaps(bmpNormal,true,bmpPressed,bmpHover);
    }
    else
        wxLogError(wxT("Dropbutton images not found"));

    //odc2->SetButtonPosition(0, // width adjustment
    //                        0, // height adjustment
    //                        wxLEFT, // side
    //                        0 // horizontal spacing
    //                       );

    rowSizer->Add( odc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 );
    rowSizer->Add( odc2, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 );
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );
#endif


    //
    // wxComboCtrl with totally custom button action (open file dialog)
    //
    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    rowSizer->Add( new wxStaticText(panel,wxID_ANY,
                        wxT("wxComboCtrl with custom button action:")), 1,
                   wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 );


    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );

    rowSizer = new wxBoxSizer( wxHORIZONTAL );
    wxFileSelectorCombo* fsc;

    fsc = new wxFileSelectorCombo(panel,wxID_ANY,wxEmptyString,
                                  wxDefaultPosition, wxDefaultSize,
                                  (long)0
                                 );

    rowSizer->Add( fsc, 1, wxALIGN_CENTER_VERTICAL|wxALL, 4 );
    colSizer->Add( rowSizer, 0, wxEXPAND|wxALL, 5 );


    // Make sure GetFeatures is implemented
    wxComboCtrl::GetFeatures();


    topRowSizer->Add( colSizer, 1, wxALL, 2 );

    colSizer = new wxBoxSizer( wxVERTICAL );

    colSizer->AddSpacer(8);
    colSizer->Add( new wxStaticText(panel, wxID_ANY, wxT("Log Messages:")), 0, wxTOP|wxLEFT, 3 );
    colSizer->Add( m_logWin, 1, wxEXPAND|wxALL, 3 );

    topRowSizer->Add( colSizer, 1, wxEXPAND|wxALL, 2 );
    topSizer->Add( topRowSizer, 1, wxEXPAND );

    panel->SetSizer( topSizer );
    topSizer->SetSizeHints( panel );

    Fit();
    Centre();
}
/////////////////////////////////////////////////////////////
// Constructor
/////////////////////////////////////////////////////////////
CConfigDialog::CConfigDialog(wxWindow *parent, bool bIsConnected): wxDialog(parent, 1, "Config", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX)
{
	this->SetTitle(GetText("Config"));
	this->SetFont(FontNormal10);
	//this->SetForegroundColour(ColorBlueLite);

	// Create the main sizer
	wxBoxSizer*	pMainSizer = new wxBoxSizer(wxVERTICAL);
	pMainSizer->AddSpacer(10);

	// Get all available languages
	wxArrayString arLang;
	CConfig::GetSingleton()->GetPossibleLanguages(&arLang);

	// Available record options
	wxArrayString arRecordOptions;
	arRecordOptions.Add("USB");
	arRecordOptions.Add("USB+PC");
	arRecordOptions.Add("PC");

	// Current Options
	wxString strRecordOptions;
	switch(CConfig::GetSingleton()->GetRecordOption())
	{
		case 2:
			strRecordOptions = "USB+PC";
			break;

		case 3:
			strRecordOptions = "PC";
			break;

		default:
			strRecordOptions = "USB";
			break;
	}	

	// Available resolutions
	wxArrayString arResolutions;
	arResolutions.Add("360");
	arResolutions.Add("720");

	// Current resolution
	wxString strResolution("360");
	if(CConfig::GetSingleton()->GetVideoCodec() == Codec_H264_720P)
	{
		strResolution = "720";
	}	

	// Available HUD styles
	wxArrayString arHUDStyles;
	arHUDStyles.Add("HUD1");
	arHUDStyles.Add("HUD2");

	// Get Current HUD style
	wxString strHudStyle("HUD1");
	if(CConfig::GetSingleton()->GetHudStyle() == 2)
	{
		strHudStyle = "HUD2";
	}

	// Available line sizes for HUD
	wxArrayString arLineSizes;
	arLineSizes.Add("1");
	arLineSizes.Add("2");
	arLineSizes.Add("3");
	arLineSizes.Add("4");

	// Current line size
	wxString strLineSize = ToString(CConfig::GetSingleton()->GetHudLineSize());

	// Create a sizer that contains all the controls
	wxFlexGridSizer* pControls = new wxFlexGridSizer(12, 2, 15, 20);

	// Allow the columns to grow
	pControls->AddGrowableCol(0);
	pControls->AddGrowableCol(1);	

	// Help text for language
	wxStaticText* pLangText = new wxStaticText(this, wxID_ANY, GetText("SelectLang"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pLangText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);		

	// Combobox to select language
	m_pLanguage = new wxComboBox(this, wxID_ANY, CConfig::GetSingleton()->GetLanguage(), wxDefaultPosition, wxDefaultSize, arLang, wxCB_READONLY);
	pControls->Add(m_pLanguage, 0, wxEXPAND | wxALL, 2);

	// Help text for the sound checkbox
	wxStaticText* pSoundText = new wxStaticText(this, wxID_ANY, GetText("PlaySounds"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pSoundText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Checkbox, if alarm sounds should be played or not
	m_pPlaySounds = new wxCheckBox(this, wxID_ANY, "", wxDefaultPosition);
	m_pPlaySounds->SetValue(CConfig::GetSingleton()->HasSoundFlag());
	pControls->Add(m_pPlaySounds, 0, wxALIGN_CENTER | wxALL, 2);

	// Help text for the video resolution
	wxStaticText* pCodecText = new wxStaticText(this, wxID_ANY, GetText("SelectCodec"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pCodecText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Combobox for resolution
	m_pCodec = new wxComboBox(this, wxID_ANY, strResolution, wxDefaultPosition, wxDefaultSize, arResolutions, wxCB_READONLY);
	pControls->Add(m_pCodec, 0, wxEXPAND | wxALL, 2);

	// Help text for record options
	wxStaticText* pRecordOptionsText = new wxStaticText(this, wxID_ANY, GetText("RecordOptions"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pRecordOptionsText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Combobox for record options
	m_pRecordOptions = new wxComboBox(this, wxID_ANY, strRecordOptions, wxDefaultPosition, wxDefaultSize, arRecordOptions, wxCB_READONLY);
	pControls->Add(m_pRecordOptions, 0, wxEXPAND | wxALL, 2);

	// Help text for the hud style
	wxStaticText* pHudStyleText = new wxStaticText(this, wxID_ANY, GetText("HudStyle"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pHudStyleText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Combobox for HUD style
	m_pHudStyle = new wxComboBox(this, wxID_ANY, strHudStyle, wxDefaultPosition, wxDefaultSize, arHUDStyles, wxCB_READONLY);
	pControls->Add(m_pHudStyle, 0, wxEXPAND | wxALL, 2);

	// Help text for the hud color
	wxStaticText* pHudColorText = new wxStaticText(this, wxID_ANY, GetText("HudColor"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pHudColorText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Color picker
	m_pHudColor = new wxColourPickerCtrl(this, wxID_ANY, CConfig::GetSingleton()->GetHudColor());
	pControls->Add(m_pHudColor, 0, wxEXPAND | wxALL, 2);

	// Help text for the line size
	wxStaticText* pHudLineText = new wxStaticText(this, wxID_ANY, GetText("HudLine"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pHudLineText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Combobox for line size
	m_pHudLineSize = new wxComboBox(this, wxID_ANY, strLineSize, wxDefaultPosition, wxDefaultSize, arLineSizes, wxCB_READONLY);
	pControls->Add(m_pHudLineSize, 0, wxEXPAND | wxALL, 2);

	// Help text for the US unit checkbox
	wxStaticText* pUSUnitText = new wxStaticText(this, wxID_ANY, GetText("USUnit"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pUSUnitText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Checkbox, if US units should be use or not
	m_pUSUnit = new wxCheckBox(this, wxID_ANY, "", wxDefaultPosition);
	m_pUSUnit->SetValue(CConfig::GetSingleton()->HasUSUnit());
	pControls->Add(m_pUSUnit, 0, wxALIGN_CENTER | wxALL, 2);

	// Help text for the low res checkbox
	wxStaticText* pLowResText = new wxStaticText(this, wxID_ANY, GetText("LowRes"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE);
	pControls->Add(pLowResText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	// Checkbox, if low res should be use or not in fullscreen
	m_pUseLowRes = new wxCheckBox(this, wxID_ANY, "", wxDefaultPosition);
	m_pUseLowRes->SetValue(CConfig::GetSingleton()->UseLowRes());
	pControls->Add(m_pUseLowRes, 0, wxALIGN_CENTER | wxALL, 2);

	//////////////////////////////////////////////////////////////////////////////
	// Note : Sliders seems to be bugged in version 2.9.1 with flag wxSL_LABELS 
	// (value cannot be displayed at the bottom, size is always to big) so we 
	// set a fixed size
	//////////////////////////////////////////////////////////////////////////////

	wxSize SliderSize(180, 20);

	// Slider for speed limit
	wxStaticText* pSpeedText = new wxStaticText(this, wxID_ANY, GetText("SetMaxSpeed"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxALIGN_CENTRE);
	pControls->Add(pSpeedText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	m_pMaxSpeed = new wxSlider(this, wxID_ANY, CConfig::GetSingleton()->GetSpeedLimit(), 10, 100, wxDefaultPosition, SliderSize, wxSL_LABELS);
	m_pMaxSpeed->SetFont(FontNormal8);
	pControls->Add(m_pMaxSpeed, 0, wxEXPAND | wxALL, 2);

	// Slider for acceleration limit
	wxStaticText* pAcceletationText = new wxStaticText(this, wxID_ANY, GetText("SetMaxAcc"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxALIGN_CENTRE);
	pControls->Add(pAcceletationText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	m_pMaxAcceleration = new wxSlider(this, wxID_ANY, CConfig::GetSingleton()->GetAccelerationLimit(), 10, 100, wxDefaultPosition, SliderSize, wxSL_LABELS);
	m_pMaxAcceleration->SetFont(FontNormal8);
	pControls->Add(m_pMaxAcceleration, 0, wxEXPAND | wxALL, 2);

	// Slider for altitude limit
	wxStaticText* pAltitudeText = new wxStaticText(this, wxID_ANY, GetText("SetMaxAlt"), wxDefaultPosition, wxDefaultSize, wxBORDER_NONE | wxALIGN_CENTRE);
	pControls->Add(pAltitudeText, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT, 0);

	m_pMaxAltitude = new wxSlider(this, wxID_ANY, CConfig::GetSingleton()->GetAltitudeLimit(), 3, 300, wxDefaultPosition, SliderSize, wxSL_LABELS);
	m_pMaxAltitude->SetFont(FontNormal8);
	pControls->Add(m_pMaxAltitude, 0, wxEXPAND | wxALL, 2);	

	pMainSizer->Add(pControls, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);	
	pMainSizer->AddSpacer(10);	

	// Horizontal sizer for the buttons
	wxBoxSizer* pTmpSizer = new wxBoxSizer(wxHORIZONTAL);

	// Create the ok button
	wxButton *pButtonOk = new wxButton(this, ID_BUTTONOK, GetText("Apply"), wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE);
	pButtonOk->SetForegroundColour(ColorGreenLite);
	pTmpSizer->Add(pButtonOk, 0, wxALL, 5);

	// Create the cancel button
	wxButton *pButtonCancel = new wxButton(this, ID_BUTTONCANCEL, GetText("Cancel"), wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE);
	pButtonCancel->SetForegroundColour(ColorRedLite);
	pButtonCancel->SetFocus();
	pTmpSizer->Add(pButtonCancel, 0, wxALL, 5);

	pMainSizer->Add(pTmpSizer, 0, wxALIGN_CENTRE | wxALL, 10);	

	SetIcon(wxICON(IcoMain));

	this->SetSizerAndFit(pMainSizer);
	this->CentreOnParent();
}
Beispiel #26
0
WebFrame::WebFrame(const wxString& url) :
    wxFrame(NULL, wxID_ANY, "wxWebView Sample")
{
    // set the frame icon
    SetIcon(wxICON(sample));
    SetTitle("wxWebView Sample");

    wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);

    // Create the toolbar
    m_toolbar = CreateToolBar(wxTB_TEXT);
    m_toolbar->SetToolBitmapSize(wxSize(32, 32));

    wxBitmap back = wxArtProvider::GetBitmap(wxART_GO_BACK , wxART_TOOLBAR);
    wxBitmap forward = wxArtProvider::GetBitmap(wxART_GO_FORWARD , wxART_TOOLBAR);
    #ifdef __WXGTK__
        wxBitmap stop = wxArtProvider::GetBitmap("gtk-stop", wxART_TOOLBAR);
    #else
        wxBitmap stop = wxBitmap(stop_xpm);
    #endif
    #ifdef __WXGTK__
        wxBitmap refresh = wxArtProvider::GetBitmap("gtk-refresh", wxART_TOOLBAR);
    #else
        wxBitmap refresh = wxBitmap(refresh_xpm);
    #endif

    m_toolbar_back = m_toolbar->AddTool(wxID_ANY, _("Back"), back);
    m_toolbar_forward = m_toolbar->AddTool(wxID_ANY, _("Forward"), forward);
    m_toolbar_stop = m_toolbar->AddTool(wxID_ANY, _("Stop"), stop);
    m_toolbar_reload = m_toolbar->AddTool(wxID_ANY, _("Reload"),  refresh);
    m_url = new wxTextCtrl(m_toolbar, wxID_ANY, wxT(""),  wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER );
    m_toolbar->AddControl(m_url, _("URL"));
    m_toolbar_tools = m_toolbar->AddTool(wxID_ANY, _("Menu"), wxBitmap(wxlogo_xpm));

    m_toolbar->Realize();

    // Set find values.
    m_findFlags = wxWEBVIEW_FIND_DEFAULT;
    m_findText = wxEmptyString;
    m_findCount = 0;

    // Create panel for find toolbar.
    wxPanel* panel = new wxPanel(this);
    topsizer->Add(panel, wxSizerFlags().Expand());

    // Create sizer for panel.
    wxBoxSizer* panel_sizer = new wxBoxSizer(wxVERTICAL);
    panel->SetSizer(panel_sizer);

    // Create the find toolbar.
    m_find_toolbar = new wxToolBar(panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxTB_TEXT|wxTB_HORZ_LAYOUT);
    m_find_toolbar->Hide();
    panel_sizer->Add(m_find_toolbar, wxSizerFlags().Expand());

    // Create find control.
    m_find_ctrl = new wxTextCtrl(m_find_toolbar, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(140,-1), wxTE_PROCESS_ENTER);


    //Find options menu
    wxMenu* findmenu = new wxMenu;
    m_find_toolbar_wrap = findmenu->AppendCheckItem(wxID_ANY,"Wrap");
    m_find_toolbar_matchcase = findmenu->AppendCheckItem(wxID_ANY,"Match Case");
    m_find_toolbar_wholeword = findmenu->AppendCheckItem(wxID_ANY,"Entire Word");
    m_find_toolbar_highlight = findmenu->AppendCheckItem(wxID_ANY,"Highlight");
    // Add find toolbar tools.
    m_find_toolbar->SetToolSeparation(7);
    m_find_toolbar_done = m_find_toolbar->AddTool(wxID_ANY, "Close", wxArtProvider::GetBitmap(wxART_CROSS_MARK));
    m_find_toolbar->AddSeparator();
    m_find_toolbar->AddControl(m_find_ctrl, "Find");
    m_find_toolbar->AddSeparator();
    m_find_toolbar_next = m_find_toolbar->AddTool(wxID_ANY, "Next", wxArtProvider::GetBitmap(wxART_GO_DOWN, wxART_TOOLBAR, wxSize(16,16)));
    m_find_toolbar_previous = m_find_toolbar->AddTool(wxID_ANY, "Previous", wxArtProvider::GetBitmap(wxART_GO_UP, wxART_TOOLBAR, wxSize(16,16)));
    m_find_toolbar->AddSeparator();
    m_find_toolbar_options = m_find_toolbar->AddTool(wxID_ANY, "Options", wxArtProvider::GetBitmap(wxART_PLUS, wxART_TOOLBAR, wxSize(16,16)), "", wxITEM_DROPDOWN);
    m_find_toolbar_options->SetDropdownMenu(findmenu);
    m_find_toolbar->Realize();

    // Create the info panel
    m_info = new wxInfoBar(this);
    topsizer->Add(m_info, wxSizerFlags().Expand());

    // Create the webview
    m_browser = wxWebView::New(this, wxID_ANY, url);
    topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));

    //We register the wxfs:// protocol for testing purposes
    m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewArchiveHandler("wxfs")));
    //And the memory: file system
    m_browser->RegisterHandler(wxSharedPtr<wxWebViewHandler>(new wxWebViewFSHandler("memory")));

    SetSizer(topsizer);

    //Set a more sensible size for web browsing
    SetSize(wxSize(800, 600));

    // Create a log window
    new wxLogWindow(this, _("Logging"));

    // Create the Tools menu
    m_tools_menu = new wxMenu();
    wxMenuItem* print = m_tools_menu->Append(wxID_ANY , _("Print"));
    wxMenuItem* viewSource = m_tools_menu->Append(wxID_ANY , _("View Source"));
    m_tools_menu->AppendSeparator();
    m_tools_layout = m_tools_menu->AppendCheckItem(wxID_ANY, _("Use Layout Zoom"));
    m_tools_tiny = m_tools_menu->AppendCheckItem(wxID_ANY, _("Tiny"));
    m_tools_small = m_tools_menu->AppendCheckItem(wxID_ANY, _("Small"));
    m_tools_medium = m_tools_menu->AppendCheckItem(wxID_ANY, _("Medium"));
    m_tools_large = m_tools_menu->AppendCheckItem(wxID_ANY, _("Large"));
    m_tools_largest = m_tools_menu->AppendCheckItem(wxID_ANY, _("Largest"));
    m_tools_menu->AppendSeparator();
    m_tools_handle_navigation = m_tools_menu->AppendCheckItem(wxID_ANY, _("Handle Navigation"));
    m_tools_handle_new_window = m_tools_menu->AppendCheckItem(wxID_ANY, _("Handle New Windows"));
    m_tools_menu->AppendSeparator();

    //Find
    m_find = m_tools_menu->Append(wxID_ANY, _("Find"));
    m_tools_menu->AppendSeparator();

    //History menu
    m_tools_history_menu = new wxMenu();
    wxMenuItem* clearhist =  m_tools_history_menu->Append(wxID_ANY, _("Clear History"));
    m_tools_enable_history = m_tools_history_menu->AppendCheckItem(wxID_ANY, _("Enable History"));
    m_tools_history_menu->AppendSeparator();

    m_tools_menu->AppendSubMenu(m_tools_history_menu, "History");

    //Create an editing menu
    wxMenu* editmenu = new wxMenu();
    m_edit_cut = editmenu->Append(wxID_ANY, _("Cut"));
    m_edit_copy = editmenu->Append(wxID_ANY, _("Copy"));
    m_edit_paste = editmenu->Append(wxID_ANY, _("Paste"));
    editmenu->AppendSeparator();
    m_edit_undo = editmenu->Append(wxID_ANY, _("Undo"));
    m_edit_redo = editmenu->Append(wxID_ANY, _("Redo"));
    editmenu->AppendSeparator();
    m_edit_mode = editmenu->AppendCheckItem(wxID_ANY, _("Edit Mode"));

    m_tools_menu->AppendSeparator();
    m_tools_menu->AppendSubMenu(editmenu, "Edit");

    wxMenu* scroll_menu = new wxMenu;
    m_scroll_line_up = scroll_menu->Append(wxID_ANY, "Line &up");
    m_scroll_line_down = scroll_menu->Append(wxID_ANY, "Line &down");
    m_scroll_page_up = scroll_menu->Append(wxID_ANY, "Page u&p");
    m_scroll_page_down = scroll_menu->Append(wxID_ANY, "Page d&own");
    m_tools_menu->AppendSubMenu(scroll_menu, "Scroll");

    wxMenuItem* script =  m_tools_menu->Append(wxID_ANY, _("Run Script"));

    //Selection menu
    wxMenu* selection = new wxMenu();
    m_selection_clear = selection->Append(wxID_ANY, _("Clear Selection"));
    m_selection_delete = selection->Append(wxID_ANY, _("Delete Selection"));
    wxMenuItem* selectall = selection->Append(wxID_ANY, _("Select All"));

    editmenu->AppendSubMenu(selection, "Selection");

    wxMenuItem* loadscheme =  m_tools_menu->Append(wxID_ANY, _("Custom Scheme Example"));
    wxMenuItem* usememoryfs =  m_tools_menu->Append(wxID_ANY, _("Memory File System Example"));

    m_context_menu = m_tools_menu->AppendCheckItem(wxID_ANY, _("Enable Context Menu"));

    //By default we want to handle navigation and new windows
    m_tools_handle_navigation->Check();
    m_tools_handle_new_window->Check();
    m_tools_enable_history->Check();
    if(!m_browser->CanSetZoomType(wxWEBVIEW_ZOOM_TYPE_LAYOUT))
        m_tools_layout->Enable(false);


    // Connect the toolbar events
    Connect(m_toolbar_back->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnBack), NULL, this );
    Connect(m_toolbar_forward->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnForward), NULL, this );
    Connect(m_toolbar_stop->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnStop), NULL, this );
    Connect(m_toolbar_reload->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnReload),NULL, this );
    Connect(m_toolbar_tools->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnToolsClicked), NULL, this );

    Connect(m_url->GetId(), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(WebFrame::OnUrl), NULL, this );

    // Connect find toolbar events.
    Connect(m_find_toolbar_done->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnFindDone), NULL, this );
    Connect(m_find_toolbar_next->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnFindText), NULL, this );
    Connect(m_find_toolbar_previous->GetId(), wxEVT_COMMAND_TOOL_CLICKED,
            wxCommandEventHandler(WebFrame::OnFindText), NULL, this );

    // Connect find control events.
    Connect(m_find_ctrl->GetId(), wxEVT_COMMAND_TEXT_UPDATED,
            wxCommandEventHandler(WebFrame::OnFindText), NULL, this );
    Connect(m_find_ctrl->GetId(), wxEVT_COMMAND_TEXT_ENTER,
            wxCommandEventHandler(WebFrame::OnFindText), NULL, this );

    // Connect the webview events
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEBVIEW_NAVIGATING,
            wxWebViewEventHandler(WebFrame::OnNavigationRequest), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEBVIEW_NAVIGATED,
            wxWebViewEventHandler(WebFrame::OnNavigationComplete), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEBVIEW_LOADED,
            wxWebViewEventHandler(WebFrame::OnDocumentLoaded), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEBVIEW_ERROR,
            wxWebViewEventHandler(WebFrame::OnError), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEBVIEW_NEWWINDOW,
            wxWebViewEventHandler(WebFrame::OnNewWindow), NULL, this);
    Connect(m_browser->GetId(), wxEVT_COMMAND_WEBVIEW_TITLE_CHANGED,
            wxWebViewEventHandler(WebFrame::OnTitleChanged), NULL, this);

    // Connect the menu events
    Connect(viewSource->GetId(), wxEVT_COMMAND_MENU_SELECTED,
           wxCommandEventHandler(WebFrame::OnViewSourceRequest),  NULL, this );
    Connect(print->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnPrint),  NULL, this );
    Connect(m_tools_layout->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnZoomLayout),  NULL, this );
    Connect(m_tools_tiny->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_small->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_medium->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_large->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(m_tools_largest->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSetZoom),  NULL, this );
    Connect(clearhist->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnClearHistory),  NULL, this );
    Connect(m_tools_enable_history->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnEnableHistory),  NULL, this );
    Connect(m_edit_cut->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnCut),  NULL, this );
    Connect(m_edit_copy->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnCopy),  NULL, this );
    Connect(m_edit_paste->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnPaste),  NULL, this );
    Connect(m_edit_undo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnUndo),  NULL, this );
    Connect(m_edit_redo->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnRedo),  NULL, this );
    Connect(m_edit_mode->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnMode),  NULL, this );
    Connect(m_scroll_line_up->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollLineUp),  NULL, this );
    Connect(m_scroll_line_down->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollLineDown),  NULL, this );
    Connect(m_scroll_page_up->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollPageUp),  NULL, this );
    Connect(m_scroll_page_down->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnScrollPageDown),  NULL, this );
    Connect(script->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnRunScript),  NULL, this );
    Connect(m_selection_clear->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnClearSelection),  NULL, this );
    Connect(m_selection_delete->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnDeleteSelection),  NULL, this );
    Connect(selectall->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnSelectAll),  NULL, this );
    Connect(loadscheme->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnLoadScheme),  NULL, this );
    Connect(usememoryfs->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnUseMemoryFS),  NULL, this );
    Connect(m_find->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnFind),  NULL, this );
    Connect(m_context_menu->GetId(), wxEVT_COMMAND_MENU_SELECTED,
            wxCommandEventHandler(WebFrame::OnEnableContextMenu), NULL, this );

    //Connect the idle events
    Connect(wxID_ANY, wxEVT_IDLE, wxIdleEventHandler(WebFrame::OnIdle), NULL, this);
}
Beispiel #27
0
// My frame constructor
MyFrame::MyFrame(const wxChar *title)
       : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500))
{
    m_listCtrl = NULL;
    m_logWindow = NULL;
    m_smallVirtual = false;
    m_numListItems = 10;

    // Give it an icon
    SetIcon(wxICON(sample));

    // Make an image list containing large icons
    m_imageListNormal = new wxImageList(32, 32, true);
    m_imageListSmall = new wxImageList(16, 16, true);

#ifdef wxHAS_IMAGES_IN_RESOURCES
    m_imageListNormal->Add( wxIcon(wxT("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon2"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon3"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon4"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon5"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon6"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon7"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon8"), wxBITMAP_TYPE_ICO_RESOURCE) );
    m_imageListNormal->Add( wxIcon(wxT("icon9"), wxBITMAP_TYPE_ICO_RESOURCE) );

    m_imageListSmall->Add( wxIcon(wxT("iconsmall"), wxBITMAP_TYPE_ICO_RESOURCE) );

#else
    m_imageListNormal->Add( wxIcon( toolbrai_xpm ) );
    m_imageListNormal->Add( wxIcon( toolchar_xpm ) );
    m_imageListNormal->Add( wxIcon( tooldata_xpm ) );
    m_imageListNormal->Add( wxIcon( toolnote_xpm ) );
    m_imageListNormal->Add( wxIcon( tooltodo_xpm ) );
    m_imageListNormal->Add( wxIcon( toolchec_xpm ) );
    m_imageListNormal->Add( wxIcon( toolgame_xpm ) );
    m_imageListNormal->Add( wxIcon( tooltime_xpm ) );
    m_imageListNormal->Add( wxIcon( toolword_xpm ) );

    m_imageListSmall->Add( wxIcon( small1_xpm) );
#endif

    // Make a menubar
    wxMenu *menuFile = new wxMenu;
    menuFile->Append(LIST_ABOUT, wxT("&About"));
    menuFile->AppendSeparator();
    menuFile->Append(LIST_QUIT, wxT("E&xit\tAlt-X"));

    wxMenu *menuView = new wxMenu;
    menuView->Append(LIST_LIST_VIEW, wxT("&List view\tF1"));
    menuView->Append(LIST_REPORT_VIEW, wxT("&Report view\tF2"));
    menuView->Append(LIST_ICON_VIEW, wxT("&Icon view\tF3"));
    menuView->Append(LIST_ICON_TEXT_VIEW, wxT("Icon view with &text\tF4"));
    menuView->Append(LIST_SMALL_ICON_VIEW, wxT("&Small icon view\tF5"));
    menuView->Append(LIST_SMALL_ICON_TEXT_VIEW, wxT("Small icon &view with text\tF6"));
    menuView->Append(LIST_VIRTUAL_VIEW, wxT("&Virtual view\tF7"));
    menuView->Append(LIST_SMALL_VIRTUAL_VIEW, wxT("Small virtual vie&w\tF8"));
    menuView->AppendSeparator();
    menuView->Append(LIST_SET_ITEMS_COUNT, "Set &number of items");
#ifdef __WXOSX__
    menuView->AppendSeparator();
    menuView->AppendCheckItem(LIST_MAC_USE_GENERIC, wxT("Mac: Use Generic Control"));
#endif

    wxMenu *menuList = new wxMenu;
    menuList->Append(LIST_GOTO, wxT("&Go to item #3\tCtrl-3"));
    menuList->Append(LIST_FOCUS_LAST, wxT("&Make last item current\tCtrl-L"));
    menuList->Append(LIST_TOGGLE_FIRST, wxT("To&ggle first item\tCtrl-G"));
    menuList->Append(LIST_DESELECT_ALL, wxT("&Deselect All\tCtrl-D"));
    menuList->Append(LIST_SELECT_ALL, wxT("S&elect All\tCtrl-A"));
    menuList->AppendSeparator();
    menuList->Append(LIST_SHOW_COL_INFO, wxT("Show &column info\tCtrl-C"));
    menuList->Append(LIST_SHOW_SEL_INFO, wxT("Show &selected items\tCtrl-S"));
    menuList->Append(LIST_SHOW_VIEW_RECT, wxT("Show &view rect"));
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
    menuList->Append(LIST_SET_COL_ORDER, wxT("Se&t columns order\tShift-Ctrl-O"));
    menuList->Append(LIST_GET_COL_ORDER, wxT("Sho&w columns order\tCtrl-O"));
#endif // wxHAS_LISTCTRL_COLUMN_ORDER
    menuList->AppendSeparator();
    menuList->Append(LIST_SORT, wxT("Sor&t\tCtrl-T"));
    menuList->Append(LIST_FIND, "Test Find() performance");
    menuList->AppendSeparator();
    menuList->Append(LIST_ADD, wxT("&Append an item\tCtrl-P"));
    menuList->Append(LIST_EDIT, wxT("&Edit the item\tCtrl-E"));
    menuList->Append(LIST_DELETE, wxT("&Delete first item\tCtrl-X"));
    menuList->Append(LIST_DELETE_ALL, wxT("Delete &all items"));
    menuList->AppendSeparator();
    menuList->Append(LIST_FREEZE, wxT("Free&ze\tCtrl-Z"));
    menuList->Append(LIST_THAW, wxT("Tha&w\tCtrl-W"));
    menuList->AppendSeparator();
    menuList->AppendCheckItem(LIST_TOGGLE_LINES, wxT("Toggle &lines\tCtrl-I"));
    menuList->AppendCheckItem(LIST_TOGGLE_MULTI_SEL,
                              wxT("&Multiple selection\tCtrl-M"));
    menuList->Check(LIST_TOGGLE_MULTI_SEL, true);
    menuList->AppendCheckItem(LIST_TOGGLE_HEADER, "Toggle &header\tCtrl-H");
    menuList->Check(LIST_TOGGLE_HEADER, true);
    menuList->AppendCheckItem(LIST_TOGGLE_BELL, "Toggle &bell on no match");

    wxMenu *menuCol = new wxMenu;
    menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour..."));
    menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour..."));
    menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours"));

    wxMenuBar *menubar = new wxMenuBar;
    menubar->Append(menuFile, wxT("&File"));
    menubar->Append(menuView, wxT("&View"));
    menubar->Append(menuList, wxT("&List"));
    menubar->Append(menuCol, wxT("&Colour"));
    SetMenuBar(menubar);

    m_panel = new wxPanel(this, wxID_ANY);
    m_logWindow = new wxTextCtrl(m_panel, wxID_ANY, wxEmptyString,
                                 wxDefaultPosition, wxDefaultSize,
                                 wxTE_READONLY | wxTE_MULTILINE | wxSUNKEN_BORDER);

    m_logOld = wxLog::SetActiveTarget(new wxLogTextCtrl(m_logWindow));

    RecreateList(wxLC_REPORT | wxLC_SINGLE_SEL);

#ifdef __WXMSW__
    // this is useful to know specially when debugging :)
    wxLogMessage("Your version of comctl32.dll is: %d",
                 wxApp::GetComCtl32Version());
#endif

#if wxUSE_STATUSBAR
    CreateStatusBar();
#endif // wxUSE_STATUSBAR
}
Beispiel #28
0
void MyFrame::OnNewWindow(wxCommandEvent& WXUNUSED(event) )
{
    // Make another frame, containing a canvas
    MyChild *subframe = new MyChild(frame, _T("Canvas Frame"));

    wxString title;
    title.Printf(_T("Canvas Frame %d"), ++gs_nFrames);

    subframe->SetTitle(title);

    // Give it an icon
    subframe->SetIcon(wxICON(chart));

#if wxUSE_MENUS
    // Make a menubar
    wxMenu *file_menu = new wxMenu;

    file_menu->Append(MDI_NEW_WINDOW, _T("&New window"));
    file_menu->Append(MDI_CHILD_QUIT, _T("&Close child"), _T("Close this window"));
    file_menu->Append(MDI_QUIT, _T("&Exit"));

    wxMenu *option_menu = new wxMenu;

    option_menu->Append(MDI_REFRESH, _T("&Refresh picture"));
    option_menu->Append(MDI_CHANGE_TITLE, _T("Change &title...\tCtrl-T"));
    option_menu->AppendSeparator();
    option_menu->Append(MDI_CHANGE_POSITION, _T("Move frame\tCtrl-M"));
    option_menu->Append(MDI_CHANGE_SIZE, _T("Resize frame\tCtrl-S"));
#if wxUSE_CLIPBOARD
    option_menu->AppendSeparator();
    option_menu->Append(wxID_PASTE, _T("Copy text from clipboard\tCtrl-V"));
#endif // wxUSE_CLIPBOARD

    wxMenu *help_menu = new wxMenu;
    help_menu->Append(MDI_ABOUT, _T("&About"));

    wxMenuBar *menu_bar = new wxMenuBar;

    menu_bar->Append(file_menu, _T("&File"));
    menu_bar->Append(option_menu, _T("&Child"));
    menu_bar->Append(help_menu, _T("&Help"));

    // Associate the menu bar with the frame
    subframe->SetMenuBar(menu_bar);
#endif // wxUSE_MENUS

#if wxUSE_STATUSBAR
    subframe->CreateStatusBar();
    subframe->SetStatusText(title);
#endif // wxUSE_STATUSBAR

    int width, height;
    subframe->GetClientSize(&width, &height);
    MyCanvas *canvas = new MyCanvas(subframe,-1, wxPoint(0, 0), wxSize(width, height),0,_T("text"));
    //canvas->SetCursor(wxCursor(wxCURSOR_PENCIL));
    subframe->canvas = canvas;

    // Give it scrollbars
    //canvas->SetScrollbars(20, 20, 50, 50);

    subframe->Show(true);
}
Beispiel #29
0
MainFrame::MainFrame()
	: FrameBase(nullptr, wxID_ANY, "", "MainFrame", wxSize(900, 600))
	, m_aui_mgr(this)
	, m_sys_menu_opened(false)
{

	SetLabel(wxString::Format(_PRGNAME_ " v" _PRGVER_ "-" RPCS3_GIT_VERSION));

	wxMenuBar* menubar = new wxMenuBar();

	wxMenu* menu_boot = new wxMenu();
	menubar->Append(menu_boot, "&Boot");
	menu_boot->Append(id_boot_elf, "Boot &ELF / SELF file");
	menu_boot->Append(id_boot_game, "Boot &game");
	menu_boot->AppendSeparator();
	menu_boot->Append(id_boot_install_pkg, "&Install PKG");
	menu_boot->AppendSeparator();
	menu_boot->Append(id_boot_exit, "&Exit");

	wxMenu* menu_sys = new wxMenu();
	menubar->Append(menu_sys, "&System");
	menu_sys->Append(id_sys_pause, "&Pause")->Enable(false);
	menu_sys->Append(id_sys_stop, "&Stop\tCtrl + S")->Enable(false);
	menu_sys->AppendSeparator();
	menu_sys->Append(id_sys_send_open_menu, "Send &open system menu cmd")->Enable(false);
	menu_sys->Append(id_sys_send_exit, "Send &exit cmd")->Enable(false);

	wxMenu* menu_conf = new wxMenu();
	menubar->Append(menu_conf, "&Config");
	menu_conf->Append(id_config_emu, "&Settings");
	menu_conf->Append(id_config_pad, "&PAD Settings");
	menu_conf->AppendSeparator();
	menu_conf->Append(id_config_autopause_manager, "&Auto Pause Settings");
	menu_conf->AppendSeparator();
	menu_conf->Append(id_config_vfs_manager, "Virtual &File System Manager");
	menu_conf->Append(id_config_vhdd_manager, "Virtual &HDD Manager");
	menu_conf->Append(id_config_savedata_manager, "Save &Data Utility");
	menu_conf->Append(id_config_lle_modules_manager, "&LLE Modules Manager");


	wxMenu* menu_tools = new wxMenu();
	menubar->Append(menu_tools, "&Tools");
	menu_tools->Append(id_tools_compiler, "&ELF Compiler");
	menu_tools->Append(id_tools_kernel_explorer, "&Kernel Explorer")->Enable(false);
	menu_tools->Append(id_tools_memory_viewer, "&Memory Viewer")->Enable(false);
	menu_tools->Append(id_tools_rsx_debugger, "&RSX Debugger")->Enable(false);
	menu_tools->Append(id_tools_string_search, "&String Search")->Enable(false);
	menu_tools->Append(id_tools_cg_disasm, "&Cg Disasm")->Enable();

	wxMenu* menu_help = new wxMenu();
	menubar->Append(menu_help, "&Help");
	menu_help->Append(id_help_about, "&About...");

	SetMenuBar(menubar);
	SetIcon(wxICON(frame_icon));

	// Panels
	m_log_frame = new LogFrame(this);
	m_game_viewer = new GameViewer(this);
	m_debugger_frame = new DebuggerPanel(this);

	AddPane(m_game_viewer, "Game List", wxAUI_DOCK_CENTRE);
	AddPane(m_log_frame, "Log", wxAUI_DOCK_BOTTOM);
	AddPane(m_debugger_frame, "Debugger", wxAUI_DOCK_RIGHT);
	
	// Events
	Bind(wxEVT_MENU, &MainFrame::BootElf, this, id_boot_elf);
	Bind(wxEVT_MENU, &MainFrame::BootGame, this, id_boot_game);
	Bind(wxEVT_MENU, &MainFrame::InstallPkg, this, id_boot_install_pkg);
	Bind(wxEVT_MENU, [](wxCommandEvent&){ wxGetApp().Exit(); }, id_boot_exit);

	Bind(wxEVT_MENU, &MainFrame::Pause, this, id_sys_pause);
	Bind(wxEVT_MENU, &MainFrame::Stop, this, id_sys_stop);
	Bind(wxEVT_MENU, &MainFrame::SendOpenCloseSysMenu, this, id_sys_send_open_menu);
	Bind(wxEVT_MENU, &MainFrame::SendExit, this, id_sys_send_exit);

	Bind(wxEVT_MENU, &MainFrame::Config, this, id_config_emu);
	Bind(wxEVT_MENU, &MainFrame::ConfigPad, this, id_config_pad);
	Bind(wxEVT_MENU, &MainFrame::ConfigVFS, this, id_config_vfs_manager);
	Bind(wxEVT_MENU, &MainFrame::ConfigVHDD, this, id_config_vhdd_manager);
	Bind(wxEVT_MENU, &MainFrame::ConfigAutoPause, this, id_config_autopause_manager);
	Bind(wxEVT_MENU, &MainFrame::ConfigSaveData, this, id_config_savedata_manager);
	Bind(wxEVT_MENU, &MainFrame::ConfigLLEModules, this, id_config_lle_modules_manager);

	Bind(wxEVT_MENU, &MainFrame::OpenELFCompiler, this, id_tools_compiler);
	Bind(wxEVT_MENU, &MainFrame::OpenKernelExplorer, this, id_tools_kernel_explorer);
	Bind(wxEVT_MENU, &MainFrame::OpenMemoryViewer, this, id_tools_memory_viewer);
	Bind(wxEVT_MENU, &MainFrame::OpenRSXDebugger, this, id_tools_rsx_debugger);
	Bind(wxEVT_MENU, &MainFrame::OpenStringSearch, this, id_tools_string_search);
	Bind(wxEVT_MENU, &MainFrame::OpenCgDisasm, this, id_tools_cg_disasm);

	Bind(wxEVT_MENU, &MainFrame::AboutDialogHandler, this, id_help_about);

	Bind(wxEVT_MENU, &MainFrame::UpdateUI, this, id_update_dbg);

	wxGetApp().Bind(wxEVT_KEY_DOWN, &MainFrame::OnKeyDown, this);
	wxGetApp().Bind(wxEVT_DBG_COMMAND, &MainFrame::UpdateUI, this);

	LOG_NOTICE(GENERAL, _PRGNAME_ " v" _PRGVER_ "-" RPCS3_GIT_VERSION);
	LOG_NOTICE(GENERAL, "");
}
void MyApp::Draw(wxDC&dc)
{
    // This routine just draws a bunch of random stuff on the screen so that we
    // can check that different types of object are being drawn consistently
    // between the screen image, the print preview image (at various zoom
    // levels), and the printed page.
    dc.SetBackground(*wxWHITE_BRUSH);
    // dc.Clear();
    dc.SetFont(m_testFont);

    // dc.SetBackgroundMode(wxTRANSPARENT);

    dc.SetPen(*wxBLACK_PEN);
    dc.SetBrush(*wxLIGHT_GREY_BRUSH);

    dc.DrawRectangle(0, 0, 230, 350);
    dc.DrawLine(0, 0, 229, 349);
    dc.DrawLine(229, 0, 0, 349);
    dc.SetBrush(*wxTRANSPARENT_BRUSH);

    dc.SetBrush(*wxCYAN_BRUSH);
    dc.SetPen(*wxRED_PEN);

    dc.DrawRoundedRectangle(0, 20, 200, 80, 20);

    dc.DrawText( wxT("Rectangle 200 by 80"), 40, 40);

    dc.SetPen( wxPen(*wxBLACK,0,wxDOT_DASH) );
    dc.DrawEllipse(50, 140, 100, 50);
    dc.SetPen(*wxRED_PEN);

    dc.DrawText( wxT("Test message: this is in 10 point text"), 10, 180);

#if wxUSE_UNICODE
    const char *test = "Hebrew    שלום -- Japanese (日本語)";
    wxString tmp = wxConvUTF8.cMB2WC( test );
    dc.DrawText( tmp, 10, 200 );
#endif

    wxPoint points[5];
    points[0].x = 0;
    points[0].y = 0;
    points[1].x = 20;
    points[1].y = 0;
    points[2].x = 20;
    points[2].y = 20;
    points[3].x = 10;
    points[3].y = 20;
    points[4].x = 10;
    points[4].y = -20;
    dc.DrawPolygon( 5, points, 20, 250, wxODDEVEN_RULE );
    dc.DrawPolygon( 5, points, 50, 250, wxWINDING_RULE );

    dc.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 );

    points[0].x = 150;
    points[0].y = 250;
    points[1].x = 180;
    points[1].y = 250;
    points[2].x = 180;
    points[2].y = 220;
    points[3].x = 200;
    points[3].y = 220;
    dc.DrawSpline( 4, points );

    dc.DrawArc( 20,10, 10,10, 25,40 );

    wxString str;
    int i = 0;
    str.Printf( wxT("---- Text at angle %d ----"), i );
    dc.DrawRotatedText( str, 100, 300, i );

    i = m_angle;
    str.Printf( wxT("---- Text at angle %d ----"), i );
    dc.DrawRotatedText( str, 100, 300, i );

    wxIcon my_icon = wxICON(sample);

    dc.DrawIcon( my_icon, 100, 100);

    if (m_bitmap.IsOk())
        dc.DrawBitmap( m_bitmap, 10, 10 );

#if wxUSE_GRAPHICS_CONTEXT
    wxGraphicsContext *gc = NULL;

    wxPrinterDC *printer_dc = wxDynamicCast( &dc, wxPrinterDC );
    if (printer_dc)
        gc = wxGraphicsContext::Create( *printer_dc );

    wxWindowDC *window_dc = wxDynamicCast( &dc, wxWindowDC );
    if (window_dc)
        gc = wxGraphicsContext::Create( *window_dc );

#ifdef __WXMSW__
    wxEnhMetaFileDC *emf_dc = wxDynamicCast( &dc, wxEnhMetaFileDC );
    if (emf_dc)
        gc = wxGraphicsContext::Create( *emf_dc );
#endif

    if (gc)
    {
        // make a path that contains a circle and some lines, centered at 100,100
        gc->SetPen( *wxRED_PEN );

        wxGraphicsPath path = gc->CreatePath();
        path.AddCircle( 50.0, 50.0, 50.0 );
        path.MoveToPoint(0.0, 50.0);
        path.AddLineToPoint(100.0, 50.0);
        path.MoveToPoint(50.0, 0.0);
        path.AddLineToPoint(50.0, 100.0 );
        path.CloseSubpath();
        path.AddRectangle(25.0, 25.0, 50.0, 50.0);

        gc->StrokePath(path);

        // draw some text
        wxString text("Text by wxGraphicsContext");
        gc->SetFont( m_testFont, *wxBLACK );
        gc->DrawText(text, 25.0, 60.0);

        // draw rectangle around the text
        double w, h, d, el;
        gc->GetTextExtent(text, &w, &h, &d, &el);
        gc->SetPen( *wxBLACK_PEN );
        gc->DrawRectangle(25.0, 60.0, w, h);

        delete gc;
    }
#endif
}