EditorScene::EditorScene(wxWindow* parent, gd::Project & project_, gd::Layout & layout_, const gd::MainFrameWrapper & mainFrameWrapper_) : project(project_), layout(layout_), mainFrameWrapper(mainFrameWrapper_) { //(*Initialize(EditorScene) wxFlexGridSizer* FlexGridSizer3; wxFlexGridSizer* FlexGridSizer1; Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY")); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableRow(0); notebook = new wxAuiNotebook(this, ID_AUINOTEBOOK1, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TAB_SPLIT|wxAUI_NB_TAB_MOVE|wxAUI_NB_SCROLL_BUTTONS|wxNO_BORDER); scenePanel = new wxPanel(notebook, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL1")); scenePanel->SetBackgroundColour(wxColour(255,255,255)); scenePanel->SetHelpText(_("Edit the layout of the scene")); vScrollbar = new wxScrollBar(scenePanel, ID_SCROLLBAR3, wxDefaultPosition, wxDefaultSize, wxSB_VERTICAL, wxDefaultValidator, _T("ID_SCROLLBAR3")); vScrollbar->SetScrollbar(2500, 10, 5000, 10); hScrollbar = new wxScrollBar(scenePanel, ID_SCROLLBAR4, wxDefaultPosition, wxDefaultSize, wxSB_HORIZONTAL, wxDefaultValidator, _T("ID_SCROLLBAR4")); hScrollbar->SetScrollbar(2500, 10, 5000, 10); layoutEditorCanvas = new gd::LayoutEditorCanvas(scenePanel, project, layout, layout.GetInitialInstances(), layout.GetAssociatedLayoutEditorCanvasOptions(), mainFrameWrapper); eventsPanel = new wxPanel(notebook, ID_PANEL6, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL, _T("ID_PANEL6")); eventsPanel->SetBackgroundColour(wxColour(255,255,255)); eventsPanel->SetHelpText(_("Edit the events of the scene")); FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer3->AddGrowableCol(0); FlexGridSizer3->AddGrowableRow(0); eventsEditor = new EventsEditor(eventsPanel, project, layout, mainFrameWrapper); FlexGridSizer3->Add(eventsEditor, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); eventsPanel->SetSizer(FlexGridSizer3); FlexGridSizer3->Fit(eventsPanel); FlexGridSizer3->SetSizeHints(eventsPanel); notebook->AddPage(scenePanel, _("Scene"), false, gd::SkinHelper::GetIcon("scene", 16)); notebook->AddPage(eventsPanel, _("Events"), false, gd::SkinHelper::GetIcon("events", 16)); FlexGridSizer1->Add(notebook, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); SetSizer(FlexGridSizer1); FlexGridSizer1->Fit(this); FlexGridSizer1->SetSizeHints(this); Connect(ID_SCROLLBAR3,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnvScrollbarScroll); Connect(ID_SCROLLBAR3,wxEVT_SCROLL_THUMBTRACK,(wxObjectEventFunction)&EditorScene::OnvScrollbarScroll); Connect(ID_SCROLLBAR3,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnvScrollbarScroll); Connect(ID_SCROLLBAR4,wxEVT_SCROLL_TOP|wxEVT_SCROLL_BOTTOM|wxEVT_SCROLL_LINEUP|wxEVT_SCROLL_LINEDOWN|wxEVT_SCROLL_PAGEUP|wxEVT_SCROLL_PAGEDOWN|wxEVT_SCROLL_THUMBTRACK|wxEVT_SCROLL_THUMBRELEASE|wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnhScrollbarScroll); Connect(ID_SCROLLBAR4,wxEVT_SCROLL_THUMBTRACK,(wxObjectEventFunction)&EditorScene::OnhScrollbarScroll); Connect(ID_SCROLLBAR4,wxEVT_SCROLL_CHANGED,(wxObjectEventFunction)&EditorScene::OnhScrollbarScroll); layoutEditorCanvas->Connect(wxEVT_SET_FOCUS,(wxObjectEventFunction)&EditorScene::OnsceneCanvasSetFocus,0,this); scenePanel->Connect(wxEVT_SIZE,(wxObjectEventFunction)&EditorScene::OnscenePanelResize,0,this); Connect(ID_AUINOTEBOOK1,wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED,(wxObjectEventFunction)&EditorScene::OnnotebookPageChanged); Connect(ID_AUINOTEBOOK1,wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING,(wxObjectEventFunction)&EditorScene::OnnotebookPageChanging); //*) //Prepare pane manager m_mgr.SetManagedWindow( this ); layoutEditorCanvas->SetParentAuiManager(&m_mgr); layoutEditorCanvas->SetScrollbars(hScrollbar, vScrollbar); //Create all editors linked to scene canvas. objectsEditor = std::shared_ptr<gd::ObjectsEditor>(new gd::ObjectsEditor(this, project, layout, mainFrameWrapper) ); layersEditor = std::shared_ptr<gd::LayersEditorPanel>(new gd::LayersEditorPanel(this, project, layout, mainFrameWrapper) ); initialInstancesBrowser = std::shared_ptr<InitialPositionBrowserDlg>(new InitialPositionBrowserDlg(this, layout.GetInitialInstances(), *layoutEditorCanvas) ); propertiesPnl = std::shared_ptr<LayoutEditorPropertiesPnl>(new LayoutEditorPropertiesPnl(this, project, layout, layoutEditorCanvas, mainFrameWrapper)); //Link some editors together layoutEditorCanvas->AddAssociatedEditor(objectsEditor.get()); layoutEditorCanvas->AddAssociatedEditor(layersEditor.get()); layoutEditorCanvas->AddAssociatedEditor(propertiesPnl.get()); layoutEditorCanvas->AddAssociatedEditor(initialInstancesBrowser.get()); layersEditor->SetAssociatedLayoutEditorCanvas(layoutEditorCanvas); eventsEditor->SetAssociatedLayoutCanvas(layoutEditorCanvas); objectsEditor->SetAssociatedPropertiesPanel(propertiesPnl.get(), &m_mgr); //Display editors in panes m_mgr.AddPane( notebook, wxAuiPaneInfo().Name( wxT( "ESCenter" ) ).PaneBorder(false).Center().CloseButton( false ).Caption( _( "Scene's editor" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(false) ); m_mgr.AddPane( objectsEditor.get(), wxAuiPaneInfo().Name( wxT( "EO" ) ).Right().CloseButton( true ).Caption( _( "Objects' editor" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(208, 100) ); m_mgr.AddPane( layersEditor.get(), wxAuiPaneInfo().Name( wxT( "EL" ) ).Float().CloseButton( true ).Caption( _( "Layers' editor" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(200, 100).Show(false) ); m_mgr.AddPane( propertiesPnl.get(), wxAuiPaneInfo().Name( wxT( "PROPERTIES" ) ).Float().CloseButton( true ).Caption( _( "Properties" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(50, 50).BestSize(230,200).Show(false) ); m_mgr.AddPane( initialInstancesBrowser.get(), wxAuiPaneInfo().Name( wxT( "InstancesBrowser" ) ).Float().CloseButton( true ).Caption( _( "Instances list" ) ).MaximizeButton( true ).MinimizeButton( false ).CaptionVisible(true).MinSize(50, 50).BestSize(230,200).Show(false) ); //Load preferences { int position = 1; wxConfigBase::Get()->Read("/SceneEditor/SceneEventsTab", &position); if (position == 0) { long style = notebook->GetWindowStyleFlag(); style |= wxAUI_NB_TOP; style &= ~wxAUI_NB_BOTTOM; notebook->SetWindowStyleFlag(style); } } gd::SkinHelper::ApplyCurrentSkin(m_mgr); gd::SkinHelper::ApplyCurrentSkin(*notebook, true); mainFrameWrapper.SetRibbonPage(_("Scene")); layoutEditorCanvas->ConnectEvents(); //Load the saved perspective and make sure titles are translated wxString perspective; wxConfigBase::Get()->Read("/SceneEditor/LastWorkspace", &perspective); m_mgr.LoadPerspective(perspective); m_mgr.GetPane(objectsEditor.get()).Caption(_( "Objects' editor" )); m_mgr.GetPane(layersEditor.get()).Caption(_( "Layers' editor" )); m_mgr.GetPane(propertiesPnl.get()).Caption(_( "Properties" )); m_mgr.GetPane(initialInstancesBrowser.get()).Caption(_( "Instances list" )); m_mgr.Update(); }
void wxBitmapComboBox::RecreateControl() { // // Recreate control so that WM_MEASUREITEM gets called again. // Can't use CBS_OWNERDRAWVARIABLE because it has odd // mouse-wheel behaviour. // wxString value = GetValue(); wxPoint pos = GetPosition(); wxSize size = GetSize(); size.y = GetBestSize().y; const wxArrayString strings = GetStrings(); const unsigned numItems = strings.size(); unsigned i; // Save the client data pointers before clearing the control, if any. const wxClientDataType clientDataType = GetClientDataType(); wxVector<wxClientData*> objectClientData; wxVector<void*> voidClientData; switch ( clientDataType ) { case wxClientData_None: break; case wxClientData_Object: objectClientData.reserve(numItems); for ( i = 0; i < numItems; ++i ) objectClientData.push_back(GetClientObject(i)); break; case wxClientData_Void: voidClientData.reserve(numItems); for ( i = 0; i < numItems; ++i ) voidClientData.push_back(GetClientData(i)); break; } wxComboBox::DoClear(); HWND hwnd = GetHwnd(); DissociateHandle(); ::DestroyWindow(hwnd); if ( !MSWCreateControl(wxT("COMBOBOX"), wxEmptyString, pos, size) ) return; // initialize the controls contents for ( i = 0; i < numItems; i++ ) { wxComboBox::Append(strings[i]); if ( !objectClientData.empty() ) SetClientObject(i, objectClientData[i]); else if ( !voidClientData.empty() ) SetClientData(i, voidClientData[i]); } // and make sure it has the same attributes as before if ( m_hasFont ) { // calling SetFont(m_font) would do nothing as the code would // notice that the font didn't change, so force it to believe // that it did wxFont font = m_font; m_font = wxNullFont; SetFont(font); } if ( m_hasFgCol ) { wxColour colFg = m_foregroundColour; m_foregroundColour = wxNullColour; SetForegroundColour(colFg); } if ( m_hasBgCol ) { wxColour colBg = m_backgroundColour; m_backgroundColour = wxNullColour; SetBackgroundColour(colBg); } else { SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); } ::SendMessage(GetHwnd(), CB_SETITEMHEIGHT, 0, MeasureItem(0)); // Revert the old string value if ( !HasFlag(wxCB_READONLY) ) ChangeValue(value); }
// My frame constructor MyFrame::MyFrame(const wxString& title, int x, int y, int w, int h) : wxFrame((wxFrame *)NULL, wxID_ANY, title, wxPoint(x, y), wxSize(w, h)), m_treeCtrl(NULL) #if wxUSE_LOG , m_textCtrl(NULL) #endif // wxUSE_LOG { // This reduces flicker effects - even better would be to define // OnEraseBackground to do nothing. When the tree control's scrollbars are // show or hidden, the frame is sent a background erase event. SetBackgroundColour(wxColour(255, 255, 255)); // Give it an icon SetIcon(wxICON(sample)); #if wxUSE_MENUS // Make a menubar wxMenu *file_menu = new wxMenu, *style_menu = new wxMenu, *tree_menu = new wxMenu, *item_menu = new wxMenu; file_menu->Append(TreeTest_About, wxT("&About...")); file_menu->AppendSeparator(); file_menu->Append(TreeTest_Quit, wxT("E&xit\tAlt-X")); style_menu->AppendCheckItem(TreeTest_TogButtons, wxT("Toggle &normal buttons")); style_menu->AppendCheckItem(TreeTest_TogTwist, wxT("Toggle &twister buttons")); style_menu->AppendCheckItem(TreeTest_ToggleButtons, wxT("Toggle image &buttons")); style_menu->AppendSeparator(); style_menu->AppendCheckItem(TreeTest_TogLines, wxT("Toggle &connecting lines")); style_menu->AppendCheckItem(TreeTest_TogRootLines, wxT("Toggle &lines at root")); style_menu->AppendCheckItem(TreeTest_TogHideRoot, wxT("Toggle &hidden root")); style_menu->AppendCheckItem(TreeTest_TogBorder, wxT("Toggle &item border")); style_menu->AppendCheckItem(TreeTest_TogFullHighlight, wxT("Toggle &full row highlight")); style_menu->AppendCheckItem(TreeTest_TogEdit, wxT("Toggle &edit mode")); #ifndef NO_MULTIPLE_SELECTION style_menu->AppendCheckItem(TreeTest_ToggleSel, wxT("Toggle &selection mode")); #endif // NO_MULTIPLE_SELECTION style_menu->AppendCheckItem(TreeTest_ToggleImages, wxT("Toggle show ima&ges")); style_menu->Append(TreeTest_SetImageSize, wxT("Set image si&ze...")); style_menu->AppendSeparator(); style_menu->Append(TreeTest_SetFgColour, wxT("Set &foreground colour...")); style_menu->Append(TreeTest_SetBgColour, wxT("Set &background colour...")); style_menu->AppendSeparator(); style_menu->Append(TreeTest_ResetStyle, wxT("&Reset to default\tF10")); tree_menu->Append(TreeTest_Recreate, wxT("&Recreate the tree")); tree_menu->Append(TreeTest_CollapseAndReset, wxT("C&ollapse and reset")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_AddItem, wxT("Append a &new item")); tree_menu->Append(TreeTest_InsertItem, wxT("&Insert a new item")); tree_menu->Append(TreeTest_Delete, wxT("&Delete this item")); tree_menu->Append(TreeTest_DeleteChildren, wxT("Delete &children")); tree_menu->Append(TreeTest_DeleteAll, wxT("Delete &all items")); tree_menu->Append(TreeTest_SelectRoot, wxT("Select root item")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_Count, wxT("Count children of current item")); tree_menu->Append(TreeTest_CountRec, wxT("Recursively count children of current item")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_Sort, wxT("Sort children of current item")); tree_menu->Append(TreeTest_SortRev, wxT("Sort in reversed order")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_EnsureVisible, wxT("Make the last item &visible")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_IncIndent, wxT("Add 5 points to indentation\tAlt-I")); tree_menu->Append(TreeTest_DecIndent, wxT("Reduce indentation by 5 points\tAlt-R")); tree_menu->AppendSeparator(); tree_menu->Append(TreeTest_IncSpacing, wxT("Add 5 points to spacing\tCtrl-I")); tree_menu->Append(TreeTest_DecSpacing, wxT("Reduce spacing by 5 points\tCtrl-R")); item_menu->Append(TreeTest_Dump, wxT("&Dump item children")); item_menu->Append(TreeTest_Rename, wxT("&Rename item...")); item_menu->AppendSeparator(); item_menu->Append(TreeTest_SetBold, wxT("Make item &bold")); item_menu->Append(TreeTest_ClearBold, wxT("Make item ¬ bold")); item_menu->AppendSeparator(); item_menu->Append(TreeTest_ToggleIcon, wxT("Toggle the item's &icon")); #ifndef NO_MULTIPLE_SELECTION item_menu->AppendSeparator(); item_menu->Append(TreeTest_DumpSelected, wxT("Dump selected items\tAlt-D")); item_menu->Append(TreeTest_Select, wxT("Select current item\tAlt-S")); item_menu->Append(TreeTest_Unselect, wxT("Unselect everything\tAlt-U")); #endif // NO_MULTIPLE_SELECTION wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, wxT("&File")); menu_bar->Append(style_menu, wxT("&Style")); menu_bar->Append(tree_menu, wxT("&Tree")); menu_bar->Append(item_menu, wxT("&Item")); SetMenuBar(menu_bar); #endif // wxUSE_MENUS m_panel = new wxPanel(this); #if wxUSE_LOG // create the controls m_textCtrl = new wxTextCtrl(m_panel, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE | wxSUNKEN_BORDER); #endif // wxUSE_LOG CreateTreeWithDefStyle(); menu_bar->Check(TreeTest_ToggleImages, true); #if wxUSE_STATUSBAR // create a status bar CreateStatusBar(2); #endif // wxUSE_STATUSBAR #if wxUSE_LOG #ifdef __WXMOTIF__ // For some reason, we get a memcpy crash in wxLogStream::DoLogStream // on gcc/wxMotif, if we use wxLogTextCtl. Maybe it's just gcc? delete wxLog::SetActiveTarget(new wxLogStderr); #else // set our text control as the log target wxLogTextCtrl *logWindow = new wxLogTextCtrl(m_textCtrl); delete wxLog::SetActiveTarget(logWindow); #endif #endif // wxUSE_LOG }
kwxAngularMeter::kwxAngularMeter(wxWindow* parent, const wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, const long int style) : wxWindow(parent, id, pos, size, 0) { if (parent) SetBackgroundColour(parent->GetBackgroundColour()); else SetBackgroundColour(*wxLIGHT_GREY); //SetSize(size); SetAutoLayout(TRUE); Refresh(); m_id = id; //valori di default m_nScaledVal = 0; //gradi m_nRealVal = 0; m_nTick = 0; //numero tacche m_nSec = 1; //default numero settori m_nRangeStart = 0; m_nRangeEnd = 220; m_nAngleStart = -20; m_nAngleEnd = 200; m_aSectorColor[0] = *wxWHITE; // m_cBackColour = *wxLIGHT_GREY; m_cBackColour = GetBackgroundColour() ; //default sfondo applicazione m_cNeedleColour = *wxRED; //indicatore m_cBorderColour = GetBackgroundColour() ; m_dPI = 4.0 * atan(1.0); m_Font = *wxSWISS_FONT; //font m_bDrawCurrent = true ; m_label = new wxString(label); m_style = style; membitmap = new wxBitmap(size.GetWidth(), size.GetHeight()) ; /////////////// TODO : Test for BMP image loading ///////////////// m_pPreviewBmp = NULL ; /* wxBitmap bitmap( 300, 300 ); wxImage image = bitmap.ConvertToImage(); image.Destroy(); if ( !image.LoadFile( "thumbnail.bmp", wxBITMAP_TYPE_BMP ) ) wxLogError(wxT("Can't load BMP image")); else m_pPreviewBmp = new wxBitmap( image ); */ }
bool wxRichTextStyleListCtrl::Create(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) { if ((style & wxBORDER_MASK) == wxBORDER_DEFAULT) #ifdef __WXMSW__ style |= GetThemedBorderStyle(); #else style |= wxBORDER_SUNKEN; #endif wxControl::Create(parent, id, pos, size, style); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); if (size != wxDefaultSize) SetInitialSize(size); bool showSelector = ((style & wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR) == 0); wxBorder listBoxStyle; if (showSelector) { #ifdef __WXMSW__ listBoxStyle = GetThemedBorderStyle(); #else listBoxStyle = wxBORDER_SUNKEN; #endif } else listBoxStyle = wxBORDER_NONE; m_styleListBox = new wxRichTextStyleListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, listBoxStyle); wxBoxSizer* boxSizer = new wxBoxSizer(wxVERTICAL); if (showSelector) { wxArrayString choices; choices.Add(_("All styles")); choices.Add(_("Paragraph styles")); choices.Add(_("Character styles")); choices.Add(_("List styles")); m_styleChoice = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices); boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 5); boxSizer->Add(m_styleChoice, 0, wxALL|wxEXPAND, 5); } else { boxSizer->Add(m_styleListBox, 1, wxALL|wxEXPAND, 0); } SetSizer(boxSizer); Layout(); m_dontUpdate = true; if (m_styleChoice) { int i = StyleTypeToIndex(m_styleListBox->GetStyleType()); m_styleChoice->SetSelection(i); } m_dontUpdate = false; return true; }
MyCanvas::MyCanvas( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size ) : wxScrolledWindow( parent, id, pos, size, wxSUNKEN_BORDER ) , m_bmpSmileXpm(smile_xpm) , m_iconSmileXpm(smile_xpm) { my_horse_ani = NULL; m_ani_images = 0 ; SetBackgroundColour(* wxWHITE); wxBitmap bitmap( 100, 100 ); wxMemoryDC dc; dc.SelectObject( bitmap ); dc.SetBrush( wxBrush( wxT("orange"), wxSOLID ) ); dc.SetPen( *wxBLACK_PEN ); dc.DrawRectangle( 0, 0, 100, 100 ); dc.SetBrush( *wxWHITE_BRUSH ); dc.DrawRectangle( 20, 20, 60, 60 ); dc.SelectObject( wxNullBitmap ); // try to find the directory with our images wxString dir; if ( wxFile::Exists(wxT("./horse.png")) ) dir = wxT("./"); else if ( wxFile::Exists(wxT("../horse.png")) ) dir = wxT("../"); else wxLogWarning(wxT("Can't find image files in either '.' or '..'!")); wxImage image = bitmap.ConvertToImage(); #if wxUSE_LIBPNG if ( !image.SaveFile( dir + wxT("test.png"), wxBITMAP_TYPE_PNG )) { wxLogError(wxT("Can't save file")); } image.Destroy(); if ( image.LoadFile( dir + wxT("test.png") ) ) my_square = wxBitmap( image ); image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.png")) ) { wxLogError(wxT("Can't load PNG image")); } else { my_horse_png = wxBitmap( image ); } if ( !image.LoadFile( dir + wxT("toucan.png")) ) { wxLogError(wxT("Can't load PNG image")); } else { my_toucan = wxBitmap(image); } my_toucan_flipped_horiz = wxBitmap(image.Mirror(true)); my_toucan_flipped_vert = wxBitmap(image.Mirror(false)); my_toucan_flipped_both = wxBitmap(image.Mirror(true).Mirror(false)); my_toucan_grey = wxBitmap(image.ConvertToGreyscale()); my_toucan_head = wxBitmap(image.GetSubImage(wxRect(40, 7, 80, 60))); my_toucan_scaled_normal = wxBitmap(image.Scale(110,90,wxIMAGE_QUALITY_NORMAL)); my_toucan_scaled_high = wxBitmap(image.Scale(110,90,wxIMAGE_QUALITY_HIGH)); my_toucan_blur = wxBitmap(image.Blur(10)); #endif // wxUSE_LIBPNG #if wxUSE_LIBJPEG image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.jpg")) ) { wxLogError(wxT("Can't load JPG image")); } else { my_horse_jpeg = wxBitmap( image ); // Colorize by rotating green hue to red wxImage::HSVValue greenHSV = wxImage::RGBtoHSV(wxImage::RGBValue(0, 255, 0)); wxImage::HSVValue redHSV = wxImage::RGBtoHSV(wxImage::RGBValue(255, 0, 0)); image.RotateHue(redHSV.hue - greenHSV.hue); colorized_horse_jpeg = wxBitmap( image ); } if ( !image.LoadFile( dir + wxT("cmyk.jpg")) ) { wxLogError(wxT("Can't load CMYK JPG image")); } else { my_cmyk_jpeg = wxBitmap(image); } #endif // wxUSE_LIBJPEG #if wxUSE_GIF image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.gif" )) ) { wxLogError(wxT("Can't load GIF image")); } else { my_horse_gif = wxBitmap( image ); } #endif #if wxUSE_PCX image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.pcx"), wxBITMAP_TYPE_PCX ) ) { wxLogError(wxT("Can't load PCX image")); } else { my_horse_pcx = wxBitmap( image ); } #endif image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.bmp"), wxBITMAP_TYPE_BMP ) ) { wxLogError(wxT("Can't load BMP image")); } else { my_horse_bmp = wxBitmap( image ); } #if wxUSE_XPM image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.xpm"), wxBITMAP_TYPE_XPM ) ) { wxLogError(wxT("Can't load XPM image")); } else { my_horse_xpm = wxBitmap( image ); } if ( !image.SaveFile( dir + wxT("test.xpm"), wxBITMAP_TYPE_XPM )) { wxLogError(wxT("Can't save file")); } #endif #if wxUSE_PNM image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.pnm"), wxBITMAP_TYPE_PNM ) ) { wxLogError(wxT("Can't load PNM image")); } else { my_horse_pnm = wxBitmap( image ); } image.Destroy(); if ( !image.LoadFile( dir + wxT("horse_ag.pnm"), wxBITMAP_TYPE_PNM ) ) { wxLogError(wxT("Can't load PNM image")); } else { my_horse_asciigrey_pnm = wxBitmap( image ); } image.Destroy(); if ( !image.LoadFile( dir + wxT("horse_rg.pnm"), wxBITMAP_TYPE_PNM ) ) { wxLogError(wxT("Can't load PNM image")); } else { my_horse_rawgrey_pnm = wxBitmap( image ); } #endif #if wxUSE_LIBTIFF image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.tif"), wxBITMAP_TYPE_TIF ) ) { wxLogError(wxT("Can't load TIFF image")); } else { my_horse_tiff = wxBitmap( image ); } #endif #if wxUSE_LIBTIFF image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.tga"), wxBITMAP_TYPE_TGA ) ) { wxLogError(wxT("Can't load TGA image")); } else { my_horse_tga = wxBitmap( image ); } #endif CreateAntiAliasedBitmap(); my_smile_xbm = wxBitmap( (const char*)smile_bits, smile_width, smile_height, 1 ); // demonstrates XPM automatically using the mask when saving if ( m_bmpSmileXpm.Ok() ) m_bmpSmileXpm.SaveFile(wxT("saved.xpm"), wxBITMAP_TYPE_XPM); #if wxUSE_ICO_CUR image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.ico"), wxBITMAP_TYPE_ICO, 0 ) ) { wxLogError(wxT("Can't load first ICO image")); } else { my_horse_ico32 = wxBitmap( image ); } image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.ico"), wxBITMAP_TYPE_ICO, 1 ) ) { wxLogError(wxT("Can't load second ICO image")); } else { my_horse_ico16 = wxBitmap( image ); } image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.ico") ) ) { wxLogError(wxT("Can't load best ICO image")); } else { my_horse_ico = wxBitmap( image ); } image.Destroy(); if ( !image.LoadFile( dir + wxT("horse.cur"), wxBITMAP_TYPE_CUR ) ) { wxLogError(wxT("Can't load best ICO image")); } else { my_horse_cur = wxBitmap( image ); xH = 30 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X) ; yH = 2420 + image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y) ; } m_ani_images = wxImage::GetImageCount ( dir + wxT("horse3.ani"), wxBITMAP_TYPE_ANI ); if (m_ani_images==0) { wxLogError(wxT("No ANI-format images found")); } else { my_horse_ani = new wxBitmap [m_ani_images]; } int i; for (i=0; i < m_ani_images; i++) { image.Destroy(); if (!image.LoadFile( dir + wxT("horse3.ani"), wxBITMAP_TYPE_ANI, i )) { wxString tmp = wxT("Can't load image number "); tmp << i ; wxLogError(tmp); } else my_horse_ani [i] = wxBitmap( image ); } #endif // wxUSE_ICO_CUR image.Destroy(); // test image loading from stream wxFile file(dir + wxT("horse.bmp")); if ( file.IsOpened() ) { wxFileOffset len = file.Length(); size_t dataSize = (size_t)len; void *data = malloc(dataSize); if ( file.Read(data, dataSize) != len ) { wxLogError(wxT("Reading bitmap file failed")); } else { wxMemoryInputStream mis(data, dataSize); if ( !image.LoadFile(mis) ) { wxLogError(wxT("Can't load BMP image from stream")); } else { my_horse_bmp2 = wxBitmap( image ); } } free(data); } }
bool wxGenericDirCtrl::Create(wxWindow *parent, const wxWindowID treeid, const wxString& dir, const wxPoint& pos, const wxSize& size, long style, const wxString& filter, int defaultFilter, const wxString& name) { if (!wxControl::Create(parent, treeid, pos, size, style, wxDefaultValidator, name)) return false; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); Init(); long treeStyle = wxTR_HAS_BUTTONS; // On Windows CE, if you hide the root, you get a crash when // attempting to access data for children of the root item. #ifndef __WXWINCE__ treeStyle |= wxTR_HIDE_ROOT; #endif #ifdef __WXGTK20__ treeStyle |= wxTR_NO_LINES; #endif if (style & wxDIRCTRL_EDIT_LABELS) treeStyle |= wxTR_EDIT_LABELS; if (style & wxDIRCTRL_MULTIPLE) treeStyle |= wxTR_MULTIPLE; if ((style & wxDIRCTRL_3D_INTERNAL) == 0) treeStyle |= wxNO_BORDER; m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL, wxPoint(0,0), GetClientSize(), treeStyle); if (!filter.empty()) m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL); m_defaultPath = dir; m_filter = filter; if (m_filter.empty()) m_filter = wxFileSelectorDefaultWildcardStr; SetFilterIndex(defaultFilter); if (m_filterListCtrl) m_filterListCtrl->FillFilterList(filter, defaultFilter); m_treeCtrl->SetImageList(wxTheFileIconsTable->GetSmallImageList()); m_showHidden = false; wxDirItemData* rootData = new wxDirItemData(wxEmptyString, wxEmptyString, true); wxString rootName; #if defined(__WINDOWS__) || defined(__OS2__) || defined(__DOS__) rootName = _("Computer"); #else rootName = _("Sections"); #endif m_rootId = m_treeCtrl->AddRoot( rootName, 3, -1, rootData); m_treeCtrl->SetItemHasChildren(m_rootId); ExpandRoot(); SetInitialSize(size); DoResize(); return true; }
void ControlColorPreview::SetColor(Img::Color color) { SetBackgroundColour(Win::ColorToWx(color)); Refresh(); Update(); }
SeqTrack::SeqTrack(long index, wxWindow *winParent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, trackType type = eAudioTrack, WiredDocument* docParent = NULL) : wxControl(winParent, -1, pos, size), WiredDocument(wxT("SeqTrack"), docParent) { wxString str; Index = index; ChanGui = NULL; Connected = 0x0; ConnectedRackTrack = 0x0; Type = type; DeviceId = -1; Record = false; Mute = false; VuValue = 0; SetBackgroundColour(CL_RULER_BACKGROUND); // only impact on GTK+ implementation (see wx Doc) wxWindow::SetBackgroundStyle(wxBG_STYLE_CUSTOM); // name of track switch (Type) { case eAudioTrack: str.Printf(_("Audio %d"), ++AudioTrackCount); break; case eMidiTrack: str.Printf(wxT("MIDI %d"), ++MidiTrackCount); break; default: str.Printf(wxT("Unknown %d"), ++MidiTrackCount); break; } Text = new wxTextCtrl(this, SeqTrack_OnNameChange, str, wxPoint(6, 8), wxSize(TRACK_WIDTH - 68, 18), wxTE_PROCESS_ENTER); Text->SetFont(wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL)); // add pixmap to see what sort of track it is (audio or midi). wxImage* trackTypeImage; // Move into previous switch !? switch (Type) { case eAudioTrack: trackTypeImage = new wxImage(wxString(WiredSettings->DataDir + _("ihm/seqtrack/tracktype-wave.png")), wxBITMAP_TYPE_PNG); break; case eMidiTrack: trackTypeImage = new wxImage(wxString(WiredSettings->DataDir + _("ihm/seqtrack/tracktype-midi.png")), wxBITMAP_TYPE_PNG); break; default: trackTypeImage = NULL; break; } if(trackTypeImage) { wxBitmap* trackTypeBitmap = new wxBitmap(*trackTypeImage); delete trackTypeImage; trackTypeStatic = new wxStaticBitmap(this, -1, *trackTypeBitmap, wxPoint(62, 8)); } else trackTypeStatic = NULL; // record and mute button wxImage *rec_up = new wxImage(wxString(WiredSettings->DataDir + wxString(REC_UP)), wxBITMAP_TYPE_PNG); wxImage *rec_down = new wxImage(wxString(WiredSettings->DataDir + wxString(REC_DOWN)), wxBITMAP_TYPE_PNG); wxImage *mute_up = new wxImage(wxString(WiredSettings->DataDir + wxString(MUTE_UP)), wxBITMAP_TYPE_PNG); wxImage *mute_down = new wxImage(wxString(WiredSettings->DataDir + wxString(MUTE_DOWN)), wxBITMAP_TYPE_PNG); RecBtn = new DownButton(this, SeqTrack_Record, wxPoint(6, 30), wxSize(25, 16), rec_up, rec_down); MuteBtn = new DownButton(this, SeqTrack_Mute, wxPoint(34, 30), wxSize(25, 16), mute_up, mute_down); Image = new ChoiceButton(this, SeqTrack_ConnectTo, wxPoint(62, 30), wxSize(25, 16), wxT("")); // add pixmap for unassigned track and for "can assign track" wxImage* assign; assign = new wxImage(wxString(WiredSettings->DataDir + UNASSIGNED), wxBITMAP_TYPE_PNG); UnassignedBmp = new wxBitmap(*assign); assign = new wxImage(wxString(WiredSettings->DataDir + CAN_ASSIGN), wxBITMAP_TYPE_PNG); CanAssignBmp = new wxBitmap(*assign); delete assign; Image->Connect(SeqTrack_ConnectTo, wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction) (wxMouseEventFunction)&SeqTrack::OnConnectToHelp); Image->SetImage(UnassignedBmp); Image->Refresh(); // device input list DeviceBox = new wxChoice(this, SeqTrack_DeviceChoice, wxPoint(5, 50), wxSize(TRACK_WIDTH - 38, 22), 0, 0x0); DeviceBox->SetFont(wxFont(8, wxDEFAULT, wxNORMAL, wxNORMAL)); FillChoices(); DeviceBox->SetSelection(0); DeviceBox->Connect(SeqTrack_DeviceChoice, wxEVT_ENTER_WINDOW, (wxObjectEventFunction)(wxEventFunction) (wxMouseEventFunction)&SeqTrack::OnDeviceHelp); // VU meter wxImage *green = new wxImage(wxString(WiredSettings->DataDir + wxString(VUM_GREEN)), wxBITMAP_TYPE_PNG); wxImage *orange = new wxImage(wxString(WiredSettings->DataDir + wxString(VUM_ORANGE)), wxBITMAP_TYPE_PNG); wxImage *red = new wxImage(wxString(WiredSettings->DataDir + wxString(VUM_RED)), wxBITMAP_TYPE_PNG); Vu = new VUMCtrl(this, -1, 100, green, orange, red,wxPoint(TRACK_WIDTH - 28, 8), wxSize(16, 64)); Vu->SetValue(0); // connection menu menu = new wxMenu(); RebuildConnectList(); // track selection Selected = false; // we overwrite LEFT_DOWN event of these class, but we propagate it on each // parent, recursivly (until any catch has not .Skip() call). if(trackTypeStatic) trackTypeStatic->Connect(wxEVT_LEFT_DOWN, wxObjectEventFunction(&SeqTrack::PropagateEvent)); Vu->Connect(wxEVT_LEFT_DOWN, wxObjectEventFunction(&SeqTrack::PropagateEvent)); // }
/* * Method: CInfoWindow() * Purpose: constructor * Comments: none */ CInfoWindow::CInfoWindow(PChildWindowObserver& aObserver,const tPvCameraInfoEx& aInfo) : PChildWindow(aObserver,L"",wxSize(300,200),0) { wxString lString; wxSizer* lMain; // format the title of the window lString = wxString(aInfo.SerialNumber,wxConvUTF8); lString += _T(" ("); lString += wxString(aInfo.CameraName,wxConvUTF8); lString += _T(") - Information"); // and set it SetTitle(lString); // Give it an icon SetIcon(wxIcon(bitmap1)); // center on the screen CentreOnScreen(wxBOTH); #ifdef __WXMSW__ // set the background color SetBackgroundColour(*wxLIGHT_GREY); #endif // create the main sizer lMain = new wxBoxSizer(wxVERTICAL); if(lMain) { // then create a grid size to fit all the label/value in wxSizer* lGrid = new wxGridSizer(2,6,5); if(lGrid) { // Unique ID lString.Printf(wxT("%lu"),aInfo.UniqueId); lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Unique ID:")), wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)); lGrid->Add(new wxStaticText(this,wxID_ANY,lString), wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); // Serial number lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Serial Number:")), wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)); lGrid->Add(new wxStaticText(this,wxID_ANY,wxString(aInfo.SerialNumber,wxConvUTF8)), wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); // Part number lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Part Number:")), wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)); lGrid->Add(new wxStaticText(this,wxID_ANY,wxString(aInfo.PartNumber,wxConvUTF8)), wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); /* lString.Printf(wxT("%c"),(char)aInfo.PartVersion); lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Part Version:")), wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)); lGrid->Add(new wxStaticText(this,wxID_ANY,lString), wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); */ // Interface type lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Interface Type:")), wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)); lGrid->Add(new wxStaticText(this,wxID_ANY, (aInfo.InterfaceType == ePvInterfaceEthernet ? _T("Giga-Ethernet") : _T("Firewire"))), wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); lString.Printf(wxT("%lu"),aInfo.InterfaceId); lGrid->Add(new wxStaticText(this,wxID_ANY,_T("Interface ID:")), wxSizerFlags().Align(wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL)); lGrid->Add(new wxStaticText(this,wxID_ANY,lString), wxSizerFlags().Align(wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL)); // add the grid to the main sizer lMain->Add(lGrid,wxSizerFlags().Proportion(1).Expand().Border(wxALL,20)); } // set the main sizer in the window SetSizer(lMain); // and make that the window adjust its size to the sizer lMain->Fit(this); } }
// Create() function bool wxNotebook::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT ) { #if defined(__POCKETPC__) style |= wxBK_BOTTOM | wxNB_FLAT; #else style |= wxBK_TOP; #endif } #ifdef __WXWINCE__ // Not sure why, but without this style, there is no border // around the notebook tabs. if (style & wxNB_FLAT) style |= wxBORDER_SUNKEN; #endif #if !wxUSE_UXTHEME // ComCtl32 notebook tabs simply don't work unless they're on top if we // have uxtheme, we can work around it later (after control creation), but // if we have been compiled without uxtheme support, we have to clear those // styles if ( HasTroubleWithNonTopTabs() ) { style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT); } #endif //wxUSE_UXTHEME #if defined(__WINE__) && wxUSE_UNICODE LPCTSTR className = L"SysTabControl32"; #else LPCTSTR className = WC_TABCONTROL; #endif #if USE_NOTEBOOK_ANTIFLICKER // SysTabCtl32 class has natively CS_HREDRAW and CS_VREDRAW enabled and it // causes horrible flicker when resizing notebook, so get rid of it by // using a class without these styles (but otherwise identical to it) if ( !HasFlag(wxFULL_REPAINT_ON_RESIZE) ) { static ClassRegistrar s_clsNotebook; if ( !s_clsNotebook.IsInitialized() ) { // get a copy of standard class and modify it WNDCLASS wc; if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) ) { gs_wndprocNotebook = reinterpret_cast<WXFARPROC>(wc.lpfnWndProc); wc.lpszClassName = wxT("_wx_SysTabCtl32"); wc.style &= ~(CS_HREDRAW | CS_VREDRAW); wc.hInstance = wxGetInstance(); wc.lpfnWndProc = wxNotebookWndProc; s_clsNotebook.Register(wc); } else { wxLogLastError(wxT("GetClassInfoEx(SysTabCtl32)")); } } // use our custom class if available but fall back to the standard // notebook if we failed to register it if ( s_clsNotebook.IsRegistered() ) { // it's ok to use c_str() here as the static s_clsNotebook object // has sufficiently long lifetime className = s_clsNotebook.GetName().c_str(); } } #endif // USE_NOTEBOOK_ANTIFLICKER if ( !CreateControl(parent, id, pos, size, style | wxTAB_TRAVERSAL, wxDefaultValidator, name) ) return false; if ( !MSWCreateControl(className, wxEmptyString, pos, size) ) return false; // Inherit parent attributes and, unlike the default, also inherit the // parent background colour in order to blend in with its background if // it's set to a non-default value. InheritAttributes(); if ( parent->InheritsBackgroundColour() && !UseBgCol() ) SetBackgroundColour(parent->GetBackgroundColour()); #if wxUSE_UXTHEME if ( HasFlag(wxNB_NOPAGETHEME) || wxSystemOptions::IsFalse(wxT("msw.notebook.themed-background")) ) { SetBackgroundColour(GetThemeBackgroundColour()); } else // use themed background by default { // create backing store UpdateBgBrush(); } // comctl32.dll 6.0 doesn't support non-top tabs with visual styles (the // control is simply not rendered correctly), so we disable themes // if possible, otherwise we simply clear the styles. if ( HasTroubleWithNonTopTabs() && (style & (wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT)) ) { // check if we use themes at all -- if we don't, we're still okay if ( wxUxThemeEngine::GetIfActive() ) { wxUxThemeEngine::GetIfActive()->SetWindowTheme(GetHwnd(), L"", L""); // correct the background color for the new non-themed control SetBackgroundColour(GetThemeBackgroundColour()); } } #endif // wxUSE_UXTHEME // Undocumented hack to get flat notebook style // In fact, we should probably only do this in some // curcumstances, i.e. if we know we will have a border // at the bottom (the tab control doesn't draw it itself) #if defined(__POCKETPC__) || defined(__SMARTPHONE__) if (HasFlag(wxNB_FLAT)) { SendMessage(GetHwnd(), CCM_SETVERSION, COMCTL32_VERSION, 0); if (!m_hasBgCol) SetBackgroundColour(*wxWHITE); } #endif return true; }
AboutDialog::AboutDialog(void) : wxDialog(pFrame, wxID_ANY, _T("About ") APPNAME, wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) { SetBackgroundColour(*wxWHITE); wxBoxSizer *pSizer = new wxBoxSizer(wxHORIZONTAL); #include "icons/phd2_64.png.h" wxBitmap phd2(wxBITMAP_PNG_FROM_DATA(phd2_64)); wxStaticBitmap *pImage = new wxStaticBitmap(this, wxID_ANY, phd2); wxFileSystem::AddHandler(new wxMemoryFSHandler); wxMemoryFSHandler::AddFile("about.html", wxString::Format( "<html><body>" "<h3>%s %s</h3>" "<a href=\"http://openphdguiding.org\">PHD2 home page - openphdguiding.org</a><br>" "<a href=\"https://github.com/OpenPHDGuiding\">PHD2 open source project page</a><br><br>" "<font size=\"2\">" "Credits:<br>" "<table>" "<tr>" "<td>Craig Stark</td>" "<td>Bret McKee</td>" "</tr>" "<tr>" "<td>Andy Galasso</td>" "<td>Bernhard Reutner-Fischer</td>" "</tr>" "<tr>" "<td>Stefan Elste</td>" "<td>Geoffrey Hausheer</td>" "</tr>" "<tr>" "<td>Jared Wellman</td>" "<td>John Wainwright</td>" "</tr>" "<tr>" "<td>Sylvain Girard</td>" "<td>Bruce Waddington</td>" "</tr>" "<tr>" "<td>Max Chen</td>" "<td>Carsten Przygoda</td>" "</tr>" "<tr>" "<td>Hans Lambermont</td>" "<td>David Ault</td>" "</tr>" "<tr>" "<td>Markus Wieczorek</td>" "<td>Linkage</td>" "</tr>" "<tr>" "<td>Robin Glover</td>" "<td>Patrick Chevalley</td>" "</tr>" "<tr>" "<td>Scott Edwards</td>" "<td>Eiji Kaneshige</td>" "</tr>" "<tr>" "<td>Konstantin Menshikoff</td>" "<td>Jakub Bartas</td>" "</tr>" "<tr>" "<td>Javier R</td>" "<td>Oleh Malyi</td>" "</tr>" "<tr>" "<td>Tsung-Chi Wu</td>" "<td>Raffi Enficiaud</td>" "</tr>" "<tr>" "<td>Sabin Fota</td>" "<td>Dylan O'Donnell</td>" "</tr>" "<tr>" "<td>Katsuhiro Kojima</td>" "<td>Simon Taylor</td>" "</tr>" "<tr>" "<td>Hallgeir Holien</td>" "<td>Laurent Schmitz</td>" "</tr>" "<tr>" "<td>Atushi Sakauchi</td>" "<td>Giorgio Mazzacurati</td>" "</tr>" "<tr>" "<td>G\u00FCnter Scholz</td>" "<td>Ray Gralak</td>" "</tr>" "<tr>" "<td>Khalefa Algadi</td>" "<td></td>" "</tr>" "</table><br>" "<br>" "<br>" "Copyright 2006-2013 Craig Stark<br>" "Copyright 2009 Geoffrey Hausheer<br>" "Copyright 2012-2013 Bret McKee<br>" "Copyright 2013 Sylvain Girard<br>" "Copyright 2013-2016 Andy Galasso<br>" "Copyright 2013-2016 Bruce Waddington<br>" "Copyright 2014 Hans Lambermont<br>" "Copyright 2014 Robin Glover<br>" "Copyright 2014-2015 Max Planck Society<br>" "</font>" "</body></html>", APPNAME, FULLVER)); wxHtmlWindow *pHtml; pHtml = new wxHtmlWindow(this, ABOUT_LINK, wxDefaultPosition, wxSize(380, 540), wxHW_SCROLLBAR_AUTO); pHtml->SetBorders(0); pHtml->LoadPage("memory:about.html"); pHtml->SetSize(pHtml->GetInternalRepresentation()->GetWidth(), pHtml->GetInternalRepresentation()->GetHeight()); pSizer->Add(pImage, wxSizerFlags(0).Border(wxALL, 10)); pSizer->Add(pHtml, wxSizerFlags(0).Border(wxALL, 10)); wxBoxSizer *pTopLevelSizer = new wxBoxSizer(wxVERTICAL); pTopLevelSizer->Add(pSizer, wxSizerFlags(0).Expand()); pTopLevelSizer->Add(CreateButtonSizer(wxOK), wxSizerFlags(0).Expand().Border(wxALL, 10)); SetSizerAndFit(pTopLevelSizer); }
// 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(mondrian)); // Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(wxID_EXIT, _T("&Quit\tCtrl-Q")); wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, _T("&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, _T("...") }; wxString strs5[] = { IPC_HOST, _T("...") }; wxString strs6[] = { IPC_TOPIC, _T("...") }; 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(_T("Click on Connect to connect to the server")); EnableControls(); }
bool wxChoice::Create( wxWindow* pParent , wxWindowID vId , const wxPoint& rPos , const wxSize& rSize , int n , const wxString asChoices[] , long lStyle , const wxValidator& rValidator , const wxString& rsName ) { long lSstyle; if (!CreateControl( pParent ,vId ,rPos ,rSize ,lStyle ,rValidator ,rsName )) return false; lSstyle = CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE; // clipping siblings does not yet work // if (lStyle & wxCLIP_SIBLINGS ) // lSstyle |= WS_CLIPSIBLINGS; wxASSERT_MSG( !(lStyle & wxCB_DROPDOWN) && !(lStyle & wxCB_READONLY) && !(lStyle & wxCB_SIMPLE), wxT("this style flag is ignored by wxChoice, you " "probably want to use a wxComboBox") ); if (!OS2CreateControl( wxT("COMBOBOX") ,lSstyle )) return false; // // A choice/combobox normally has a white background (or other, depending // on global settings) rather than inheriting the parent's background colour. // SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); // initialize the controls contents for (int i = 0; i < n; i++) { Append(asChoices[i]); } SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); // Set height to use with sizers i.e. without the dropdown listbox wxFont vFont = GetFont(); int nEditHeight; wxGetCharSize( GetHWND(), NULL, &nEditHeight, &vFont ); nEditHeight = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nEditHeight); SetInitialSize(wxSize(-1,nEditHeight+4)); // +2x2 for the border return true; } // end of wxChoice::Create
AboutDialog::AboutDialog() : wxDialog(NULL, wxID_ANY, _(L("About Slic3r")), wxDefaultPosition, wxDefaultSize, wxCAPTION) { wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); SetBackgroundColour(bgr_clr); wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL); auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 20); // logo wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG); auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp)); hsizer->Add(logo, 1, wxEXPAND | wxTOP | wxBOTTOM, 35); wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); #ifdef __WXMSW__ int proportion = 2; #else int proportion = 3; #endif hsizer->Add(vsizer, proportion, wxEXPAND|wxLEFT, 20); // title { wxStaticText* title = new wxStaticText(this, wxID_ANY, "Slic3r Prusa Edition", wxDefaultPosition, wxDefaultSize); wxFont title_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); title_font.SetWeight(wxFONTWEIGHT_BOLD); title_font.SetFamily(wxFONTFAMILY_ROMAN); title_font.SetPointSize(24); title->SetFont(title_font); vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 10); } // version { auto version_string = _(L("Version"))+ " " + std::string(SLIC3R_VERSION); wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize); wxFont version_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); #ifdef __WXMSW__ version_font.SetPointSize(9); #else version_font.SetPointSize(11); #endif version->SetFont(version_font); vsizer->Add(version, 0, wxALIGN_LEFT | wxBOTTOM, 10); } // text wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/); { wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue()); auto bgr_clr_str = wxString::Format(wxT("#%02X%02X%02X"), bgr_clr.Red(), bgr_clr.Green(), bgr_clr.Blue()); const int fs = font.GetPointSize()-1; int size[] = {fs,fs,fs,fs,fs,fs,fs}; html->SetFonts(font.GetFaceName(), font.GetFaceName(), size); html->SetBorders(2); const auto text = wxString::Format( "<html>" "<body bgcolor= %s link= %s>" "<font color=%s>" "Copyright © 2016-2018 Prusa Research. <br />" "Copyright © 2011-2017 Alessandro Ranellucci. <br />" "<a href=\"http://slic3r.org/\">Slic3r</a> is licensed under the " "<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">GNU Affero General Public License, version 3</a>." "<br /><br />" "Contributions by Henrik Brix Andersen, Nicolas Dandrimont, Mark Hindess, Petr Ledvina, Joseph Lenox, Y. Sapir, Mike Sheldrake, Vojtech Bubnik and numerous others. " "Manual by Gary Hodgson. Inspired by the RepRap community. <br />" "Slic3r logo designed by Corey Daniels, <a href=\"http://www.famfamfam.com/lab/icons/silk/\">Silk Icon Set</a> designed by Mark James. " "</font>" "</body>" "</html>", bgr_clr_str, text_clr_str, text_clr_str); html->SetPage(text); vsizer->Add(html, 1, wxEXPAND | wxBOTTOM, 10); html->Bind(wxEVT_HTML_LINK_CLICKED, &AboutDialog::onLinkClicked, this); } wxStdDialogButtonSizer* buttons = this->CreateStdDialogButtonSizer(wxCLOSE); this->SetEscapeId(wxID_CLOSE); this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE); vsizer->Add(buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); // this->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); // logo->Bind(wxEVT_LEFT_DOWN, &AboutDialog::onCloseDialog, this); SetSizer(main_sizer); main_sizer->SetSizeHints(this); }
MyCanvas::MyCanvas(wxFrame *frame, const wxPoint&pos, const wxSize&size, long style) : wxScrolledWindow(frame, wxID_ANY, pos, size, style) { SetBackgroundColour(*wxWHITE); }
Si5351C_wxgui::Si5351C_wxgui(wxWindow* parent, wxWindowID id, const wxString &title, const wxPoint& pos, const wxSize& size, int styles, wxString idname) { m_pModule = NULL; wxFlexGridSizer* FlexGridSizer4; wxFlexGridSizer* FlexGridSizer3; wxFlexGridSizer* FlexGridSizer5; wxFlexGridSizer* FlexGridSizer9; wxFlexGridSizer* FlexGridSizer2; wxFlexGridSizer* FlexGridSizer6; wxStaticBoxSizer* StaticBoxSizer1; wxFlexGridSizer* FlexGridSizer1; Create(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, styles, _T("wxID_ANY")); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE)); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer3 = new wxFlexGridSizer(0, 3, 0, 0); StaticBoxSizer1 = new wxStaticBoxSizer(wxVERTICAL, this, _("Si5351C")); btnLoadFile = new wxButton(this, ID_BUTTON2, _("Upload register map from file"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2")); StaticBoxSizer1->Add(btnLoadFile, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); btnResetToDefaults = new wxButton(this, ID_BUTTON4, _("Reset register map to default"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON4")); StaticBoxSizer1->Add(btnResetToDefaults, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer3->Add(StaticBoxSizer1, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer2 = new wxFlexGridSizer(0, 2, 5, 5); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("CLKIN Frequency (MHz)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); FlexGridSizer2->Add(StaticText1, 1, wxTOP | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtCLKIN_MHz = new wxTextCtrl(this, ID_TEXTCTRL1, _("30.72"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); FlexGridSizer2->Add(txtCLKIN_MHz, 1, wxTOP | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); const wxString clksrcChoices[] = { _("XTAL"), _("CLKIN") }; rgrClkSrc = new wxRadioBox(this, wxNewId(), _("PLL src"), wxDefaultPosition, wxDefaultSize, 2, clksrcChoices, 2, wxRA_SPECIFY_COLS, wxDefaultValidator, _T("ID_RADIOBOX1")); FlexGridSizer2->Add(rgrClkSrc, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0); const wxString xtalfreqChoices[] = { _("25 MHz"), _("27 MHz") }; rgrXTALfreq = new wxRadioBox(this, wxNewId(), _("XTAL freq"), wxDefaultPosition, wxDefaultSize, 2, xtalfreqChoices, 2, wxRA_SPECIFY_COLS, wxDefaultValidator, _T("ID_RADIOBOX1")); FlexGridSizer2->Add(rgrXTALfreq, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer3->Add(FlexGridSizer2, 1, wxLEFT | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer6 = new wxFlexGridSizer(0, 1, 0, 0); lblStatus = new wxStaticText(this, ID_STATICTEXT14, _("SYS_INIT:\t\? \t SYS_INIT_STKY:\t\?\nLOL_B:\t\? \tLOL_B_STKY:\t\?\nLOL_A:\t\? \tLOL_A_STKY:\t\?\nLOS:\t\? \tLOS_STKY:\t\?"), wxDefaultPosition, wxSize(282, 59), 0, _T("ID_STATICTEXT14")); FlexGridSizer6->Add(lblStatus, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer5 = new wxFlexGridSizer(0, 3, 0, 0); btnReadStatus = new wxButton(this, ID_BUTTON1, _("Read Status"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1")); FlexGridSizer5->Add(btnReadStatus, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); btnClearStatus = new wxButton(this, ID_BUTTON5, _("Clear"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON5")); FlexGridSizer5->Add(btnClearStatus, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer6->Add(FlexGridSizer5, 1, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer3->Add(FlexGridSizer6, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(FlexGridSizer3, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer4 = new wxFlexGridSizer(0, 5, 0, 0); FlexGridSizer9 = new wxFlexGridSizer(0, 4, 0, 0); StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Pin Name"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); FlexGridSizer9->Add(StaticText2, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); StaticText11 = new wxStaticText(this, ID_STATICTEXT11, _("Enable channel"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT11")); FlexGridSizer9->Add(StaticText11, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); StaticText12 = new wxStaticText(this, ID_STATICTEXT12, _("Output frequency (MHz)"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT12")); FlexGridSizer9->Add(StaticText12, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); StaticText13 = new wxStaticText(this, ID_STATICTEXT13, _("Invert output"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT13")); FlexGridSizer9->Add(StaticText13, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK0 = new wxStaticText(this, ID_STATICTEXT3, _("CLK0"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3")); FlexGridSizer9->Add(lblCLK0, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK0 = new wxCheckBox(this, ID_CHECKBOX1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX1")); chkEN_CLK0->SetValue(true); FlexGridSizer9->Add(chkEN_CLK0, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK0 = new wxTextCtrl(this, ID_TEXTCTRL2, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2")); FlexGridSizer9->Add(txtFreq_CLK0, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK0 = new wxCheckBox(this, ID_CHECKBOX9, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX9")); chkInvert_CLK0->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK0, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK1 = new wxStaticText(this, ID_STATICTEXT4, _("CLK1"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4")); FlexGridSizer9->Add(lblCLK1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK1 = new wxCheckBox(this, ID_CHECKBOX2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX2")); chkEN_CLK1->SetValue(true); FlexGridSizer9->Add(chkEN_CLK1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK1 = new wxTextCtrl(this, ID_TEXTCTRL3, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL3")); FlexGridSizer9->Add(txtFreq_CLK1, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK1 = new wxCheckBox(this, ID_CHECKBOX10, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX10")); chkInvert_CLK1->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK1, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK2 = new wxStaticText(this, ID_STATICTEXT5, _("CLK2"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT5")); FlexGridSizer9->Add(lblCLK2, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK2 = new wxCheckBox(this, ID_CHECKBOX3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX3")); chkEN_CLK2->SetValue(true); FlexGridSizer9->Add(chkEN_CLK2, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK2 = new wxTextCtrl(this, ID_TEXTCTRL4, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL4")); FlexGridSizer9->Add(txtFreq_CLK2, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK2 = new wxCheckBox(this, ID_CHECKBOX11, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX11")); chkInvert_CLK2->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK2, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK3 = new wxStaticText(this, ID_STATICTEXT6, _("CLK3"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT6")); FlexGridSizer9->Add(lblCLK3, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK3 = new wxCheckBox(this, ID_CHECKBOX4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX4")); chkEN_CLK3->SetValue(true); FlexGridSizer9->Add(chkEN_CLK3, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK3 = new wxTextCtrl(this, ID_TEXTCTRL5, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL5")); FlexGridSizer9->Add(txtFreq_CLK3, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK3 = new wxCheckBox(this, ID_CHECKBOX12, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX12")); chkInvert_CLK3->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK3, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK4 = new wxStaticText(this, ID_STATICTEXT7, _("CLK4"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT7")); FlexGridSizer9->Add(lblCLK4, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK4 = new wxCheckBox(this, ID_CHECKBOX5, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX5")); chkEN_CLK4->SetValue(true); FlexGridSizer9->Add(chkEN_CLK4, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK4 = new wxTextCtrl(this, ID_TEXTCTRL6, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL6")); FlexGridSizer9->Add(txtFreq_CLK4, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK4 = new wxCheckBox(this, ID_CHECKBOX13, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX13")); chkInvert_CLK4->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK4, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK5 = new wxStaticText(this, ID_STATICTEXT8, _("CLK5"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT8")); FlexGridSizer9->Add(lblCLK5, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK5 = new wxCheckBox(this, ID_CHECKBOX6, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX6")); chkEN_CLK5->SetValue(true); FlexGridSizer9->Add(chkEN_CLK5, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK5 = new wxTextCtrl(this, ID_TEXTCTRL7, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL7")); FlexGridSizer9->Add(txtFreq_CLK5, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK5 = new wxCheckBox(this, ID_CHECKBOX14, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX14")); chkInvert_CLK5->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK5, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK6 = new wxStaticText(this, ID_STATICTEXT9, _("CLK6"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT9")); FlexGridSizer9->Add(lblCLK6, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK6 = new wxCheckBox(this, ID_CHECKBOX7, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX7")); chkEN_CLK6->SetValue(true); FlexGridSizer9->Add(chkEN_CLK6, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK6 = new wxTextCtrl(this, ID_TEXTCTRL8, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL8")); FlexGridSizer9->Add(txtFreq_CLK6, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK6 = new wxCheckBox(this, ID_CHECKBOX15, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX15")); chkInvert_CLK6->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK6, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); lblCLK7 = new wxStaticText(this, ID_STATICTEXT10, _("CLK7"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT10")); FlexGridSizer9->Add(lblCLK7, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkEN_CLK7 = new wxCheckBox(this, ID_CHECKBOX8, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX8")); chkEN_CLK7->SetValue(true); FlexGridSizer9->Add(chkEN_CLK7, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); txtFreq_CLK7 = new wxTextCtrl(this, ID_TEXTCTRL9, _("27.0"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL9")); FlexGridSizer9->Add(txtFreq_CLK7, 1, wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); chkInvert_CLK7 = new wxCheckBox(this, ID_CHECKBOX16, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHECKBOX16")); chkInvert_CLK7->SetValue(false); FlexGridSizer9->Add(chkInvert_CLK7, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer4->Add(FlexGridSizer9, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); btnConfigure = new wxButton(this, ID_BUTTON3, _("Configure Clocks"), wxDefaultPosition, wxSize(113, 61), 0, wxDefaultValidator, _T("ID_BUTTON3")); FlexGridSizer4->Add(btnConfigure, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(FlexGridSizer4, 1, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5); SetSizer(FlexGridSizer1); FlexGridSizer1->Fit(this); FlexGridSizer1->SetSizeHints(this); Connect(ID_BUTTON2, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&Si5351C_wxgui::OnbtnLoadFileClick); Connect(ID_BUTTON4, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&Si5351C_wxgui::OnbtnResetToDefaultsClick); Connect(ID_BUTTON1, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&Si5351C_wxgui::OnbtnReadStatusClick); Connect(ID_BUTTON5, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&Si5351C_wxgui::OnbtnClearStatusClick); Connect(ID_BUTTON3, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&Si5351C_wxgui::OnbtnConfigureClockClick); }
// Define my frame constructor MyFrame::MyFrame(wxFrame *frame, const wxString& title) : wxFrame(frame, wxID_ANY, title, wxDefaultPosition, wxSize(400, 300)) { #if wxUSE_STATUSBAR CreateStatusBar(); #endif // wxUSE_STATUSBAR // Give it an icon SetIcon(wxICON(mondrian)); // Make a menubar wxMenu *file_menu = new wxMenu; file_menu->Append(wxID_EXIT, _T("&Quit\tCtrl-Q")); wxMenuBar *menu_bar = new wxMenuBar; menu_bar->Append(file_menu, _T("&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 wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL ); wxFlexGridSizer *item2 = new wxFlexGridSizer( 2, 0, 0 ); item2->AddGrowableCol( 1 ); wxButton *item3 = new wxButton( this, ID_START, wxT("Start Server"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item3, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxString strs4[] = { IPC_SERVICE, _T("...") }; wxChoice *item4 = new wxChoice( this, ID_SERVERNAME, wxDefaultPosition, wxSize(100,-1), 2, strs4, 0 ); item2->Add( item4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); wxButton *item5 = new wxButton( this, ID_DISCONNECT, wxT("Disconnect Client"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item2->Add( 20, 20, 0, wxALIGN_CENTER|wxALL, 5 ); wxButton *item6 = new wxButton( this, ID_ADVISE, wxT("Advise"), wxDefaultPosition, wxDefaultSize, 0 ); item2->Add( item6, 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 *item8 = new wxStaticBox( this, -1, wxT("Server log") ); wxStaticBoxSizer *item7 = new wxStaticBoxSizer( item8, wxVERTICAL ); wxTextCtrl *item9 = new wxTextCtrl( this, ID_LOG, wxT(""), wxDefaultPosition, wxSize(500,140), wxTE_MULTILINE ); item7->Add( item9, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); item0->Add( item7, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); SetSizer( item0 ); item0->SetSizeHints( this ); // status m_server = NULL; GetServername()->SetSelection(0); wxLogTextCtrl *logWindow = new wxLogTextCtrl(GetLog()); delete wxLog::SetActiveTarget(logWindow); wxLogMessage(_T("Click on Start to start the server")); Enable(); }
CCTestFrame::CCTestFrame(const wxString& main_file) : m_ProgDlg(NULL), m_MainFile(main_file), m_CurrentFile(), m_LogCount(0), m_FRDlg(NULL) { //(*Initialize(CCTestFrame) wxMenuItem* mnu_itm_save_log; wxMenuItem* mnu_item_find; wxBoxSizer* bsz_parser; wxBoxSizer* bszParserInput; wxBoxSizer* bsz_search_tree; wxPanel* panParserInput; wxPanel* panParserOutput; wxBoxSizer* bszParserSearchTree; wxBoxSizer* bszParserOutput; wxMenu* mnu_help; wxStaticText* lbl_include; wxMenuItem* mnu_itm_quit; wxBoxSizer* bsz_headers; wxButton* btnParse; wxBoxSizer* bsz_include; wxBoxSizer* bsz_misc; wxMenuItem* mnu_item_about; wxMenuBar* mnu_main; wxMenuItem* mnu_item_token; wxMenu* mnu_search; wxPanel* panParserSearchTree; wxMenuItem* mnu_itm_open; wxMenu* mnu_file; wxMenuItem* mnu_itm_reparse; wxBoxSizer* bsz_main; Create(0, wxID_ANY, _("CC Testing"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY")); SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR)); bsz_main = new wxBoxSizer(wxVERTICAL); bsz_misc = new wxBoxSizer(wxVERTICAL); bsz_include = new wxBoxSizer(wxVERTICAL); lbl_include = new wxStaticText(this, wxID_ANY, _("Add include directories to search for files here (one directory per line):"), wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY")); bsz_include->Add(lbl_include, 0, wxBOTTOM|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); m_IncludeCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, wxDefaultValidator, _T("wxID_ANY")); m_IncludeCtrl->SetMinSize(wxSize(-1,60)); bsz_include->Add(m_IncludeCtrl, 0, wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); bsz_misc->Add(bsz_include, 0, wxBOTTOM|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); bsz_headers = new wxBoxSizer(wxVERTICAL); m_DoHeadersCtrl = new wxCheckBox(this, ID_CHK_DO_HEADERS, _("Parse the following priority files/headers first (colon separated):"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHK_DO_HEADERS")); m_DoHeadersCtrl->SetValue(false); bsz_headers->Add(m_DoHeadersCtrl, 0, wxBOTTOM|wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); m_HeadersCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_ANY")); m_HeadersCtrl->Disable(); bsz_headers->Add(m_HeadersCtrl, 0, wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); bsz_misc->Add(bsz_headers, 0, wxEXPAND|wxALIGN_LEFT|wxALIGN_BOTTOM, 5); bsz_main->Add(bsz_misc, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); bsz_search_tree = new wxBoxSizer(wxHORIZONTAL); m_DoTreeCtrl = new wxCheckBox(this, wxID_ANY, _("Enable creation of parser\'s internal search tree (might get HUGE!!!)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_ANY")); m_DoTreeCtrl->SetValue(false); bsz_search_tree->Add(m_DoTreeCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); m_DoHideCtrl = new wxCheckBox(this, ID_CHK_HIDE, _("Hide frame"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_CHK_HIDE")); m_DoHideCtrl->SetValue(true); bsz_search_tree->Add(m_DoHideCtrl, 0, wxLEFT|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); bsz_search_tree->Add(-1,-1,1, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); btnParse = new wxButton(this, wxID_ANY, _("Parse"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("wxID_ANY")); bsz_search_tree->Add(btnParse, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); bsz_main->Add(bsz_search_tree, 0, wxTOP|wxLEFT|wxRIGHT|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); bsz_parser = new wxBoxSizer(wxVERTICAL); m_ParserCtrl = new wxNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, _T("wxID_ANY")); panParserInput = new wxPanel(m_ParserCtrl, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("wxID_ANY")); bszParserInput = new wxBoxSizer(wxVERTICAL); m_Control = new wxScintilla(panParserInput,wxID_ANY,wxDefaultPosition,wxDefaultSize); bszParserInput->Add(m_Control, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); panParserInput->SetSizer(bszParserInput); bszParserInput->Fit(panParserInput); bszParserInput->SetSizeHints(panParserInput); panParserOutput = new wxPanel(m_ParserCtrl, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("wxID_ANY")); bszParserOutput = new wxBoxSizer(wxVERTICAL); m_LogCtrl = new wxTextCtrl(panParserOutput, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH2|wxHSCROLL, wxDefaultValidator, _T("wxID_ANY")); m_LogCtrl->SetMinSize(wxSize(640,250)); bszParserOutput->Add(m_LogCtrl, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); panParserOutput->SetSizer(bszParserOutput); bszParserOutput->Fit(panParserOutput); bszParserOutput->SetSizeHints(panParserOutput); panParserSearchTree = new wxPanel(m_ParserCtrl, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("wxID_ANY")); bszParserSearchTree = new wxBoxSizer(wxVERTICAL); m_TreeCtrl = new wxTextCtrl(panParserSearchTree, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH2|wxHSCROLL, wxDefaultValidator, _T("wxID_ANY")); m_TreeCtrl->SetMinSize(wxSize(640,150)); bszParserSearchTree->Add(m_TreeCtrl, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); panParserSearchTree->SetSizer(bszParserSearchTree); bszParserSearchTree->Fit(panParserSearchTree); bszParserSearchTree->SetSizeHints(panParserSearchTree); m_ParserCtrl->AddPage(panParserInput, _("Parser input"), true); m_ParserCtrl->AddPage(panParserOutput, _("Parser output"), false); m_ParserCtrl->AddPage(panParserSearchTree, _("Parser search tree"), false); bsz_parser->Add(m_ParserCtrl, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); bsz_main->Add(bsz_parser, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); SetSizer(bsz_main); mnu_main = new wxMenuBar(); mnu_file = new wxMenu(); mnu_itm_open = new wxMenuItem(mnu_file, wxID_OPEN, _("&Open...\tCtrl+O"), _("Open the source code to be tested"), wxITEM_NORMAL); mnu_file->Append(mnu_itm_open); mnu_itm_reparse = new wxMenuItem(mnu_file, wxID_REFRESH, _("&Re-parse\tF5"), _("Re-parse test file / buffer"), wxITEM_NORMAL); mnu_file->Append(mnu_itm_reparse); mnu_file->AppendSeparator(); mnu_itm_save_log = new wxMenuItem(mnu_file, wxID_SAVE, _("&Save Log...\tCtrl+S"), _("Save log file to hard disk "), wxITEM_NORMAL); mnu_file->Append(mnu_itm_save_log); mnu_file->AppendSeparator(); mnu_itm_quit = new wxMenuItem(mnu_file, wxID_EXIT, _("&Quit\tCtrl+Q"), wxEmptyString, wxITEM_NORMAL); mnu_file->Append(mnu_itm_quit); mnu_main->Append(mnu_file, _("&File")); mnu_search = new wxMenu(); mnu_item_find = new wxMenuItem(mnu_search, wxID_FIND, _("&Find...\tCtrl+F"), _("Find keyword"), wxITEM_NORMAL); mnu_search->Append(mnu_item_find); mnu_item_token = new wxMenuItem(mnu_search, wxID_TOKEN, _("&Token...\tCtrl+T"), _("Find token"), wxITEM_NORMAL); mnu_search->Append(mnu_item_token); mnu_main->Append(mnu_search, _("&Search")); mnu_help = new wxMenu(); mnu_item_about = new wxMenuItem(mnu_help, wxID_ABOUT, _("&About"), wxEmptyString, wxITEM_NORMAL); mnu_help->Append(mnu_item_about); mnu_main->Append(mnu_help, _("&Help")); SetMenuBar(mnu_main); m_StatuBar = new wxStatusBar(this, wxID_ANY, 0, _T("wxID_ANY")); int __wxStatusBarWidths_1[1] = { -10 }; int __wxStatusBarStyles_1[1] = { wxSB_NORMAL }; m_StatuBar->SetFieldsCount(1,__wxStatusBarWidths_1); m_StatuBar->SetStatusStyles(1,__wxStatusBarStyles_1); SetStatusBar(m_StatuBar); m_OpenFile = new wxFileDialog(this, _("Select Test Source File"), _("."), wxEmptyString, _("*.cpp;*.h"), wxFD_DEFAULT_STYLE, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog")); m_SaveFile = new wxFileDialog(this, _("Select file"), _("."), _("log.txt"), _("*.txt"), wxFD_DEFAULT_STYLE|wxFD_SAVE, wxDefaultPosition, wxDefaultSize, _T("wxFileDialog")); bsz_main->Fit(this); bsz_main->SetSizeHints(this); Center(); Connect(ID_CHK_DO_HEADERS,wxEVT_COMMAND_CHECKBOX_CLICKED,(wxObjectEventFunction)&CCTestFrame::OnDoHeadersClick); Connect(wxID_ANY,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&CCTestFrame::OnParse); Connect(wxID_OPEN,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuOpenSelected); Connect(wxID_REFRESH,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuReparseSelected); Connect(wxID_SAVE,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuSaveSelected); Connect(wxID_EXIT,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuQuitSelected); Connect(wxID_FIND,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuFindSelected); Connect(wxID_TOKEN,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuTokenSelected); Connect(wxID_ABOUT,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&CCTestFrame::OnMenuAboutSelected); //*) //Setting the macro replacements CCTest::Get()->Init(); // TODO: Make this base folders configurable wxString wx_base (_T("C:\\Devel\\wxWidgets\\")); wxString gcc_base(_T("C:\\Devel\\GCC47TDM\\" )); m_IncludeCtrl->SetValue(wx_base + _T("include") + _T("\n") + wx_base + _T("lib\\gcc_dll\\mswu") + _T("\n") + gcc_base + _T("lib\\gcc\\mingw32\\4.7.1\\include\\c++") + _T("\n") + gcc_base + _T("lib\\gcc\\mingw32\\4.7.1\\include\\c++\\mingw32") + _T("\n") + gcc_base + _T("lib\\gcc\\mingw32\\4.7.1\\include\\c++\\backward") + _T("\n") + gcc_base + _T("lib\\gcc\\mingw32\\4.7.1\\include") + _T("\n") + gcc_base + _T("include") + _T("\n") + gcc_base + _T("lib\\gcc\\mingw32\\4.7.1\\include-fixed") + _T("\n")); m_HeadersCtrl->SetValue(_T("<_mingw.h>,<cstddef>,<w32api.h>,<winbase.h>,<wx/defs.h>,<wx/dlimpexp.h>,<wx/toplevel.h>,<boost/config.hpp>,<boost/filesystem/config.hpp>,\"pch.h\",\"sdk.h\",\"stdafx.h\"")); CCLogger::Get()->Init(this, idCCLogger, idCCLogger, idCCAddToken); m_StatuBar->SetStatusText(_("Ready!")); InitControl(); LoadToControl(); }
bool wxComboBox::Create( wxWindow* pParent , wxWindowID vId , const wxString& rsValue , const wxPoint& rPos , const wxSize& rSize , int n , const wxString asChoices[] , long lStyle , const wxValidator& rValidator , const wxString& rsName ) { m_isShown = false; if (!CreateControl( pParent ,vId ,rPos ,rSize ,lStyle ,rValidator ,rsName )) return false; // // Get the right style // long lSstyle = 0L; lSstyle = WS_TABSTOP | WS_VISIBLE; if (lStyle & wxCLIP_SIBLINGS ) lSstyle |= WS_CLIPSIBLINGS; if (lStyle & wxCB_READONLY) lSstyle |= CBS_DROPDOWNLIST; else if (lStyle & wxCB_SIMPLE) lSstyle |= CBS_SIMPLE; // A list (shown always) and edit control else lSstyle |= CBS_DROPDOWN; if (!OS2CreateControl( _T("COMBOBOX") ,lSstyle )) return false; // // A choice/combobox normally has a white background (or other, depending // on global settings) rather than inheriting the parent's background colour. // SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetFont(*wxSMALL_FONT); int i; for (i = 0; i < n; i++) { Append(asChoices[i]); } SetSize( rPos.x ,rPos.y ,rSize.x ,rSize.y ); if (!rsValue.empty()) { SetValue(rsValue); } gfnWndprocEdit = (WXFARPROC)::WinSubclassWindow( (HWND)GetHwnd() ,(PFNWP)wxComboEditWndProc ); ::WinSetWindowULong(GetHwnd(), QWL_USER, (ULONG)this); Show(true); return true; } // end of wxComboBox::Create
void about::Update() { wxColour cb = GetGlobalColor( _T("DILG1") ); SetBackgroundColour(cb); wxColour cf = GetGlobalColor( _T( "UINFD" ) ); // or UINFF SetForegroundColour( cf ); itemPanelAbout->SetBackgroundColour(cb); itemPanelAuthors->SetBackgroundColour(cb); itemPanelLicense->SetBackgroundColour(cb); itemPanelTips->SetBackgroundColour(cb); pAboutTextCtl->SetBackgroundColour(cb); pAuthorTextCtl->SetBackgroundColour(cb); pLicenseTextCtl->SetBackgroundColour(cb); itemPanelAbout->SetForegroundColour(cf); itemPanelAuthors->SetForegroundColour(cf); itemPanelLicense->SetForegroundColour(cf); itemPanelTips->SetForegroundColour(cf); pAboutTextCtl->SetForegroundColour(cf); pAuthorTextCtl->SetForegroundColour(cf); pLicenseTextCtl->SetForegroundColour(cf); wxTextAttr ta(cf, cb); pAboutTextCtl->SetDefaultStyle(ta); pAboutTextCtl->Clear(); wxString *pAboutString = new wxString(AboutText, wxConvUTF8); pAboutString->Append(OpenCPNVersion); //Gunther pAboutString->Append(wxString(OpenCPNInfo, wxConvUTF8)); pAboutTextCtl->WriteText(*pAboutString); delete pAboutString; // Show the user where the log file is going to be wxString log = _T("\n Logfile location: "); log.Append(*pHome_Locn); log.Append(_T("opencpn.log")); pAboutTextCtl->WriteText(log); pAuthorTextCtl->SetDefaultStyle(ta); pAuthorTextCtl->Clear(); wxString *pAuthorsString = new wxString(AuthorText, wxConvUTF8); pAuthorTextCtl->WriteText(*pAuthorsString); delete pAuthorsString; pLicenseTextCtl->SetDefaultStyle(ta); pLicenseTextCtl->Clear(); wxString license_loc(*m_pDataLocn); license_loc.Append(_T("license.txt")); wxTextFile license_file(license_loc); if(license_file.Open()) { wxString str; str = license_file.GetFirstLine(); pLicenseTextCtl->WriteText(str); while (!license_file.Eof()) { str = license_file.GetNextLine(); str.Append(_T("\n")); pLicenseTextCtl->AppendText(str); } license_file.Close(); } else { wxString msg(_T("Could not open License file: ")); msg.Append(license_loc); wxLogMessage(msg); } pLicenseTextCtl->SetInsertionPoint(0); }
// ---------------------------------------------------------------------------- void BrowseSelector::Create(wxWindow* parent, BrowseTracker* pBrowseTracker, bool bDirection) // ---------------------------------------------------------------------------- { m_pBrowseTracker = pBrowseTracker; m_bDirection = bDirection; long style = wxWANTS_CHARS; if( !wxScrollingDialog::Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, style) ) return; wxBoxSizer *sz = new wxBoxSizer( wxVERTICAL ); SetSizer( sz ); long flags = wxLB_SINGLE | wxNO_BORDER | wxWANTS_CHARS; m_listBox = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(400, 150), 0, NULL, flags); static int panelHeight = 0; if( panelHeight == 0 ) { wxMemoryDC mem_dc; // bitmap must be set before it can be used for anything wxBitmap bmp(10, 10); mem_dc.SelectObject(bmp); wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); font.SetWeight( wxFONTWEIGHT_BOLD ); mem_dc.SetFont(font); int w; mem_dc.GetTextExtent(wxT("Tp"), &w, &panelHeight); panelHeight += 4; // Place a spacer of 2 pixels font.SetWeight( wxFONTWEIGHT_NORMAL ); mem_dc.SetFont(font); // Out signpost bitmap is 24 pixels if( panelHeight < 24 ) panelHeight = 24; } m_panel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize(800, panelHeight)); // above panel/banner with set to 800, to allow it to grow sz->Add( m_panel ); sz->Add( m_listBox, 1, wxEXPAND ); SetSizer( sz ); // Connect events to the list box m_listBox->Connect(wxID_ANY, wxEVT_KEY_UP, wxKeyEventHandler(BrowseSelector::OnKeyUp), NULL, this); m_listBox->Connect(wxID_ANY, wxEVT_CHAR, wxKeyEventHandler(BrowseSelector::OnNavigationKey), NULL, this); m_listBox->Connect(wxID_ANY, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, wxCommandEventHandler(BrowseSelector::OnItemSelected), NULL, this); ////m_listBox->Connect(wxID_ANY, wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(BrowseSelector::OnNavigationKey), NULL, this); // Connect paint event to the panel m_panel->Connect(wxID_ANY, wxEVT_PAINT, wxPaintEventHandler(BrowseSelector::OnPanelPaint), NULL, this); m_panel->Connect(wxID_ANY, wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(BrowseSelector::OnPanelEraseBg), NULL, this); SetBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE) ); m_listBox->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); int logfontsize = Manager::Get()->GetConfigManager(_T("message_manager"))->ReadInt(_T("/log_font_size"), 10); wxFont cbFont = Manager::Get()->GetAppWindow()->GetFont(); cbFont.SetPointSize( logfontsize); //cbFont.SetWeight( wxFONTWEIGHT_BOLD ); // Try using font settings from user editor choices wxString fontstring = Manager::Get()->GetConfigManager(_T("editor"))->Read(_T("/font"), wxEmptyString); if (!fontstring.IsEmpty()) { wxNativeFontInfo nfi; nfi.FromString(fontstring); cbFont.SetNativeFontInfo(nfi); } m_listBox->SetFont(cbFont); // Create the bitmap, only once if( !m_bmp.Ok() ) { wxImage img(signpost_xpm); img.SetAlpha(signpost_alpha, true); m_bmp = wxBitmap(img); } m_listBox->SetFocus(); }
void CSlideShowPanel::AdvanceSlideShow(bool changeSlide, bool reload) { double xRatio, yRatio, ratio; unsigned int i; wxString s; TaskSelectionData* selData = ((CSimpleTaskPanel*)GetParent())->GetTaskSelectionData(); if (selData == NULL) return; if (reload) { m_bCurrentSlideIsDefault = false; selData->lastSlideShown = -1; } int numSlides = (int)selData->slideShowFileNames.size(); #if TESTALLDESCRIPTIONS // For testing numSlides = 0; #endif if (numSlides <= 0) { #if HIDEDEFAULTSLIDE if (!reload) { return; } wxRect r = GetRect(); wxBitmap backgroundBitmap = ((CSimpleTaskPanel*)GetParent())->GetBackgroundBmp().GetSubBitmap(r); wxWindowDC dc(this); dc.DrawBitmap(backgroundBitmap, 0, 0); // Force redraws if text unchanged; hide all if not in all-projects list m_institution->Show(false); m_scienceArea->Show(false); m_description->Show(false); Enable( false ); if (!m_bGotAllProjectsList) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxASSERT(pDoc); pDoc->rpc.get_all_projects_list(m_AllProjectsList); m_bGotAllProjectsList = true; } for (i=0; i<m_AllProjectsList.projects.size(); i++) { if (!strcmp(m_AllProjectsList.projects[i]->url.c_str(), selData->project_url)) { s = wxString(m_AllProjectsList.projects[i]->home.c_str(), wxConvUTF8); m_institution->SetLabel(wxGetTranslation(s)); s = wxString(m_AllProjectsList.projects[i]->specific_area.c_str(), wxConvUTF8); m_scienceArea->SetLabel(wxGetTranslation(s)); s = wxString(m_AllProjectsList.projects[i]->description.c_str(), wxConvUTF8); m_description->SetValue(wxGetTranslation(s)); m_institution->Show(true); m_scienceArea->Show(true); m_description->Show(true); Enable( true ); m_description->Enable(); this->Layout(); break; } } return; #else // HIDEDEFAULTSLIDE SetBackgroundColour(*wxBLACK); if (m_bCurrentSlideIsDefault) return; CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); m_SlideBitmap = *pSkinSimple->GetWorkunitAnimationImage()->GetBitmap(); if (m_SlideBitmap.Ok()) { m_bCurrentSlideIsDefault = true; } #endif // HIDEDEFAULTSLIDE } else { #if HIDEDEFAULTSLIDE m_institution->Show(false); m_scienceArea->Show(false); m_description->Show(false); Enable( false ); #endif // HIDEDEFAULTSLIDE // TODO: Should we allow slide show to advance if task is not running? int newSlide = selData->lastSlideShown; if (selData->dotColor == runningIcon) { // Advance only if running if (changeSlide) { if (++newSlide >= numSlides) { newSlide = 0; } } } if (newSlide < 0) { newSlide = 0; } if (selData->lastSlideShown != newSlide) { // Don't update if only one slide selData->lastSlideShown = newSlide; wxBitmap *bm = new wxBitmap(); bm->LoadFile(selData->slideShowFileNames[newSlide], wxBITMAP_TYPE_ANY); if (bm->Ok()) { m_SlideBitmap = *bm; delete bm; m_bCurrentSlideIsDefault = false; } } } if (m_SlideBitmap.Ok()) { // Check to see if they need to be rescaled to fit in the window ratio = 1.0; xRatio = ((double) GetSize().GetWidth() - (2*SLIDESHOWBORDER))/((double) m_SlideBitmap.GetWidth()); yRatio = ((double) GetSize().GetHeight() - (2*SLIDESHOWBORDER))/((double) m_SlideBitmap.GetHeight()); if ( xRatio < ratio ) { ratio = xRatio; } if ( yRatio < ratio ) { ratio = yRatio; } if ( ratio < 1.0 ) { wxImage img = m_SlideBitmap.ConvertToImage(); img.Rescale((int) (m_SlideBitmap.GetWidth()*ratio), (int) (m_SlideBitmap.GetHeight()*ratio)); wxBitmap *bm = new wxBitmap(img); m_SlideBitmap = *bm; delete bm; } Refresh(); } }
void TEMPLATE_WIDGET::Unselect() { SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); selected = false; Refresh(); }
void wxDialog::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event)) { SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); Refresh(); }
UninstallForm::UninstallForm(wxWindow* parent, gcRefPtr<UserCore::UserI> user) : wxFrame(parent, wxID_ANY, PRODUCT_NAME_CATW(L" UnInstaller"), wxDefaultPosition, wxSize(500, 330), wxCAPTION | wxMINIMIZE_BOX | wxSYSTEM_MENU | wxTAB_TRAVERSAL) { m_pUser = user; wxPanel* pTitlePanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( -1,57 ), wxTAB_TRAVERSAL ); pTitlePanel->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) ); m_labTitle = new wxStaticText(pTitlePanel, wxID_ANY, Managers::GetString(L"#DUN_UNINSTALL_HEADER"), wxDefaultPosition, wxDefaultSize, 0 ); m_labTitleInfo = new wxStaticText(pTitlePanel, wxID_ANY, Managers::GetString(L"#DUN_UNINSTALL_SUBHEADER"), wxDefaultPosition, wxDefaultSize, 0 ); m_imgLogo = new wxStaticBitmap(this, wxID_ANY, wxBitmap(wxT("IDI_HEADER"), wxBITMAP_TYPE_RESOURCE ), wxDefaultPosition, wxSize( 150,57 ), 0 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_butRepair = new wxButton( this, wxID_ANY, Managers::GetString(L"#DUN_REPAIR"), wxDefaultPosition, wxDefaultSize, 0 ); m_butUninstall = new wxButton( this, wxID_ANY, Managers::GetString(L"#DUN_UNINSTALL"), wxDefaultPosition, wxDefaultSize, 0 ); m_butCancel = new wxButton( this, wxID_ANY, Managers::GetString(L"#CANCEL"), wxDefaultPosition, wxDefaultSize, 0 ); wxFont font = m_labTitle->GetFont(); font.SetWeight(wxFONTWEIGHT_BOLD); m_labTitle->SetFont(font); m_pContent = new UDFSettingsPanel(this); m_bContentSizer = new wxBoxSizer( wxHORIZONTAL ); m_bContentSizer->Add(m_pContent, 1, wxEXPAND, 5); wxBoxSizer* bSizer1 = new wxBoxSizer( wxHORIZONTAL ); bSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); bSizer1->Add( m_butRepair, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); bSizer1->Add( m_butUninstall, 0, wxTOP|wxBOTTOM|wxLEFT, 5 ); bSizer1->Add( m_butCancel, 0, wxALL, 5 ); wxFlexGridSizer* fgSizer2 = new wxFlexGridSizer( 2, 2, 0, 0 ); fgSizer2->SetFlexibleDirection( wxBOTH ); fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer2->Add( 10, 0, 1, wxEXPAND, 5 ); fgSizer2->Add( m_labTitle, 0, wxALL, 5 ); fgSizer2->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizer2->Add( m_labTitleInfo, 0, wxLEFT, 15 ); pTitlePanel->SetSizer( fgSizer2 ); pTitlePanel->Layout(); wxFlexGridSizer* fgSizer3 = new wxFlexGridSizer( 1, 2, 0, 0 ); fgSizer3->AddGrowableCol( 0 ); fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer3->Add( pTitlePanel, 1, wxEXPAND, 5 ); fgSizer3->Add( m_imgLogo, 0, 0, 5 ); wxFlexGridSizer* fgSizer1; fgSizer1 = new wxFlexGridSizer( 5, 1, 0, 0 ); fgSizer1->AddGrowableCol( 0 ); fgSizer1->AddGrowableRow( 2 ); fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer1->Add( fgSizer3, 1, wxEXPAND, 5 ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizer1->Add( m_bContentSizer, 1, wxEXPAND|wxLEFT|wxRIGHT, 10 ); fgSizer1->Add( m_staticline1, 1, wxEXPAND, 5 ); fgSizer1->Add( bSizer1, 1, wxEXPAND, 5 ); SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_3DLIGHT ) ); this->SetSizer( fgSizer1 ); this->Layout(); this->Centre( wxBOTH ); SetIcon(wxIcon(wxICON(IDI_ICONNORMAL))); Bind(wxEVT_COMMAND_BUTTON_CLICKED, &UninstallForm::onButtonClicked, this); Bind(wxEVT_CLOSE_WINDOW, &UninstallForm::onCloseWindow, this); }
// Define a constructor for my canvas MyCanvas::MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size) : wxScrolledWindow(parent, wxID_ANY, pos, size, wxSUNKEN_BORDER | wxNO_FULL_REPAINT_ON_RESIZE) { SetBackgroundColour(* wxWHITE); }
ComparisonTableView::ComparisonTableView() : wxFrame(NULL, wxID_ANY, "Ferret: Table of comparisons", wxDefaultPosition, wxSize (650, 610)) { CentreOnScreen (); CreateStatusBar(4); int widths [] = {-2, -1, -1, -1}; SetStatusWidths (4, widths); SetStatusText("Welcome to Ferret", 0); SetStatusText("Documents: ", 1); SetStatusText("Pairs: ", 2); SetStatusText("Mean: ", 3); // set up internal widgets wxBoxSizer * topsizer = new wxBoxSizer (wxHORIZONTAL); // 1. comparison table wxPanel * docResemblanceView = new wxPanel (this, wxID_ANY); wxBoxSizer * resemblanceSizer = new wxBoxSizer (wxVERTICAL); docResemblanceView->SetSizer (resemblanceSizer); _resemblanceObserver = new DocumentListCtrl (this, docResemblanceView); resemblanceSizer->Add (_resemblanceObserver, 1, wxGROW); // -- insert three columns wxListItem itemCol; itemCol.SetText ("Document 1"); _resemblanceObserver->InsertColumn (0, itemCol); _resemblanceObserver->SetColumnWidth (0, wxLIST_AUTOSIZE_USEHEADER); itemCol.SetText ("Document 2"); _resemblanceObserver->InsertColumn (1, itemCol); _resemblanceObserver->SetColumnWidth (1, wxLIST_AUTOSIZE_USEHEADER); itemCol.SetText ("Similarity"); _resemblanceObserver->InsertColumn (2, itemCol); _resemblanceObserver->SetColumnWidth (2, wxLIST_AUTOSIZE_USEHEADER); // 2. buttons // -- note, buttons must be defined before their staticboxsizer, // else tooltips do not display wxBoxSizer * buttonSizer = new wxBoxSizer (wxVERTICAL); buttonSizer->Add (MakeButton (this, ID_SAVE_REPORT, "Save Report ...", "Save the table of comparisons and other details"), 0, wxGROW | wxALL, 5); buttonSizer->Add (MakeButton (this, ID_UNIQUE_VIEW, "Show Uniqueness", "Show number of unique trigrams per document or group"), 0, wxGROW | wxALL, 5); buttonSizer->Add (MakeButton (this, ID_ENGAGEMENT_VIEW, "Show Engagement", "Show overlap with template material per document or group"), 0, wxGROW | wxALL, 5); wxButton * rank_1 = MakeButton (this, ID_RANK_1, "Document 1", "Put table into alphabetical order of first document"); wxButton * rank_2 = MakeButton (this, ID_RANK_2, "Document 2", "Put table into alphabetical order of second document"); wxButton * rank_r = MakeButton (this, ID_RANK_R, "Similarity", "Put table into order with most similar at top"); wxStaticBoxSizer * rankSizer = new wxStaticBoxSizer (wxVERTICAL, this, "Rearrange table by"); rankSizer->Add (rank_1, 0, wxGROW | wxALL, 5); rankSizer->Add (rank_2, 0, wxGROW | wxALL, 5); rankSizer->Add (rank_r, 0, wxGROW | wxALL, 5); buttonSizer->Add (rankSizer, 0, wxGROW); wxButton * showButton = MakeButton (this, ID_DISPLAY_TEXTS, "Show Analysis", "Show selected documents in a separate window"); wxButton * saveButton = MakeButton (this, ID_CREATE_REPORT, "Save Analysis ...", "Save analysis of the selected documents"); wxStaticBoxSizer * showSizer = new wxStaticBoxSizer (wxVERTICAL, this, "For selected pair"); showSizer->Add (showButton, 0, wxGROW | wxALL, 5); showSizer->Add (saveButton, 0, wxGROW | wxALL, 5); buttonSizer->Add (showSizer, 0, wxGROW); buttonSizer->AddStretchSpacer (); // separate controls buttonSizer->Add (MakeCheckBox (this, ID_REMOVE_COMMON, "Remove Common Trigrams", "Compute similarity only from trigrams for the two documents", false), 0, wxGROW | wxALL, 5); buttonSizer->Add (MakeCheckBox (this, ID_IGNORE_TEMPLATE, "Ignore Template Material", "Compute similarity but ignore any trigrams in template material", false), 0, wxGROW | wxALL, 5); buttonSizer->Add (MakeCheckBox (this, ID_SHOW_SHORT, "Show Short Names", "Uncheck to show full pathnames in table", true), 0, wxGROW | wxALL, 5); buttonSizer->AddStretchSpacer (); // separate window controls from Ferret controls buttonSizer->Add (new wxButton (this, wxID_HELP), 0, wxGROW | wxALL, 5); buttonSizer->Add (new wxButton (this, wxID_EXIT), 0, wxGROW | wxALL, 5); topsizer->Add (buttonSizer, 0, wxGROW | wxALL, 5); topsizer->Insert (0, docResemblanceView, 1, wxGROW); // compute best minimum height, and constrain window int best_height = buttonSizer->GetMinSize().GetHeight () + 40; // allow for space between widgets SetSizeHints (best_height, best_height); // keep the minimum size a square shape SetSizer (topsizer); _resemblanceObserver->SetFocus (); // give focus to the list control, to show highlighted item #if __WXMSW__ SetBackgroundColour (wxNullColour); // ensure background coloured #endif }
DriftToolWin::DriftToolWin() : wxFrame(pFrame, wxID_ANY, _("Drift Align"), wxDefaultPosition, wxDefaultSize, wxCAPTION|wxCLOSE_BOX|wxMINIMIZE_BOX|wxSYSTEM_MENU|wxTAB_TRAVERSAL|wxFRAME_FLOAT_ON_PARENT|wxFRAME_NO_TASKBAR), m_need_end_dec_drift(false), m_slewing(false) { SetBackgroundColour(wxColor(0xcccccc)); SetSizeHints(wxDefaultSize, wxDefaultSize); // a vertical sizer holding everything wxBoxSizer *topSizer = new wxBoxSizer(wxVERTICAL); // a horizontal box sizer for the bitmap and the instructions wxBoxSizer *instrSizer = new wxBoxSizer(wxHORIZONTAL); # include "icons/AzArrow.xpm" m_azArrowBmp = new wxBitmap(AzArrow); # include "icons/AltArrow.xpm" m_altArrowBmp = new wxBitmap(AltArrow); m_bmp = new wxStaticBitmap(this, wxID_ANY, *m_azArrowBmp, wxDefaultPosition, wxSize(80, 100)); instrSizer->Add(m_bmp, 0, wxALIGN_CENTER_VERTICAL|wxFIXED_MINSIZE, 5); m_instructions = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(300,90), wxALIGN_LEFT|wxST_NO_AUTORESIZE); #ifdef __WXOSX__ m_instructions->SetFont(*wxSMALL_FONT); #endif m_instructions->Wrap(-1); instrSizer->Add(m_instructions, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); topSizer->Add(instrSizer); // static box sizer holding the scope pointing controls wxStaticBoxSizer *sbSizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Scope Pointing")), wxVERTICAL); // a grid box sizer for laying out scope pointing the controls wxGridBagSizer *gbSizer = new wxGridBagSizer(0, 0); gbSizer->SetFlexibleDirection(wxBOTH); gbSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); wxStaticText *txt; txt = new wxStaticText(this, wxID_ANY, _("Meridian Offset (deg)"), wxDefaultPosition, wxDefaultSize, 0); txt->Wrap(-1); gbSizer->Add(txt, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5); txt = new wxStaticText(this, wxID_ANY, _("Declination (deg)"), wxDefaultPosition, wxDefaultSize, 0); txt->Wrap(-1); gbSizer->Add(txt, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALL, 5); txt = new wxStaticText(this, wxID_ANY, _("Current"), wxDefaultPosition, wxDefaultSize, 0); txt->Wrap(-1); gbSizer->Add(txt, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALL, 5); m_raCurrent = new wxTextCtrl(this, wxID_ANY, _T("--"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); gbSizer->Add(m_raCurrent, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); m_decCurrent = new wxTextCtrl(this, wxID_ANY, _T("--"), wxDefaultPosition, wxDefaultSize, wxTE_READONLY); gbSizer->Add(m_decCurrent, wxGBPosition(1, 2), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); txt = new wxStaticText(this, wxID_ANY, _("Slew To"), wxDefaultPosition, wxDefaultSize, 0); txt->Wrap(-1); gbSizer->Add(txt, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5); m_raSlew = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -90, 90); gbSizer->Add(m_raSlew, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); m_decSlew = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, -90, 90); gbSizer->Add(m_decSlew, wxGBPosition(2, 2), wxGBSpan(1, 1), wxEXPAND | wxALL, 5); m_slew = new wxButton(this, ID_SLEW, _("Slew"), wxDefaultPosition, wxDefaultSize, 0); m_slew->SetToolTip(_("Click to slew to given coordinates.")); gbSizer->Add(m_slew, wxGBPosition(2, 3), wxGBSpan(1, 1), wxALL, 5); wxString label = _("Save"); wxSize sz(GetTextExtent(label)); sz.SetHeight(-1); sz.IncBy(16, 0); m_saveCoords = new wxButton(this, ID_SAVE, label, wxDefaultPosition, sz, 0); m_saveCoords->SetToolTip(_("Click to save these coordinates as the default location for this axis adjustment.")); gbSizer->Add(m_saveCoords, wxGBPosition(2, 4), wxGBSpan(1, 1), wxTOP | wxBOTTOM | wxRIGHT, 5); // add grid bag sizer to static sizer sbSizer->Add(gbSizer, 1, wxALIGN_CENTER, 5); // add static sizer to top-level sizer topSizer->Add(sbSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); // add some padding below the static sizer topSizer->Add(0, 3, 0, wxEXPAND, 3); m_notesLabel = new wxStaticText(this, wxID_ANY, _("Altitude adjustment notes"), wxDefaultPosition, wxDefaultSize, 0); m_notesLabel->Wrap(-1); topSizer->Add(m_notesLabel, 0, wxEXPAND|wxTOP|wxLEFT, 8); m_notes = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(-1, 54), wxTE_MULTILINE); pFrame->RegisterTextCtrl(m_notes); topSizer->Add(m_notes, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5); m_notes->Bind(wxEVT_COMMAND_TEXT_UPDATED, &DriftToolWin::OnNotesText, this); // horizontal sizer for the buttons wxBoxSizer *hSizer = new wxBoxSizer(wxHORIZONTAL); // proportional pad on left of Drift button hSizer->Add(0, 0, 2, wxEXPAND, 5); m_drift = new wxButton(this, ID_DRIFT, _("Drift"), wxDefaultPosition, wxDefaultSize, 0); hSizer->Add(m_drift, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // proportional pad on right of Drift button hSizer->Add(0, 0, 1, wxEXPAND, 5); m_adjust = new wxButton(this, ID_ADJUST, _("Adjust"), wxDefaultPosition, wxDefaultSize, 0); hSizer->Add(m_adjust, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); // proportional pad on right of Align button hSizer->Add(0, 0, 2, wxEXPAND, 5); m_phaseBtn = new wxButton(this, ID_PHASE, wxT("???"), wxDefaultPosition, wxDefaultSize, 0); hSizer->Add(m_phaseBtn, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); // add button sizer to top level sizer topSizer->Add(hSizer, 1, wxEXPAND|wxALL, 5); SetSizer(topSizer); m_statusBar = CreateStatusBar(1, wxST_SIZEGRIP, wxID_ANY); Layout(); topSizer->Fit(this); int xpos = pConfig->Global.GetInt("/DriftTool/pos.x", -1); int ypos = pConfig->Global.GetInt("/DriftTool/pos.y", -1); MyFrame::PlaceWindowOnScreen(this, xpos, ypos); // can mount slew? m_can_slew = pPointingSource && pPointingSource->CanSlew(); // get site lat/long from scope double lat, lon; m_siteLatLong.Invalidate(); if (pPointingSource && !pPointingSource->GetSiteLatLong(&lat, &lon)) { m_siteLatLong.SetXY(lat, lon); } m_timer = NULL; if (m_can_slew || (pPointingSource && pPointingSource->CanReportPosition())) { enum { SCOPE_POS_POLL_MS = 1500 }; m_timer = new wxTimer(this, ID_TIMER); m_timer->Start(SCOPE_POS_POLL_MS, false /* continuous */); } // make sure graph window is showing if (!pFrame->pGraphLog->IsShown()) { wxCommandEvent evt; evt.SetInt(1); // "Checked" pFrame->OnGraph(evt); } // graph must be showing RA/Dec m_save_graph_mode = pFrame->pGraphLog->SetMode(GraphLogClientWindow::MODE_RADEC); // resize graph scale m_save_graph_length = pFrame->pGraphLog->GetLength(); pFrame->pGraphLog->SetLength(pConfig->Global.GetInt("/DriftTool/GraphLength", GraphLogWindow::DefaultMaxLength)); m_save_graph_height = pFrame->pGraphLog->GetHeight(); pFrame->pGraphLog->SetHeight(pConfig->Global.GetInt("/DriftTool/GraphHeight", GraphLogWindow::DefaultMaxHeight)); pFrame->pGraphLog->Refresh(); // we do not want sticky lock position enabled m_save_lock_pos_is_sticky = pFrame->pGuider->LockPosIsSticky(); pFrame->pGuider->SetLockPosIsSticky(false); pFrame->tools_menu->FindItem(EEGG_STICKY_LOCK)->Check(false); m_save_use_subframes = pCamera->UseSubframes; m_phase = PHASE_ADJUST_AZ; m_mode = MODE_IDLE; UpdatePhaseState(); UpdateModeState(); }
void CProjectsComponent::CreateComponent() { Freeze(); CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple(); wxASSERT(pSkinSimple); wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple)); //Set Background color SetBackgroundColour(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor()); //Static content in my Projects section // add project button wxToolTip *ttAddProject = new wxToolTip(_("Volunteer for any or all of 30+ projects in many areas of science")); btnAddProj=new wxBitmapButton( this, ID_WIZARDATTACH, *pSkinSimple->GetAttachProjectButton()->GetBitmap(), wxPoint(214,7), wxSize(81,18), wxBU_AUTODRAW ); if ( pSkinSimple->GetAttachProjectButton()->GetBitmapClicked() != NULL ) { btnAddProj->SetBitmapSelected( *pSkinSimple->GetAttachProjectButton()->GetBitmapClicked() ); } btnAddProj->SetToolTip(ttAddProject); // syncronize button, hidden by default. wxToolTip *ttSynchronize = new wxToolTip(_("Synchronize projects with account manager system")); btnSynchronize=new wxBitmapButton( this, ID_WIZARDUPDATE, *pSkinSimple->GetSynchronizeButton()->GetBitmap(), wxPoint(214,7), wxSize(81,18), wxBU_AUTODRAW ); if ( pSkinSimple->GetSynchronizeButton()->GetBitmapClicked() != NULL ) { btnSynchronize->SetBitmapSelected( *pSkinSimple->GetSynchronizeButton()->GetBitmapClicked() ); } btnSynchronize->SetToolTip(ttSynchronize); btnSynchronize->Show(false); /// Help wxToolTip *ttHelp = new wxToolTip(_("Get help with BOINC")); btnHelp=new wxBitmapButton( this, ID_SIMPLE_HELP, *pSkinSimple->GetHelpButton()->GetBitmap(), wxPoint(300,7), wxSize( (*pSkinSimple->GetHelpButton()->GetBitmap()).GetWidth(), (*pSkinSimple->GetHelpButton()->GetBitmap()).GetHeight() ), wxBU_AUTODRAW ); if ( pSkinSimple->GetHelpButton()->GetBitmapClicked() != NULL ) { btnHelp->SetBitmapSelected( *pSkinSimple->GetHelpButton()->GetBitmapClicked() ); } btnHelp->SetToolTip(ttHelp); /// Line lnMyProjTop = new CTransparentStaticLine(this, wxID_ANY, wxPoint(29,29),wxSize(292,1)); lnMyProjTop->SetLineColor(pSkinSimple->GetStaticLineColor()); //// Arrow Btns btnArwLeft = new wxBitmapButton( this, -1, *pSkinSimple->GetLeftArrowButton()->GetBitmap(), wxPoint(29,47), wxSize(20,20), wxBU_AUTODRAW ); if ( pSkinSimple->GetLeftArrowButton()->GetBitmapClicked() != NULL ) { btnArwLeft->SetBitmapSelected(*pSkinSimple->GetLeftArrowButton()->GetBitmapClicked()); } btnArwLeft->Show(false);//on creation this one is always false btnArwRight = new wxBitmapButton( this, -1, *pSkinSimple->GetRightArrowButton()->GetBitmap(), wxPoint(301,47), wxSize(20,20), wxBU_AUTODRAW ); if ( pSkinSimple->GetRightArrowButton()->GetBitmapClicked() != NULL ) { btnArwRight->SetBitmapSelected(*pSkinSimple->GetRightArrowButton()->GetBitmapClicked()); } btnArwRight->Show(false); // //// Messages Play Pause Btns wxToolTip *ttMessages = new wxToolTip(_("Open a window to view messages")); btnMessages = new CLinkButton( this, ID_SIMPLE_MESSAGES, *pSkinSimple->GetMessagesLink()->GetBitmap(), wxPoint(11,86), wxSize(70,20), wxBU_AUTODRAW ); btnMessages->SetToolTip(ttMessages); wxToolTip *ttAlertMessages = new wxToolTip(_("Open a window to view messages")); btnAlertMessages = new CLinkButton( this, ID_SIMPLE_MESSAGES_ALERT, *(pSkinSimple->GetMessagesAlertLink()->GetBitmap()), wxPoint(11,86), wxSize(70,20), wxBU_AUTODRAW ); btnAlertMessages->SetToolTip(ttAlertMessages); btnAlertMessages->Show(false); //spacer w_sp1 = new wxWindow(this,-1,wxPoint(83,91),wxSize(2,11)); i_spacer1 = new ImageLoader(w_sp1); i_spacer1->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // pause btn wxToolTip *ttPause = new wxToolTip(_("Stop all activity")); btnPause = new CLinkButton( this, ID_SIMPLE_SUSPEND, *pSkinSimple->GetSuspendLink()->GetBitmap(), wxPoint(85,86), wxSize(59,20), wxBU_AUTODRAW ); btnPause->SetToolTip(ttPause); // resume btn wxToolTip *ttResume = new wxToolTip(_("Resume activity")); btnResume = new CLinkButton( this, ID_SIMPLE_RESUME, *(pSkinSimple->GetResumeLink()->GetBitmap()), wxPoint(85,86), wxSize(59,20), wxBU_AUTODRAW ); btnResume->SetToolTip(ttResume); //spacer w_sp2 = new wxWindow(this,-1,wxPoint(144,91),wxSize(2,11)); i_spacer2 = new ImageLoader(w_sp2); i_spacer2->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // Pref Btn wxToolTip *ttPreferences = new wxToolTip(_("Open a window to set your preferences")); btnPreferences = new CLinkButton( this, ID_SIMPLE_PREFERENCES, *(pSkinSimple->GetPreferencesLink()->GetBitmap()), wxPoint(149,86), wxSize(81,20), wxBU_AUTODRAW ); btnPreferences->SetToolTip(ttPreferences); //spacer w_sp3 = new wxWindow(this,-1,wxPoint(230,91),wxSize(2,11)); i_spacer3 = new ImageLoader(w_sp3); i_spacer3->LoadImage(*(pSkinSimple->GetSpacerImage()->GetBitmap())); // Advanced View wxToolTip *ttAdvView = new wxToolTip(_("Switch to the BOINC advanced view")); btnAdvancedView = new CLinkButton( this, ID_CHANGEGUI, *(pSkinSimple->GetAdvancedLink()->GetBitmap()), wxPoint(233,86), wxSize(101,20), wxBU_AUTODRAW ); btnAdvancedView->SetToolTip(ttAdvView); /// Line lnMyProjBtm = new CTransparentStaticLine(this, wxID_ANY, wxPoint(29,83),wxSize(292,1)); lnMyProjBtm->SetLineColor(pSkinSimple->GetStaticLineColor()); Thaw(); }