These are chat archives for AvaloniaUI/Avalonia

18th
Dec 2015
Steven Kirk
@grokys
Dec 18 2015 00:03
@wieslawsoltes i merged your tab item spacing PR but it looks bad on the test app:
blob
the tabs are too close together, going to revert
if you want to change that value in your app, just add the style to your App.xaml styles
Steven Kirk
@grokys
Dec 18 2015 00:23
@wieslawsoltes ok, I've tried removing TabStripItem and i can't see a way to get it to work: the tab contents inherit the styling of the TabItem!
however, the follow seems to work:
  <Window.Styles>
    <Style Selector="TabStripItem.bar">
      <Setter Property="TextBlock.FontSize" Value="24"/>
    </Style>
  </Window.Styles>
  <TabControl>
    <TabItem>
      <TabItem.Header>
        <TabStripItem Classes="bar" Content="Foo"/>
      </TabItem.Header>
in the binding test app
i think that's an ok solution, at least it's the best i can think of...
danwalmsley
@danwalmsley
Dec 18 2015 13:47
@grokys im trying to use devtools to diagnose problems with scrollview not behaving as expected..
however on visual tree I cant select the items in the tree view
blob
it lets me select once, then never again...
Steven Kirk
@grokys
Dec 18 2015 13:50
yeah, i've found that too
i need to investigate
danwalmsley
@danwalmsley
Dec 18 2015 13:50
ok cool
Steven Kirk
@grokys
Dec 18 2015 13:50
i've found that if you use the keyboard it sometimes works better
danwalmsley
@danwalmsley
Dec 18 2015 13:51
ok
will try that
im trying to get IScrollInfo to work correctly.. will keep trying to solve it myself... but might need to pick your brain later
Im pretty sure im not sending back correct stuff in ArrangeOveride
danwalmsley
@danwalmsley
Dec 18 2015 14:03
@grokys
protected override Size ArrangeOverride(Size finalSize) 
{ 
           _viewport = new Size(finalSize.Width, finalSize.Height / _lineSize.Height); 
            _extent = new Size(_lineSize.Width, itemCount + 1); 
            InvalidateScroll?.Invoke(); 
            return finalSize; 
}
why is viewport height divided by lineheight?
thats from example
Steven Kirk
@grokys
Dec 18 2015 14:04
because that's the number of lines you can fit in the viewport?
danwalmsley
@danwalmsley
Dec 18 2015 14:04
sure... but doesnt the viewport give a size, as in pixels
Steven Kirk
@grokys
Dec 18 2015 14:04
no, this is logical scrolling
danwalmsley
@danwalmsley
Dec 18 2015 14:05
ah right ok
Steven Kirk
@grokys
Dec 18 2015 14:05
you get to decide the units
you can use pixels if you want, but in the example i use lines
danwalmsley
@danwalmsley
Dec 18 2015 14:05
thats good its easier for me to use lines
so which part in the example tells the scrollviewer how many pixels in a single unit?
oh that would be the extent?
Steven Kirk
@grokys
Dec 18 2015 14:06
don't understand: what is a "single unit"?
danwalmsley
@danwalmsley
Dec 18 2015 14:06
tells you how many logical units
single unit... i mean logical unit
Steven Kirk
@grokys
Dec 18 2015 14:07
yep, extent, offset and viewport are all logical units, meaning you get to decide their meaning
Darnell Williams
@Seeker1437
Dec 18 2015 14:07
doesn't use the height of each element for a "unit"?
also as of today I have been programming for 3 years + turned 22 :D
Steven Kirk
@grokys
Dec 18 2015 14:08
congratulations!
danwalmsley
@danwalmsley
Dec 18 2015 14:08
@ImaBrokeDude happy birthday
Darnell Williams
@Seeker1437
Dec 18 2015 14:10
THanks guys, I'm more xcited about the programming XD
danwalmsley
@danwalmsley
Dec 18 2015 14:11
@grokys thanks for the hints, about logical units, its all sprung to life now!!!
Steven Kirk
@grokys
Dec 18 2015 14:12
cool!
Darnell Williams
@Seeker1437
Dec 18 2015 14:12
I must see!
danwalmsley
@danwalmsley
Dec 18 2015 14:12
i was thinking in pixels the whole time...
@ImaBrokeDude I will push changes soon
still trying to optimize render loop
Steven Kirk
@grokys
Dec 18 2015 14:13
you might want to move back to pixels later if you want smoother scrolling
but that wouldn't be hard
danwalmsley
@danwalmsley
Dec 18 2015 14:13
sure
Steven Kirk
@grokys
Dec 18 2015 14:13
you'll notice in the example i use pixels for horizontal scroll
danwalmsley
@danwalmsley
Dec 18 2015 14:14
well I like line scrolling,,, so you always have a full line at the top of the screen
Steven Kirk
@grokys
Dec 18 2015 14:14
fair enough!
danwalmsley
@danwalmsley
Dec 18 2015 14:14
not really any point having half a line...
horizontal it might be better
to use pixels..
Darnell Williams
@Seeker1437
Dec 18 2015 14:23
much!
danwalmsley
@danwalmsley
Dec 18 2015 14:24
@grokys when you use mouse wheel is that paging? At moment it scrolls much further than I would expect
Steven Kirk
@grokys
Dec 18 2015 14:24
ah, i've not done mousewheel yet
danwalmsley
@danwalmsley
Dec 18 2015 14:24
ok
for now its working fine anyway.
Steven Kirk
@grokys
Dec 18 2015 14:25
cool! was surprised how easy it was to get that written
IScrollable i mean
danwalmsley
@danwalmsley
Dec 18 2015 14:25
yeh
i thought it was going to be something complex
and then you posted it
Darnell Williams
@Seeker1437
Dec 18 2015 14:25
Well you two are epic programmers too XD
danwalmsley
@danwalmsley
Dec 18 2015 14:25
I was like wow... pretty simple
@ImaBrokeDude i wouldnt go that far... but thanks!
Steven Kirk
@grokys
Dec 18 2015 14:26
yeah, the interface will probably need to get more complex, but hopefully only a single method
the WPF version is a nightmare
danwalmsley
@danwalmsley
Dec 18 2015 14:26
it already does 90% of what I need
yeh wpf is ridiculous
Darnell Williams
@Seeker1437
Dec 18 2015 14:27
lol
I have a question for you.
danwalmsley
@danwalmsley
Dec 18 2015 14:27
oh... when my editor first loads... for some reason the scollbar doesnt seem to know the full scroll size...
but then when I resize window a little
it gets it right
Darnell Williams
@Seeker1437
Dec 18 2015 14:28
Weird.
danwalmsley
@danwalmsley
Dec 18 2015 14:29
might be a bug
since the first time it calls the measure and arrange methods correctly
then when I resize it does it again..
as expected..
Steven Kirk
@grokys
Dec 18 2015 14:30
are you calling InvalidateScroll in arrange?
danwalmsley
@danwalmsley
Dec 18 2015 14:30
yes
 protected override Size ArrangeOverride(Size finalSize)
        {
            var result = finalSize;

            if (TextDocument != null)
            {
                GenerateTextProperties();

                viewport = new Size(finalSize.Width, finalSize.Height / CharSize.Height);
                extent = new Size(finalSize.Width, TextDocument.LineCount + 20);


                InvalidateScroll.Invoke();
                // scan visual lines, find largest for width....
                //return base.MeasureOverride(availableSize);
                //return new Size(1000, (TextDocument.LineCount) * CharSize.Height);                
            }

            return result;
        }

        protected override Size MeasureOverride(Size availableSize)
        {
            Size result = availableSize;

            if (TextDocument != null)
            {
                GenerateTextProperties();

                result = new Size(availableSize.Width, TextDocument.LineCount * CharSize.Height);
            }

            return result;
        }
Steven Kirk
@grokys
Dec 18 2015 14:31
hmm ok, sounds like a bug then
Darnell Williams
@Seeker1437
Dec 18 2015 14:31
hmmm
Actions are synchronous right? I know that is just the weirdest question i can ask. XD
danwalmsley
@danwalmsley
Dec 18 2015 14:33
depends how you call them
Darnell Williams
@Seeker1437
Dec 18 2015 14:34
Action.Invoke()
Steven Kirk
@grokys
Dec 18 2015 14:38
calling invoke on an Action is just action()
so it's a regular method call
though i can think of weirder questions to ask ;)
Darnell Williams
@Seeker1437
Dec 18 2015 14:40
I was curious because I have over engineered something that uses actions all over the place XD I just need to make sure when I call an action the background worker won't continue until it is done XD
danwalmsley
@danwalmsley
Dec 18 2015 14:50
@grokys do you think it is possible for me to only render lines that change...
i.e. the selected line
or when render is called is the canvas blank
and I need to fully render each time>
?
Steven Kirk
@grokys
Dec 18 2015 14:51
no, the canvas won't be blanked
however we don't paint dirty rect rects, so it might not work as expected
ah
hold on
no, because we don't handle dirty rects the canvas will be blank
danwalmsley
@danwalmsley
Dec 18 2015 14:52
its not slow anyway
im just seeing farly high cpu usage
to just render the caret flickering
Steven Kirk
@grokys
Dec 18 2015 14:52
hmm yeah
we need to sort out rendering so it doesn't render the whole window on every frame
danwalmsley
@danwalmsley
Dec 18 2015 14:53
blob
if you see the graph
on right
Steven Kirk
@grokys
Dec 18 2015 14:53
haha for a second i thought that was avalon studio!
danwalmsley
@danwalmsley
Dec 18 2015 14:53
i could reduce that by not re-rendering all the text...
Steven Kirk
@grokys
Dec 18 2015 14:53
i thought "wow he's got a lot done"
danwalmsley
@danwalmsley
Dec 18 2015 14:53
hmmm i wish
I need @ImaBrokeDude to get the dock working for it to look like that
;D
Darnell Williams
@Seeker1437
Dec 18 2015 15:00
hehehe :D
I am working on that right now :D
some of the properties I set in here don't have to be full PerspexPropertys and should just be DirectPropertys, so i am going through and getting those done
danwalmsley
@danwalmsley
Dec 18 2015 15:05
@grokys is there a way to increase keyboard repetition rate...
when I hold down key
id expect to receive key events a little faster than I am doing
danwalmsley
@danwalmsley
Dec 18 2015 15:14
@grokys im trying to get my margins working again
I basically need the control... which now inherits from panel
to kind of wrap itself in another control, in the visual tree
like a stackpanel
Steven Kirk
@grokys
Dec 18 2015 15:14
keyboard reapeat rate comes from the OS
danwalmsley
@danwalmsley
Dec 18 2015 15:14
then add the margins...
re: keyboard rate... when I hold down in visual studio, its very fast... in my app its much slower... almost 10 times id say...
Steven Kirk
@grokys
Dec 18 2015 15:15
could be the slow repaints are making it seem like the key repeat is slow
danwalmsley
@danwalmsley
Dec 18 2015 15:15
will investigage further
so is it possible my control can kind of wrap itself inside a stackpanel... but in the visual tree, not the logical one?
Steven Kirk
@grokys
Dec 18 2015 15:40
not sure what you mean
danwalmsley
@danwalmsley
Dec 18 2015 16:15
basically im not sure how to add controls to my textview control
to how to get any control to be inserted on the left of my text editor
if I add them as visual children, then they can only be drawn over the editor
Steven Kirk
@grokys
Dec 18 2015 16:36
you wouldn't usually add visual or logical children yourself
you should use an existing control to do so
except in advanced scenarios, which you might have
you know that even if you derive from an existing control, you can still render directly to that control?
Steven Kirk
@grokys
Dec 18 2015 16:42
but even if you add them yourself to the visual tree/logical tree you can still position them where you want
in ArrangeOverride
my advice would be to see how AvalonEdit does it
danwalmsley
@danwalmsley
Dec 18 2015 16:57
if I derive from a templated control, can I still render to it?
that would probably make it a lot easier
ok going to have another look into AvalonEdit... hopefully my eyes dont start bleeding like last time
Steven Kirk
@grokys
Dec 18 2015 17:09
yeah, you can still render to a templated control
Steven Kirk
@grokys
Dec 18 2015 17:31
@donandren nice work on Expander!
Andrey Kunchev
@donandren
Dec 18 2015 17:44
thanks
i've reviwed the notes and updated the Pr
Steven Kirk
@grokys
Dec 18 2015 17:47
CI has finished, so I will merge
the consistency between pseudoclass and property selectors isn't so important
there are worse things in our styles! ;)
Andrey Kunchev
@donandren
Dec 18 2015 17:50
another thing I've noticed: if Expander style is placed before ToggleButton Style (in the Theme xaml) . The template for the togglebutton in expander is not the one specified in the expander style
not sure is that a problem or not
Steven Kirk
@grokys
Dec 18 2015 17:52
oh... strange - yeah that sounds like a bug
could you file an issue so i don't forget to investigate that?
Andrey Kunchev
@donandren
Dec 18 2015 17:53
ok
Steven Kirk
@grokys
Dec 18 2015 17:53
do the memory leaks seem to be better now?
Andrey Kunchev
@donandren
Dec 18 2015 17:54
I'll check
yes no memory leaks in the same test for switching between tabs on a TestApplication
Andrey Kunchev
@donandren
Dec 18 2015 18:08
@grokys I'm working on a LayoutTransformControl and made some MatrixOperations for transform Rect and Transform Point. Do you think these operations should be added to Matix class (or extension methods) ?
Steven Kirk
@grokys
Dec 18 2015 18:09
what are the methods?
Andrey Kunchev
@donandren
Dec 18 2015 18:09
I've made TransformRect(Matrix,Rect) returning Rect and TransformPoint(Matrix,Point) returning Point
Steven Kirk
@grokys
Dec 18 2015 18:10
yeah, they should be on either matrix or rect/point definitely
maybe look to other frameworks (WPF, SharpDX) etc for inspiration for where to put them
thinking about it, they should probably be on Rect and Point
Andrey Kunchev
@donandren
Dec 18 2015 18:13
in WPF matrix has method Transform for Point and Rect has Transform with Matrix paramether
yes may be extension methods for Rect, Point will be the best for me
Steven Kirk
@grokys
Dec 18 2015 18:13
i think putting them on the type to be transformed is most extensible
as that way if we add another primitive, Matrix doesn't need to be changed
don't bother with extension methods, i think they're basic operations so put them directly in the struct
Darnell Williams
@Seeker1437
Dec 18 2015 18:20
FOr TextBlock do you think would could support more TextTrimming capabilities?

like for example

standard would do

hello, my name is Dar... (CharacterTrimming)
hello, my name is... (WordTrimming)
Why not also
hello, my ... is Darnell(Maybe FilePath Trimming?)
... my name is Darnell(Trimming in the beginning (Character or Word Trimming))

danwalmsley
@danwalmsley
Dec 18 2015 18:29
@grokys hi, im trying out templated control, and rendering into it...
is it possible to somehow say
this part of the template is the rendering surface
used for Render,, or will that always be the entire control?
Steven Kirk
@grokys
Dec 18 2015 18:40
You could place a transparent rectangle where you want to render?
danwalmsley
@danwalmsley
Dec 18 2015 18:42
I was thinking when you are drawing into the space where the rectange is
how do you know its Bounds, since bounds will give you the entire width?
ah I guess I render agains rectange.bounds?
danwalmsley
@danwalmsley
Dec 18 2015 18:53
<Styles xmlns="https://github.com/perspex" xmlns:local="clr-namespace:AvalonStudio.TextEditor.Rendering;assembly=AvalonStudio">
  <Style Selector="local|TextView">
    <Setter Property="Template">
      <ControlTemplate>
        <Border Name="border"
                Background="{TemplateBinding Background}"
                BorderBrush="Red"
                BorderThickness="8"
                Padding="0">
          <StackPanel Name="marginContainer" Orientation="Horizontal">
            <Grid Background="Red" Width="100" Height="100"/>
          </StackPanel>
        </Border>
      </ControlTemplate>
    </Setter>
  </Style>
</Styles>
produced...
blob
the red spot if from the border
its as if its not measuring perhap
Steven Kirk
@grokys
Dec 18 2015 19:09
not sure what i'm seeing there...
anyway, sorry got to go out!
danwalmsley
@danwalmsley
Dec 18 2015 19:09
ok no worries
i just expected the border in the template
to be given a size the same as the TemplatedControl...
but is size is 0
so thats why there is a red square
danwalmsley
@danwalmsley
Dec 18 2015 19:15
ah fixed it...
in arrangeoveride
I had to do
base.ArrangeOverride(finalSize);
danwalmsley
@danwalmsley
Dec 18 2015 20:33
@grokys thanks for all help today.. everything working again correctly now on IScrollInfo
in the end I used an Invisible Rectangle, and I used that for bounds to render to...
works perfectly.
danwalmsley
@danwalmsley
Dec 18 2015 21:04
@grokys I found the source of my slow performance issue on the texteditor... the rendering is fast enough
but when the solution explorer is loaded with large project, the treeview has 1000s of expanded items... you noticed it was sluggish the other day
that slows the entire application down...
so it must be re-rendering or something even when it doesnt.
shall I file an issue?
Steven Kirk
@grokys
Dec 18 2015 21:05
Hmm OK. Looks like we need to think about tree view virtualization too then
Darnell Williams
@Seeker1437
Dec 18 2015 21:05
Yeah but isnt that another case where ot could be a virtualizing panel?
danwalmsley
@danwalmsley
Dec 18 2015 21:06
yeh
as soon as its collapsed... everything is fine and dandy
any way im stopping for tonight... thanks guys!!!
Darnell Williams
@Seeker1437
Dec 18 2015 21:07
hm
Yesh that was going to be my next suggestion (closed by default) have a good night