General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Frame scrolling revisited (technical)
Posted by: asmpgmr
Date: April 14, 2003 06:16PM

MonkeeSage,

I think frame autoscrolling can be implemented if you use the functions nsiScrollableView (view/public/nsIScrollableView.h) instead of nsIScrollable as is done currently. See the code here for the actual Mozilla scrolling functionality - http://lxr.mozilla.org/seamonkey/source/layout/html/base/src/nsPresShell.cpp#3258 - The functions are ScrollPage, ScrollLine, ScrollHorizontal, and ScrollComplete which call ScrollByPages, ScrollByLines, and ScrollByWhole in nsIScrollableView. There's also a GetScrollPosition and ScrollTo in nsIScrollableView which look like the functions to use in BrowserViewPanning.cpp to implement autoscrolling which would work in all cases.

Options: ReplyQuote
Re: Frame scrolling revisited (technical)
Posted by: MonkeeSage
Date: April 14, 2003 08:44PM

asmpgmr:

I tried this:

nsIViewManager* mViewManager;

// ...

NS_IMETHODIMP GetViewManager(nsIViewManager** aResult)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
return NS_ERROR_NULL_POINTER;
}
*aResult = mViewManager;
NS_IF_ADDREF(mViewManager);
return NS_OK;
}

void CBrowserView::OnTimer(UINT nIDEvent)
{
switch(nIDEvent){
case 0x1:
if(m_panning) {
nsCOMPtr<nsIViewManager> viewManager;
GetViewManager(getter_AddRefs(viewManager));
if ( !viewManager) return;

nsIScrollableView *scroll;
viewManager->GetRootScrollableView(&scroll);
if ( !scroll) return;

POINT p;
GetCursorPos(&p);

int scroll_x,scroll_y;

scroll->GetScrollPosition(scroll_x, scroll_y);

int dx = (p.x-m_panningPoint.x)/10;
int dy = (p.y-m_panningPoint.y)/10;

if(dy!=0) {
if(dy>0) scroll_y += dy*dy;
else scroll_y -= dy*dy; //+1;
scroll->ScrollTo(scroll_x, scroll_y, NULL);
}

if(dx!=0) {
if(dx>0) scroll_x += dx*dx;
else scroll_x -= dx*dx; //+1;
scroll->ScrollTo(scroll_x, scroll_y, NULL);
}

// ...

Nothing happens on panning...i probably implemented the View Manager thing wrong or something...any idea?


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Frame scrolling revisited (technical)
Posted by: asmpgmr
Date: April 14, 2003 09:12PM

MonkeeSage,

You shouldn't have to define the ViewManager stuff in K-Meleon. The original code just uses:

if(m_panning) {
nsCOMPtr<nsIScrollable> s(do_QueryInterface(mWebBrowser));

if (!s) return;

Therefore I would guess you have to use do_QueryInterface, perhaps:

if(m_panning) {
nsCOMPtr<nsIViewManager> view(do_QueryInterface(mWebBrowser));
if (!view) return;

Or maybe you can get the nsIScrollableView interface.

Options: ReplyQuote
Re: Frame scrolling revisited (technical)
Posted by: MonkeeSage
Date: April 14, 2003 11:39PM

asmpgmr:

I tried:

nsCOMPtr<nsIViewManager> view(do_QueryInterface(mWebBrowser));
if (!view) return;

No go...

I'm not sure how to derive the ViewManager object. :\


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Frame scrolling revisited (technical)
Posted by: asmpgmr
Date: April 14, 2003 11:49PM

MonkeeSage,

Is it possible to get nsIScrollableView ?

nsCOMPtr<nsIScrollableView> s(do_QueryInterface(mWebBrowser));

Options: ReplyQuote
Re: Frame scrolling revisited (technical)
Posted by: MonkeeSage
Date: April 15, 2003 01:30AM

asmpgmr:

Tried that, but no luck there either.


Shelumi`El
Jordan

S.D.G

Options: ReplyQuote
Re: Frame scrolling revisited (technical)
Posted by: asmpgmr
Date: April 15, 2003 02:27AM

MonkeeSage,

This has to be doable since the arrow keys certainly work properly in frames and the functions they call ultimately goto the nsIScrollableView interface. Is there any sort of embedded API doc included with the source code which describes what functions are actually callable and via what methods ? Overall the embedded Mozilla stuff seems to be kind of rough and incomplete. The handling of frames is almost non-existent - you can't reload a frame, autoscrolling doesn't work (well Mozilla doesn't do that at all), tooltip positioning isn't relative to a frame, and they didn't have save frame support.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.