that damn relative origin still

View: New views
6 Messages — Rating Filter:   Alert me  

that damn relative origin still

by felix-38 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


i know that SCSoundFileView, SCTextView and SCScrollView all have the same problem.
I can't yet figure it out, so I'm posting this again in case anybody else knows or feels compelled to look at it.



        g = GUI.window.new("name",Rect(0,0,400,400));
        g.front;

        // problem:
        // two deep composite views with relative origin


        h = GUI.compositeView.new(g,Rect(30,30,300,300)).background_(Color.red);
        h.relativeOrigin = true;

        i = GUI.compositeView.new(h,Rect(20,20,150,150)).background_(Color.green);
        i.relativeOrigin = true;



        t = GUI.textView.new(i,Rect(10,10,100,100));
        t.string = "i should be in the green square";
        // does not seem to be the scrolling
        // but there is a scroll view involved in there
        t
            .hasVerticalScroller_(false)
            .hasHorizontalScroller_(false)
            .autohidesScrollers_(false);

        this.assertEquals( t.absoluteBounds, Rect(60,60,100,100), "the text view should be in the green square" );
        // but instead its at the top right corner of the red square
        // Rect(30, 30, 100, 100) // fail  60,60,100,100

        // hah, it actually returns the value correct at 60@60 during the test
        // but then when the window refreshes and the code cycle is done
        // it both looks wrong and returns wrong : 30@30

-cx





Re: that damn relative origin still

by blackrain-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This was meant to go with a bunch of other stuff I have been working
on but its not ready to be released just yet.
it also fixes the disappearing scrollbar issues in SCTextView.

sorry no svn diff this time but my source tree is a war zone.
sides the changes are really small actually.

cheers,

x

On Sun, Jul 6, 2008 at 1:53 PM, felix <felix@...> wrote:

>
> i know that SCSoundFileView, SCTextView and SCScrollView all have the same
> problem.
> I can't yet figure it out, so I'm posting this again in case anybody else
> knows or feels compelled to look at it.
>
>
>
>         g = GUI.window.new("name",Rect(0,0,400,400));
>         g.front;
>
>         // problem:
>         // two deep composite views with relative origin
>
>
>         h =
> GUI.compositeView.new(g,Rect(30,30,300,300)).background_(Color.red);
>         h.relativeOrigin = true;
>
>         i =
> GUI.compositeView.new(h,Rect(20,20,150,150)).background_(Color.green);
>         i.relativeOrigin = true;
>
>
>
>         t = GUI.textView.new(i,Rect(10,10,100,100));
>         t.string = "i should be in the green square";
>         // does not seem to be the scrolling
>         // but there is a scroll view involved in there
>         t
>             .hasVerticalScroller_(false)
>             .hasHorizontalScroller_(false)
>             .autohidesScrollers_(false);
>
>         this.assertEquals( t.absoluteBounds, Rect(60,60,100,100), "the text
> view should be in the green square" );
>         // but instead its at the top right corner of the red square
>         // Rect(30, 30, 100, 100) // fail  60,60,100,100
>
>         // hah, it actually returns the value correct at 60@60 during the
> test
>         // but then when the window refreshes and the code cycle is done
>         // it both looks wrong and returns wrong : 30@30
>
> -cx
>
>
>
>
>


SCCocoaView.M @ 307

void SCCocoaTextView::setBounds(SCRect inBounds)
{
                mBounds = inBounds;
                [[mScrollView superview] setNeedsDisplayInRect:[mScrollView frame]];
                if(mParent->relativeOrigin()){
                        SCRect pbounds = mParent->getLayout().bounds; // relative origin fix
                // SCRect pbounds = mParent->getBounds();
                        mLayout.bounds.x = mBounds.x + pbounds.x;
                        mLayout.bounds.y = mBounds.y + pbounds.y;
                        mLayout.bounds.width = mBounds.width;
                        mLayout.bounds.height = mBounds.height;
                } else {
                        mLayout.bounds = mBounds;
                }
                [mScrollView setFrame: SCtoNSRect(mLayout.bounds)];
                [mTextView setFrame: SCtoNSRect(mLayout.bounds)]; // not needed - br

        // [mScrollView setBounds: SCtoNSRect(mBounds)];
        // [mTextView setBounds: SCtoNSRect(mBounds)];
        // [mScrollView setNeedsDisplay: YES]; // not needed - br
        // [mTextView setNeedsDisplay: YES]; // not needed - br
}

SCCocoaView.M @ 702
void SCMovieView::setBounds(SCRect screct)
{
        [[mMovieView superview] setNeedsDisplayInRect:[mMovieView frame]];
        mBounds = screct;
        if(mParent->relativeOrigin()){
                SCRect pbounds = mParent->getLayout().bounds; // relative origin fix
        // SCRect pbounds = mParent->getBounds();
                mLayout.bounds.x = mBounds.x + pbounds.x;
                mLayout.bounds.y = mBounds.y + pbounds.y;
                mLayout.bounds.width = mBounds.width;
                mLayout.bounds.height = mBounds.height;
        } else {
                mLayout.bounds = mBounds;
        }

        [mMovieView setFrame: SCtoNSRect(mLayout.bounds)];
        [mMovieView setBounds: SCtoNSRect(mBounds)]; //?
        [mMovieView setNeedsDisplay: YES];
}

SCCocoaView.M @ 950
void SCQuartzComposerView::setBounds(SCRect screct)
{
        [[mQCView superview] setNeedsDisplayInRect:[mQCView frame]];
        mBounds = screct;
        if(mParent->relativeOrigin()){
                SCRect pbounds = mParent->getLayout().bounds; // relative origin fix
        // SCRect pbounds = mParent->getBounds();
                mLayout.bounds.x = mBounds.x + pbounds.x;
                mLayout.bounds.y = mBounds.y + pbounds.y;
                mLayout.bounds.width = mBounds.width;
                mLayout.bounds.height = mBounds.height;
        } else {
                mLayout.bounds = mBounds;
        }
        [mQCView setFrame: SCtoNSRect(mLayout.bounds)];
        [mQCView setNeedsDisplay: YES];
       
}

SCSoundFileView.M  @ 233
void SCSoundFileView::setBounds(SCRect inBounds)
{
        if(inBounds.width != mBounds.width){
                if(mElasticMode) mZoom.x =  mSndBuf.frames/(inBounds.width-2.f);
  mSndMinMax.isUsable = false;
                if(mSndBuf.channels)
                bufAllocMinMax(&mSndMinMax, mSndBuf.channels, (int)(inBounds.width ));
        }
// mBounds = inBounds;
    mBounds = inBounds;
        if(mParent->relativeOrigin()){
                SCRect pbounds = mParent->getLayout().bounds; // relative origin fix
        // SCRect pbounds = mParent->getBounds();
                mLayout.bounds.x = mBounds.x + pbounds.x;
                mLayout.bounds.y = mBounds.y + pbounds.y;
                mLayout.bounds.width = mBounds.width;
                mLayout.bounds.height = mBounds.height;
        } else {
                mLayout.bounds = mBounds;
        }
}


Re: that damn relative origin still

by felix-38 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


yes !  it works !

all related unit tests also pass now.

I should check it in for you, right ?

-cx


On Mon, Jul 7, 2008 at 7:28 AM, blackrain <blackrain.sc@gmail.com> wrote:
This was meant to go with a bunch of other stuff I have been working
on but its not ready to be released just yet.
it also fixes the disappearing scrollbar issues in SCTextView.

sorry no svn diff this time but my source tree is a war zone.
sides the changes are really small actually.

cheers,

x



Re: that damn relative origin still

by blackrain-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

* winks

sure =)

On Mon, Jul 7, 2008 at 2:19 AM, felix <felix@...> wrote:

>
> yes !  it works !
>
> all related unit tests also pass now.
>
> I should check it in for you, right ?
>
> -cx
>
>
> On Mon, Jul 7, 2008 at 7:28 AM, blackrain <blackrain.sc@...> wrote:
>>
>> This was meant to go with a bunch of other stuff I have been working
>> on but its not ready to be released just yet.
>> it also fixes the disappearing scrollbar issues in SCTextView.
>>
>> sorry no svn diff this time but my source tree is a war zone.
>> sides the changes are really small actually.
>>
>> cheers,
>>
>> x
>>
>
>

_______________________________________________
sc-dev mailing list


info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/

Re: that damn relative origin still

by blackrain-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

... and thanks for checking it in.

cheers,

x

On Mon, Jul 7, 2008 at 2:24 AM, blackrain <blackrain.sc@...> wrote:

> * winks
>
> sure =)
>
> On Mon, Jul 7, 2008 at 2:19 AM, felix <felix@...> wrote:
>>
>> yes !  it works !
>>
>> all related unit tests also pass now.
>>
>> I should check it in for you, right ?
>>
>> -cx
>>
>>
>> On Mon, Jul 7, 2008 at 7:28 AM, blackrain <blackrain.sc@...> wrote:
>>>
>>> This was meant to go with a bunch of other stuff I have been working
>>> on but its not ready to be released just yet.
>>> it also fixes the disappearing scrollbar issues in SCTextView.
>>>
>>> sorry no svn diff this time but my source tree is a war zone.
>>> sides the changes are really small actually.
>>>
>>> cheers,
>>>
>>> x
>>>
>>
>>
>

_______________________________________________
sc-dev mailing list


info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/

Re: that damn relative origin still

by blackrain-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

just looked again, there is a typo =/

SCCocoaView.M line 322 in void SCCocoaTextView::setBounds(SCRect
inBounds) should be commented out also - the comment is there but the
line itself is not commented out.
apologies.

                // [mTextView setFrame: SCtoNSRect(mLayout.bounds)]; // not needed - br


On Mon, Jul 7, 2008 at 2:36 AM, blackrain <blackrain.sc@...> wrote:

> ... and thanks for checking it in.
>
> cheers,
>
> x
>
> On Mon, Jul 7, 2008 at 2:24 AM, blackrain <blackrain.sc@...> wrote:
>> * winks
>>
>> sure =)
>>
>> On Mon, Jul 7, 2008 at 2:19 AM, felix <felix@...> wrote:
>>>
>>> yes !  it works !
>>>
>>> all related unit tests also pass now.
>>>
>>> I should check it in for you, right ?
>>>
>>> -cx
>>>
>>>
>>> On Mon, Jul 7, 2008 at 7:28 AM, blackrain <blackrain.sc@...> wrote:
>>>>
>>>> This was meant to go with a bunch of other stuff I have been working
>>>> on but its not ready to be released just yet.
>>>> it also fixes the disappearing scrollbar issues in SCTextView.
>>>>
>>>> sorry no svn diff this time but my source tree is a war zone.
>>>> sides the changes are really small actually.
>>>>
>>>> cheers,
>>>>
>>>> x
>>>>
>>>
>>>
>>
>

_______________________________________________
sc-dev mailing list


info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/
LightInTheBox - Buy quality products at wholesale price