EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, const wxSize& aSize, GAL_TYPE aGalType ) : wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize ) { m_parent = aParentWindow; m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow ); m_gal = NULL; m_backend = GAL_TYPE_NONE; m_view = NULL; m_painter = NULL; m_eventDispatcher = NULL; m_lostFocus = false; SetLayoutDirection( wxLayout_LeftToRight ); SwitchBackend( aGalType ); SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // Scrollbars broken in GAL on OSX #ifdef __WXMAC__ ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER ); #else ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); #endif EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas m_painter = new KIGFX::PCB_PAINTER( m_gal ); m_view = new KIGFX::VIEW( true ); m_view->SetPainter( m_painter ); m_view->SetGAL( m_gal ); Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this ); Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this ); Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( EDA_DRAW_PANEL_GAL::onLostFocus ), NULL, this ); const wxEventType events[] = { wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK, wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK, wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK, wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) wxEVT_MAGNIFY, #endif KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE }; BOOST_FOREACH( wxEventType eventType, events ) { Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, m_eventDispatcher ); }
bool CTimeBarDataViewCtrl::InitColumn() { ShowScrollbars(wxSHOW_SB_NEVER,wxSHOW_SB_NEVER); AppendTextColumn(_T("Layer"), Col_EditableText, wxDATAVIEW_CELL_EDITABLE, wxCOL_WIDTH_AUTOSIZE); AppendColumn( new wxDataViewColumn(_T("V"), new CTimeBarCheckRenderer(Col_Visible), Col_Visible, COLUMNWIDTH, wxALIGN_CENTER, 0) ); AppendColumn( new wxDataViewColumn(_T("L"), new CTimeBarCheckRenderer(Col_Lock), Col_Lock, COLUMNWIDTH, wxALIGN_CENTER, 0) ); return true; }
/// Creation bool InstanceCtrl::Create(wxWindow* parent, InstanceModel *instList, wxWindowID id, const wxPoint& pos, const wxSize& size, long style) { m_instList = instList; if (!wxScrolledCanvas::Create(parent, id, pos, size, style | wxFULL_REPAINT_ON_RESIZE | wxWANTS_CHARS)) return false; SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); CalculateOverallItemSize(); m_itemsPerRow = CalculateItemsPerRow(); m_intended_column = 0; SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); SetBackgroundStyle(wxBG_STYLE_CUSTOM); DisableKeyboardScrolling(); ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_ALWAYS); // Tell the sizers to use the given or best size SetInitialSize(size); // Create a buffer RecreateBuffer(size); return true; }
FEditPanel::FEditPanel(wxWindow *parent, wxWindowID id) : wxScrolledWindow(parent, id, wxDefaultPosition, wxDefaultSize, wxScrolledWindowStyle | wxBORDER_SIMPLE) { //SetBackgroundColour(0x00000055); wxBoxSizer* pSizer = new wxBoxSizer(wxVERTICAL); m_pNameRef = new FNameRefControl(this, wxID_ANY, wxT("Reference : ")); pSizer->Add(m_pNameRef, 0, wxLEFT|wxRIGHT|wxTOP, 5); m_pRoleControl = new FRoleControlEdit(this, wxID_ANY, wxString(wxT("Roles : "))); pSizer->Add(m_pRoleControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); //m_pDatationControl = new FDatationControl(this, wxID_ANY, wxString(wxT("Datation : "))); //pSizer->Add(m_pDatationControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); m_pLocationControl = new FLocationListControl(this, wxID_ANY, wxString(wxT("Location : ")), wxDefaultPosition, wxDefaultSize, true); pSizer->Add(m_pLocationControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); m_pTagControl = new FTagControlEdit; m_pTagControl->Create(this, wxID_ANY, wxString(wxT("Tags : "))); pSizer->Add(m_pTagControl, 0, wxLEFT|wxRIGHT|wxTOP, 5); pSizer->AddSpacer(5); SetScrollbars(10, 10, 50, 50); ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_DEFAULT); SetSizer(pSizer); SetSizeHints(160 + 10 + 16, wxDefaultCoord); Layout(); }
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ) : wxScrolledWindow( parent, id, pos, size, drawPanelStyle ) { wxASSERT( parent ); ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); DisableKeyboardScrolling(); m_scrollIncrementX = std::min( size.x / 8, 10 ); m_scrollIncrementY = std::min( size.y / 8, 10 ); SetLayoutDirection( wxLayout_LeftToRight ); SetBackgroundColour( parent->GetDrawBgColor().ToColour() ); #if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC SetBackgroundStyle( wxBG_STYLE_CUSTOM ); #endif m_ClipBox.SetSize( size ); m_ClipBox.SetX( 0 ); m_ClipBox.SetY( 0 ); m_canStartBlock = -1; // Command block can start if >= 0 m_abortRequest = false; m_enableMousewheelPan = false; m_enableZoomNoCenter = false; m_enableAutoPan = true; m_ignoreMouseEvents = false; // Be sure a mouse release button event will be ignored when creating the canvas // if the mouse click was not made inside the canvas (can happen sometimes, when // launching a editor from a double click made in another frame) m_ignoreNextLeftButtonRelease = true; m_mouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL; Pgm().CommonSettings()->Read( ENBL_MOUSEWHEEL_PAN_KEY, &m_enableMousewheelPan, false ); Pgm().CommonSettings()->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false ); Pgm().CommonSettings()->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true ); m_requestAutoPan = false; m_enableBlockCommands = false; m_minDragEventCount = 0; #ifdef __WXMAC__ m_defaultCursor = m_currentCursor = wxCURSOR_CROSS; m_showCrossHair = false; #else m_defaultCursor = m_currentCursor = wxCURSOR_ARROW; m_showCrossHair = true; #endif m_cursorLevel = 0; m_PrintIsMirrored = false; m_ClickTimer = (wxTimer*) NULL; m_doubleClickInterval = 250; }
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ) : wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL ) { wxASSERT( parent ); ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); DisableKeyboardScrolling(); m_scrollIncrementX = std::min( size.x / 8, 10 ); m_scrollIncrementY = std::min( size.y / 8, 10 ); SetBackgroundColour( MakeColour( parent->GetDrawBgColor() ) ); #if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC SetBackgroundStyle( wxBG_STYLE_CUSTOM ); #endif m_ClipBox.SetSize( size ); m_ClipBox.SetX( 0 ); m_ClipBox.SetY( 0 ); m_canStartBlock = -1; // Command block can start if >= 0 m_abortRequest = false; m_enableMiddleButtonPan = true; m_enableZoomNoCenter = false; m_panScrollbarLimits = false; m_enableAutoPan = true; m_ignoreMouseEvents = false; m_ignoreNextLeftButtonRelease = false; m_mouseCaptureCallback = NULL; m_endMouseCaptureCallback = NULL; wxConfigBase* cfg = Kiface().KifaceSettings(); if( cfg ) { cfg->Read( ENBL_MIDDLE_BUTT_PAN_KEY, &m_enableMiddleButtonPan, true ); cfg->Read( ENBL_ZOOM_NO_CENTER_KEY, &m_enableZoomNoCenter, false ); cfg->Read( MIDDLE_BUTT_PAN_LIMITED_KEY, &m_panScrollbarLimits, false ); cfg->Read( ENBL_AUTO_PAN_KEY, &m_enableAutoPan, true ); } m_requestAutoPan = false; m_enableBlockCommands = false; m_minDragEventCount = 0; #ifdef __WXMAC__ m_defaultCursor = m_currentCursor = wxCURSOR_CROSS; m_showCrossHair = false; #else m_defaultCursor = m_currentCursor = wxCURSOR_ARROW; m_showCrossHair = true; #endif m_cursorLevel = 0; m_PrintIsMirrored = false; }
EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, const wxSize& aSize, GAL_TYPE aGalType ) : wxScrolledCanvas( aParentWindow, aWindowId, aPosition, aSize ) { m_parent = aParentWindow; m_edaFrame = dynamic_cast<EDA_DRAW_FRAME*>( aParentWindow ); m_gal = NULL; m_backend = GAL_TYPE_NONE; m_view = NULL; m_painter = NULL; m_eventDispatcher = NULL; m_lostFocus = false; SetLayoutDirection( wxLayout_LeftToRight ); SwitchBackend( aGalType ); SetBackgroundStyle( wxBG_STYLE_CUSTOM ); // Scrollbars broken in GAL on OSX #ifdef __WXMAC__ ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER ); #else ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS ); #endif EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas m_painter = new KIGFX::PCB_PAINTER( m_gal ); m_view = new KIGFX::VIEW( true ); m_view->SetPainter( m_painter ); m_view->SetGAL( m_gal ); Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this ); Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this ); Connect( wxEVT_KILL_FOCUS, wxFocusEventHandler( EDA_DRAW_PANEL_GAL::onLostFocus ), NULL, this ); const wxEventType events[] = { wxEVT_LEFT_UP, wxEVT_LEFT_DOWN, wxEVT_LEFT_DCLICK, wxEVT_RIGHT_UP, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_DCLICK, wxEVT_MIDDLE_UP, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_DCLICK, wxEVT_MOTION, wxEVT_MOUSEWHEEL, wxEVT_CHAR, #if wxCHECK_VERSION( 3, 1, 0 ) || defined( USE_OSX_MAGNIFY_EVENT ) wxEVT_MAGNIFY, #endif KIGFX::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE }; for( wxEventType eventType : events ) { Connect( eventType, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, m_eventDispatcher ); } // View controls is the first in the event handler chain, so the Tool Framework operates // on updated viewport data. m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this ); m_pendingRefresh = false; m_drawing = false; m_drawingEnabled = false; // Set up timer that prevents too frequent redraw commands m_refreshTimer.SetOwner( this ); Connect( m_refreshTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); // Set up timer to execute OnShow() method when the window appears on the screen m_onShowTimer.SetOwner( this ); Connect( m_onShowTimer.GetId(), wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onShowTimer ), NULL, this ); m_onShowTimer.Start( 10 ); LoadGalSettings(); }