Пример #1
0
// when the ASM editor is scrolled
void AsmEditor::OnMouseWheel(wxMouseEvent& event)
{
    // if on the y axis
    if( event.GetWheelAxis() == 0 )
        m_delta.y += event.GetWheelRotation();
    else // if on the x axis
        m_delta.x += event.GetWheelRotation();

    // if y's delta is greater than the threshold
    if( (m_delta.y > 0) && (m_delta.y >= event.GetWheelDelta()) )
    {
        ScrollLines(m_delta.y / event.GetWheelDelta() *-1);
        m_delta.y = m_delta.y % event.GetWheelDelta();
    }
    else if( (m_delta.y < 0) && ((m_delta.y*-1) >= event.GetWheelDelta()) )
    {
        ScrollLines(m_delta.y / event.GetWheelDelta() * -1);
        m_delta.y = m_delta.y % event.GetWheelDelta();
    }

    /* As I am unable to test it, this will remain disabled for now.
    if( (m_delta.x != 0) ) {
        ScrollWindow(m_delta.x, 0, NULL);
        m_delta.x = 0;
    }*/
}
Пример #2
0
wxDragResult wxGxTreeView::OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
{
    if(m_HighLightItemId.IsOk())
        SetItemDropHighlight(m_HighLightItemId, false);
    wxPoint pt(x, y);
    int flag = wxTREE_HITTEST_ONITEMINDENT;
    wxTreeItemId ItemId = wxTreeCtrl::HitTest(pt, flag);
    if(ItemId.IsOk())
    {
        wxSize sz = GetClientSize();
        if(DNDSCROLL > y)//scroll up
            ScrollLines(-1);
        else if((sz.GetHeight() - DNDSCROLL) < y)//scroll down
            ScrollLines(1);

        SetItemDropHighlight(ItemId);
        m_HighLightItemId = ItemId;

	    wxGxTreeItemData* pData = (wxGxTreeItemData*)GetItemData(ItemId);
	    if(pData == NULL)
		    return wxDragNone;
        //check drop capability
        
        wxGxObject* pGxObject = m_pCatalog->GetRegisterObject(pData->m_nObjectID);
        IGxDropTarget* pTarget = dynamic_cast<IGxDropTarget*>(pGxObject);
        if(pTarget == NULL)
		    return wxDragNone;
        return pTarget->CanDrop(def);
    }
    return def;
}
Пример #3
0
void wxRibbonGallery::OnMouseUp(wxMouseEvent& evt)
{
    if(m_mouse_active_rect != NULL)
    {
        wxPoint pos = evt.GetPosition();
        if(m_active_item)
        {
            if(m_art && m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL)
                pos.x += m_scroll_amount;
            else
                pos.y += m_scroll_amount;
        }
        if(m_mouse_active_rect->Contains(pos))
        {
            if(m_mouse_active_rect == &m_scroll_up_button_rect)
            {
                m_up_button_state = wxRIBBON_GALLERY_BUTTON_HOVERED;
                ScrollLines(-1);
            }
            else if(m_mouse_active_rect == &m_scroll_down_button_rect)
            {
                m_down_button_state = wxRIBBON_GALLERY_BUTTON_HOVERED;
                ScrollLines(1);
            }
            else if(m_mouse_active_rect == &m_extension_button_rect)
            {
                m_extension_button_state = wxRIBBON_GALLERY_BUTTON_HOVERED;
                wxCommandEvent notification(wxEVT_BUTTON,
                    GetId());
                notification.SetEventObject(this);
                ProcessWindowEvent(notification);
            }
            else if(m_active_item != NULL)
            {
                if(m_selected_item != m_active_item)
                {
                    m_selected_item = m_active_item;
                    wxRibbonGalleryEvent notification(
                        wxEVT_RIBBONGALLERY_SELECTED, GetId());
                    notification.SetEventObject(this);
                    notification.SetGallery(this);
                    notification.SetGalleryItem(m_selected_item);
                    ProcessWindowEvent(notification);
                }

                wxRibbonGalleryEvent notification(
                    wxEVT_RIBBONGALLERY_CLICKED, GetId());
                notification.SetEventObject(this);
                notification.SetGallery(this);
                notification.SetGalleryItem(m_selected_item);
                ProcessWindowEvent(notification);
            }
        }
        m_mouse_active_rect = NULL;
        m_active_item = NULL;
        Refresh(false);
    }
}
Пример #4
0
void wxVideoTerminal::OnMouseWheel(wxMouseEvent &evt)
{
	if (evt.GetWheelRotation() < 0)
		ScrollLines(4);
	else
		ScrollLines(-4);

	//wxLogDebug("Wheel: %d/%d", evt.GetWheelRotation(), evt.GetWheelDelta());
}
Пример #5
0
void wxRibbonGallery::EnsureVisible(const wxRibbonGalleryItem* item)
{
    if(item == NULL || !item->IsVisible() || IsEmpty())
        return;

    int y = item->GetPosition().GetTop();
    int base_y = m_items.Item(0)->GetPosition().GetTop();
    int delta = y - base_y - m_scroll_amount;
    ScrollLines(delta / m_bitmap_padded_size.GetHeight());
}
Пример #6
0
void wxRibbonGallery::EnsureVisible(const wxRibbonGalleryItem* item)
{
    if(item == NULL || !item->IsVisible() || IsEmpty())
        return;

    if(m_art->GetFlags() & wxRIBBON_BAR_FLOW_VERTICAL)
    {
        int x = item->GetPosition().GetLeft();
        int base_x = m_items.Item(0)->GetPosition().GetLeft();
        int delta = x - base_x - m_scroll_amount;
        ScrollLines(delta / m_bitmap_padded_size.GetWidth());
    }
    else
    {
        int y = item->GetPosition().GetTop();
        int base_y = m_items.Item(0)->GetPosition().GetTop();
        int delta = y - base_y - m_scroll_amount;
        ScrollLines(delta / m_bitmap_padded_size.GetHeight());
    }
}
Пример #7
0
wxDragResult wxGISToolExecuteView::OnDragOver(wxCoord x, wxCoord y, wxDragResult def)
{
    SetItemState(m_HighLightItem, 0, wxLIST_STATE_DROPHILITED);
    wxPoint pt(x, y);
    unsigned long nFlags(0);
    long nItemId = HitTest(pt, (int &)nFlags);
    if(nItemId != wxNOT_FOUND && (nFlags & wxLIST_HITTEST_ONITEM))
    {
        wxSize sz = GetClientSize();
        if(DNDSCROLL > y)//scroll up
            ScrollLines(-1);
        else if((sz.GetHeight() - DNDSCROLL) < y)//scroll down
            ScrollLines(1);

        m_HighLightItem = nItemId;
        SetItemState(m_HighLightItem, wxLIST_STATE_DROPHILITED, wxLIST_STATE_DROPHILITED);

    }
    return def;
}
Пример #8
0
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
{
    // clicking on the item selects it, clicking on the checkmark toggles

    int nItem = HitTest(event.GetX(), event.GetY());

    if ( nItem != wxNOT_FOUND )
    {
        wxRect rect;
        GetItemRect(nItem, rect);

        // convert item rect to check mark rect
        wxSize size = wxRendererNative::Get().GetCheckBoxSize(this);
        rect.x += CHECKMARK_EXTRA_SPACE;
        rect.y += (rect.GetHeight() - size.GetHeight()) / 2;
        rect.SetSize(size);

        if ( rect.Contains(event.GetX(), event.GetY()) )
        {
            // people expect to get "kill focus" event for the currently
            // focused control before getting events from the other controls
            // and, equally importantly, they may prevent the focus change from
            // taking place at all (e.g. because the old control contents is
            // invalid and needs to be corrected) in which case we shouldn't
            // generate this event at all
            SetFocus();
            if ( FindFocus() == this )
            {
                Toggle(nItem);
                SendEvent(nItem);

                // scroll one item down if the item is the last one
                // and isn't visible at all
                int h;
                GetClientSize(NULL, &h);
                if ( rect.GetBottom() > h )
                    ScrollLines(1);
            }
        }
        else
        {
            // implement default behaviour: clicking on the item selects it
            event.Skip();
        }
    }
    else
    {
        // implement default behaviour on click outside of client zone
        event.Skip();
    }
}
Пример #9
0
void PageScroll( Word fldindex, Word sbarindex, DirectionType dir )
{
	FormPtr frm=FrmGetActiveForm();
	FieldPtr fld;

	fld = FrmGetObjectPtr( frm, FrmGetObjectIndex( frm, fldindex ) );

	if( FldScrollable( fld, dir ) ) {
		int linesToScroll = FldGetVisibleLines( fld ) - 1;

		if( dir==up )
			linesToScroll = -linesToScroll;
		ScrollLines( fldindex, sbarindex, linesToScroll, true );
	}
}
Пример #10
0
void wxVScrolledWindow::OnMouseWheel(wxMouseEvent& event)
{
    m_sumWheelRotation += event.GetWheelRotation();
    int delta = event.GetWheelDelta();

    // how much to scroll this time
    int units_to_scroll = -(m_sumWheelRotation/delta);
    if ( !units_to_scroll )
        return;

    m_sumWheelRotation += units_to_scroll*delta;

    if ( !event.IsPageScroll() )
        ScrollLines( units_to_scroll*event.GetLinesPerAction() );
    else
        // scroll pages instead of lines
        ScrollPages( units_to_scroll );
}
Пример #11
0
void CGameListCtrl::Update()
{
	int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
	// Don't let the user refresh it while a game is running
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
		return;

	if (m_imageListSmall)
	{
		delete m_imageListSmall;
		m_imageListSmall = NULL;
	}

	// NetPlay : Set/Reset the GameList string
	m_gameList.clear();
	m_gamePath.clear();

	Hide();

	ScanForISOs();

	ClearAll();

	if (m_ISOFiles.size() != 0)
	{
		// Don't load bitmaps unless there are games to list
		InitBitmaps();

		// add columns
		InsertColumn(COLUMN_DUMMY,_T(""));
		InsertColumn(COLUMN_PLATFORM, _T(""));
		InsertColumn(COLUMN_BANNER, _("Banner"));
		InsertColumn(COLUMN_TITLE, _("Title"));

		// Instead of showing the notes + the company, which is unknown with
		// wii titles We show in the same column : company for GC games and
		// description for wii/wad games
		InsertColumn(COLUMN_NOTES, _("Notes"));
		InsertColumn(COLUMN_COUNTRY, _T(""));
		InsertColumn(COLUMN_SIZE, _("Size"));
		InsertColumn(COLUMN_EMULATION_STATE, _("State"));

#ifdef __WXMSW__
		const int platform_padding = 0;
#else
		const int platform_padding = 8;
#endif
		
		// set initial sizes for columns
		SetColumnWidth(COLUMN_DUMMY,0);
		SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding);
		SetColumnWidth(COLUMN_BANNER, 96 + platform_padding);
		SetColumnWidth(COLUMN_TITLE, 200 + platform_padding);
		SetColumnWidth(COLUMN_NOTES, 200 + platform_padding);
		SetColumnWidth(COLUMN_COUNTRY, 32 + platform_padding);
		SetColumnWidth(COLUMN_EMULATION_STATE, 50 + platform_padding);

		// add all items
		for (int i = 0; i < (int)m_ISOFiles.size(); i++)
		{
			InsertItemInReportView(i);
			if (m_ISOFiles[i]->IsCompressed())
				SetItemTextColour(i, wxColour(0xFF0000));
		}

		// Sort items by Title
		if (!sorted)
			last_column = 0;
		sorted = false;
		wxListEvent event;
		event.m_col = SConfig::GetInstance().m_ListSort2;
		OnColumnClick(event);

		event.m_col = SConfig::GetInstance().m_ListSort;
		OnColumnClick(event);
		sorted = true;

		SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE);
	}
	else
	{
		wxString errorString;
		// We just check for one hide setting to be enabled, as we may only
		// have GC games for example, and hide them, so we should show the
		// second message instead
		if ((SConfig::GetInstance().m_ListGC  &&
			SConfig::GetInstance().m_ListWii  &&
			SConfig::GetInstance().m_ListWad) &&
			(SConfig::GetInstance().m_ListJap &&
			SConfig::GetInstance().m_ListUsa  &&
			SConfig::GetInstance().m_ListPal))
		{
			errorString = _("Dolphin could not find any GC/Wii ISOs.  Doubleclick here to browse for files...");
		}
		else
		{
			errorString = _("Dolphin is currently set to hide all games.  Doubleclick here to show all games...");
		}
		InsertColumn(0, _("No ISOs or WADS found"));
		long index = InsertItem(0, errorString);
		SetItemFont(index, *wxITALIC_FONT);
		SetColumnWidth(0, wxLIST_AUTOSIZE);
	}
	if (GetSelectedISO() == NULL)
		main_frame->UpdateGUI();
	Show();

	AutomaticColumnWidth();
	ScrollLines(scrollPos);
	SetFocus();
}
Пример #12
0
bool wxScrollBar::PerformAction(const wxControlAction& action,
                                long numArg,
                                const wxString& strArg)
{
    int thumbOld = m_thumbPos;

    bool notify = false; // send an event about the change?

    wxEventType scrollType;

    // test for thumb move first as these events happen in quick succession
    if ( action == wxACTION_SCROLL_THUMB_MOVE )
    {
        DoSetThumb(numArg);

        // VS: we have to force redraw here, otherwise the thumb will lack
        //     behind mouse cursor
        UpdateThumb();

        scrollType = wxEVT_SCROLLWIN_THUMBTRACK;
    }
    else if ( action == wxACTION_SCROLL_LINE_UP )
    {
        scrollType = wxEVT_SCROLLWIN_LINEUP;
        ScrollLines(-1);
    }
    else if ( action == wxACTION_SCROLL_LINE_DOWN )
    {
        scrollType = wxEVT_SCROLLWIN_LINEDOWN;
        ScrollLines(1);
    }
    else if ( action == wxACTION_SCROLL_PAGE_UP )
    {
        scrollType = wxEVT_SCROLLWIN_PAGEUP;
        ScrollPages(-1);
    }
    else if ( action == wxACTION_SCROLL_PAGE_DOWN )
    {
        scrollType = wxEVT_SCROLLWIN_PAGEDOWN;
        ScrollPages(1);
    }
    else if ( action == wxACTION_SCROLL_START )
    {
        scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
        ScrollToStart();
    }
    else if ( action == wxACTION_SCROLL_END )
    {
        scrollType = wxEVT_SCROLLWIN_THUMBRELEASE; // anything better?
        ScrollToEnd();
    }
    else if ( action == wxACTION_SCROLL_THUMB_DRAG )
    {
        // we won't use it but this line suppresses the compiler
        // warning about "variable may be used without having been
        // initialized"
        scrollType = wxEVT_NULL;
    }
    else if ( action == wxACTION_SCROLL_THUMB_RELEASE )
    {
        // always notify about this
        notify = true;
        scrollType = wxEVT_SCROLLWIN_THUMBRELEASE;
    }
    else
        return wxControl::PerformAction(action, numArg, strArg);

    // has scrollbar position changed?
    bool changed = m_thumbPos != thumbOld;
    if ( notify || changed )
    {
        if ( IsStandalone() )
        {
            // we should generate EVT_SCROLL events for the standalone
            // scrollbars and not the EVT_SCROLLWIN ones
            //
            // NB: we assume that scrollbar events are sequentially numbered
            //     but this should be ok as other code relies on this as well
            scrollType += wxEVT_SCROLL_TOP - wxEVT_SCROLLWIN_TOP;
            wxScrollEvent event(scrollType, this->GetId(), m_thumbPos,
                                IsVertical() ? wxVERTICAL : wxHORIZONTAL);
            event.SetEventObject(this);
            GetEventHandler()->ProcessEvent(event);
        }
        else // part of the window
        {
            wxScrollWinEvent event(scrollType, m_thumbPos,
                                   IsVertical() ? wxVERTICAL : wxHORIZONTAL);
            event.SetEventObject(this);
            GetParent()->GetEventHandler()->ProcessEvent(event);
        }
    }

    return true;
}
Пример #13
0
void CGameListCtrl::Update()
{
	int scrollPos = wxWindow::GetScrollPos(wxVERTICAL);
	// Don't let the user refresh it while a game is running
	if (Core::GetState() != Core::CORE_UNINITIALIZED)
		return;

	if (m_imageListSmall)
	{
		delete m_imageListSmall;
		m_imageListSmall = nullptr;
	}

	Hide();

	ScanForISOs();

	ClearAll();

	if (m_ISOFiles.size() != 0)
	{
		// Don't load bitmaps unless there are games to list
		InitBitmaps();

		// add columns
		InsertColumn(COLUMN_DUMMY, "");
		InsertColumn(COLUMN_PLATFORM, "");
		InsertColumn(COLUMN_BANNER, _("Banner"));
		InsertColumn(COLUMN_TITLE, _("Title"));

		InsertColumn(COLUMN_MAKER, _("Maker"));
		InsertColumn(COLUMN_FILENAME, _("File"));
		InsertColumn(COLUMN_ID, _("ID"));
		InsertColumn(COLUMN_COUNTRY, "");
		InsertColumn(COLUMN_SIZE, _("Size"));
		InsertColumn(COLUMN_EMULATION_STATE, _("State"));

#ifdef __WXMSW__
		const int platform_padding = 0;
#else
		const int platform_padding = 8;
#endif

		const int platform_icon_padding = 1;

		// set initial sizes for columns
		SetColumnWidth(COLUMN_DUMMY, 0);
		SetColumnWidth(COLUMN_PLATFORM, SConfig::GetInstance().m_showSystemColumn ? 32 + platform_icon_padding + platform_padding : 0);
		SetColumnWidth(COLUMN_BANNER, SConfig::GetInstance().m_showBannerColumn ? 96 + platform_padding : 0);
		SetColumnWidth(COLUMN_TITLE, 175 + platform_padding);
		SetColumnWidth(COLUMN_MAKER, SConfig::GetInstance().m_showMakerColumn ? 150 + platform_padding : 0);
		SetColumnWidth(COLUMN_FILENAME, SConfig::GetInstance().m_showFileNameColumn ? 100 + platform_padding : 0);
		SetColumnWidth(COLUMN_ID, SConfig::GetInstance().m_showIDColumn ? 75 + platform_padding : 0);
		SetColumnWidth(COLUMN_COUNTRY, SConfig::GetInstance().m_showRegionColumn ? 32 + platform_padding : 0);
		SetColumnWidth(COLUMN_EMULATION_STATE, SConfig::GetInstance().m_showStateColumn ? 48 + platform_padding : 0);

		// add all items
		for (int i = 0; i < (int)m_ISOFiles.size(); i++)
		{
			InsertItemInReportView(i);
			if (SConfig::GetInstance().m_ColorCompressed && m_ISOFiles[i]->IsCompressed())
				SetItemTextColour(i, wxColour(0xFF0000));
		}

		// Sort items by Title
		if (!sorted)
			last_column = 0;
		sorted = false;
		wxListEvent event;
		event.m_col = SConfig::GetInstance().m_ListSort2;
		OnColumnClick(event);

		event.m_col = SConfig::GetInstance().m_ListSort;
		OnColumnClick(event);
		sorted = true;

		SetColumnWidth(COLUMN_SIZE, SConfig::GetInstance().m_showSizeColumn ? wxLIST_AUTOSIZE : 0);
	}
	else
	{
		wxString errorString;
		// We just check for one hide setting to be enabled, as we may only
		// have GC games for example, and hide them, so we should show the
		// first message instead
		if (IsHidingItems())
		{
			errorString = _("Dolphin is currently set to hide all games. Double-click here to show all games...");
		}
		else
		{
			errorString = _("Dolphin could not find any GameCube/Wii ISOs or WADs. Double-click here to set a games directory...");
		}
		InsertColumn(0, "");
		long index = InsertItem(0, errorString);
		SetItemFont(index, *wxITALIC_FONT);
		SetColumnWidth(0, wxLIST_AUTOSIZE);
	}
	if (GetSelectedISO() == nullptr)
		main_frame->UpdateGUI();
	Show();

	AutomaticColumnWidth();
	ScrollLines(scrollPos);
	SetFocus();
}
Пример #14
0
static Boolean MyMainFormHandleEvent( EventPtr event )
{
	Boolean handled = false;
	Int i;
	FieldPtr fld;
	FormPtr frm;
	Word readerNum;

#ifdef __GCC__
	CALLBACK_PROLOGUE
#endif

	frm = FrmGetActiveForm();

	switch( event->eType ) {
		case frmOpenEvent:
			UpdateScrollbar( dataFieldID, dataSbarID );
			FrmDrawForm( frm );
			break;
		case ctlSelectEvent:
			if( event->data.ctlSelect.controlID==updateButtonID ) {
				handled=true;

				if( readerType==SC_READER_UNKNOWN ) {
					FrmAlert( alert6FormID );
					break;
				}

				FrmHideObject(frm, FrmGetObjectIndex(frm, updateButtonID));

				i=scdir();

				UpdateScrollbar( dataFieldID, dataSbarID );

				if( i==1 ) FrmAlert(alert1FormID);
				else if( i==2 ) FrmAlert(alert2FormID);
				else if( i==3 ) FrmAlert(alert3FormID);
				else if( i==4 ) FrmAlert(alert4FormID);
				else if( i>4 ) FrmAlert(alert5FormID);

				FrmShowObject(frm, FrmGetObjectIndex(frm, updateButtonID));
			}
			break;
		case menuEvent:
			fld = FrmGetObjectPtr(frm, FrmGetObjectIndex(frm, dataFieldID)); 
			switch( event->data.menu.itemID ) {
				case selectMenuID:
					handled = true;
					FldSetSelection (fld, 0, FldGetTextLength (fld));
					break;
				case copyMenuID:
					handled = true;
					FldCopy(fld);
					break;
				case readerMenuID:
					handled = true;

					switch(readerType) {
						case SC_READER_DUMBMOUSE:
							readerNum=0;
							break;
						case SC_READER_TOWITOKO:
							readerNum=1;
							break;
						default:
							readerNum=-1;
							break;
					}

					readerNum = ChooseReader( readerNum );

					switch(readerNum) {
						case 0:
							readerType=SC_READER_DUMBMOUSE;
							break;
						case 1:
							readerType=SC_READER_TOWITOKO;
							break;
						default:
							readerType=SC_READER_UNKNOWN;
							break;
					}

					break;
				case aboutMenuID:
					handled = true;
					FrmAlert(aboutFormID);
					break;
				case helpMenuID:
					handled = true;
					FrmAlert(helpFormID);
					break;
				default:
					break;
			}
		case fldChangedEvent:
			if( event->data.fldChanged.fieldID==dataFieldID ) {
				UpdateScrollbar( dataFieldID, dataSbarID );
				handled=true;
			}
			break;
		case sclRepeatEvent:
			if( event->data.sclRepeat.scrollBarID==dataSbarID ) {
				ScrollLines( dataFieldID, dataSbarID,
					event->data.sclRepeat.newValue -
					event->data.sclRepeat.value, false );
			}
			break;
		case keyDownEvent:
			if( event->data.keyDown.chr == pageUpChr ) {
				PageScroll( dataFieldID, dataSbarID, up );
				handled = true;
			} else if( event->data.keyDown.chr == pageDownChr ) {
				PageScroll( dataFieldID, dataSbarID, down );
				handled = true;
			}
            break;
		default:
			break;
	}

#ifdef __GCC__
	CALLBACK_EPILOGUE
#endif

	return handled;
}
Пример #15
0
bool wxVideoTerminal::ScrollPages(int pages)
{
	int lines = pages * m_screen_size.GetHeight();
	return ScrollLines(lines);
}