These are chat archives for AvaloniaUI/Avalonia

26th
Jan 2016
Taryn
@Phrohdoh
Jan 26 2016 00:14
What should I do to fix my build issues?
Wiesław Šoltés
@wieslawsoltes
Jan 26 2016 08:45

ok, that implementation seems to work according to my tests - @wieslawsoltes

@grokys Tested the fix and works great!

Steven Kirk
@grokys
Jan 26 2016 09:54
@Phrohdoh this is on OSX right?
i'm afraid i don't have OSX
but it looks like something is missing from mono to me, maybe?
Ivan Kochurkin
@KvanTTT
Jan 26 2016 11:57
What is the best way to name StartPoint and EndPoint for line? Leave as is or replace with more short form: P1 and P2?
Steven Kirk
@grokys
Jan 26 2016 12:14
hmm, not sure. both are fine with me, but maybe StartPoint and EndPoint are more descriptive?
Nikita Tsukanov
@kekekeks
Jan 26 2016 12:26

@Phrohdoh

Build failed. https://gist.github.com/Phrohdoh/174e0c1b001c999fcb4e

Unload Perspex.Designer project, it requires WPF

Darnell Williams
@Seeker1437
Jan 26 2016 17:08
I should be getting one soon
:D
anyways errm is there a safe way to get the MainThread?
(aka Perspex's UIThread)
Taryn
@Phrohdoh
Jan 26 2016 18:01
@kekekeks Ok, will do.
Darnell Williams
@Seeker1437
Jan 26 2016 18:03
@grokys sorry I meant the actual thread object, not the duspatcher
Steven Kirk
@grokys
Jan 26 2016 18:28
ah.. i seem to remember you asked this before
not currently - but you can just save it somewhere from the main thread
Darnell Williams
@Seeker1437
Jan 26 2016 18:28
I think I did, but then I never got around to doing ti xD
Sorry about that!
My concern was because it is being used for a control is that a plausible solution? should I save the thread in the control's ctor or something?
Steven Kirk
@grokys
Jan 26 2016 18:30
yeah, that would work
we should probably expose it from Dispatcher
José Manuel Nieto
@SuperJMN
Jan 26 2016 18:40

sorry @SuperJMN i'm going to remove your implementation and replace it with https://github.com/xyzzer/WinRTXamlToolkit/blob/master/WinRTXamlToolkit.UWP/Controls/DockPanel/DockPanel.cs

Sorry, I think I missed some concepts before implementing it. Anyways, I learnt a little bit of something that I consider useful. Thanks for your opportunity :)

Steven Kirk
@grokys
Jan 26 2016 18:55
no problem! sorry for the removal, it was just easier to copy a working implementation than to work out what yours was doing ;)
José Manuel Nieto
@SuperJMN
Jan 26 2016 18:59
pure logic
I would have done the same
don't worry
Taryn
@Phrohdoh
Jan 26 2016 19:06
Unloading the Designer project didn't help my build issue at all.
Steven Kirk
@grokys
Jan 26 2016 19:15
what version of mono are you using?
Taryn
@Phrohdoh
Jan 26 2016 19:15
4.3.0
Steven Kirk
@grokys
Jan 26 2016 19:17
hmm, should work
has anyone else tried building on osx recently?
Steven Kirk
@grokys
Jan 26 2016 19:54
@Phrohdoh what are your compile errors without the Designer project?
Nikita Tsukanov
@kekekeks
Jan 26 2016 20:11

has anyone else tried building on osx recently?

We need a CI-server, told ya

Steven Kirk
@grokys
Jan 26 2016 20:12
i didn't say we didn't as far as i remember!
who provides a free CI for mono on OSX?
Taryn
@Phrohdoh
Jan 26 2016 21:03
Practically no one. Travis is super expensive for OS X.
@grokys I'll recompile later and gist the output again.
Darnell Williams
@Seeker1437
Jan 26 2016 21:26
idk if I've asked this before x3
But errrm I can't find a control that has any events on them? How do I handle events?
Like SelectionChanged or something like that
AH nvm sorry about that :D
Taryn
@Phrohdoh
Jan 26 2016 21:30
Care to share what you found out for those of us who don't know yet?
Steven Kirk
@grokys
Jan 26 2016 21:36
you handle SelectionChanged like you would in WPF: listBox.SelectionChanged += ListBoxSelectionChangedHandler
Darnell Williams
@Seeker1437
Jan 26 2016 21:36

Ah yeah, so for example I needed to eb abel to use a routed evetn

To do so with Perspex is for example

        public static readonly RoutedEvent<SelectionChangedEventArgs> SelectedDatesChangedEvent =
            RoutedEvent.Register<Calendar, SelectionChangedEventArgs>("SelectedDatesChanged", RoutingStrategies.Bubble);
Steven Kirk
@grokys
Jan 26 2016 21:37
why doesn't listBox.SelectionChanged += ListBoxSelectionChangedHandler work?
Taryn
@Phrohdoh
Jan 26 2016 21:38
Yeah I'd rather the subscription with += because using strings inplace of a method name is bad.
Steven Kirk
@grokys
Jan 26 2016 21:38
all controls have a ton of events... i'm not sure what you mean @ImaBrokeDude
Darnell Williams
@Seeker1437
Jan 26 2016 21:38
Right I am in the process of writing a control and was not sure how to add an event that people could subscribe to
I wanted to follow the Perspex as closely as possible
Steven Kirk
@grokys
Jan 26 2016 21:39
you do it exactly the same as WPF - https://msdn.microsoft.com/library/ms752288(v=vs.100).aspx look for // Provide CLR accessors for the event
perspex creates a CLR event for the GotFocus routed event
Darnell Williams
@Seeker1437
Jan 26 2016 21:43
AH okay! just one last question then, I noticed SelectionChangedEventArgs doesn't exist in Perspex is there an equivalent?
Taryn
@Phrohdoh
Jan 26 2016 21:44
With Perspex can I make controls have a fixed size and position, or is it gtk-style?
Darnell Williams
@Seeker1437
Jan 26 2016 21:44
YYes it does....
nvm I just can't figure out why i can't reference it
AH it was added within the last 15 days :D
time to update :D
Steven Kirk
@grokys
Jan 26 2016 21:45
@Phrohdoh we use the same layout system as WPF
so everything is dynamically sized
Taryn
@Phrohdoh
Jan 26 2016 21:46
:( ok.
Steven Kirk
@grokys
Jan 26 2016 21:46
why :( ?
Taryn
@Phrohdoh
Jan 26 2016 21:46
I much prefer winforms-style control layout over gtk.
But seems I'll have to learn the gtk way as everything uses it nowadays.
Steven Kirk
@grokys
Jan 26 2016 21:48
well you can make everything fixed size and absolutely positioned if you like
but IMO it makes for difficult code or bad non-resizable user interfaces
anyway, i've been investigating our layout performance problems that manifest themselves in devtools
the good news is that it doesn't seem to be caused by our layout system
Steven Kirk
@grokys
Jan 26 2016 21:53
the bad news is that it's caused by Grid
Taryn
@Phrohdoh
Jan 26 2016 21:53
Meaning a perf hit in design time?
Steven Kirk
@grokys
Jan 26 2016 21:53
perf hit for any application that has a Grid containing lots of controls
seems its performance doesn't scale well at all
i ported Grid from moonlight
so nobody understands how it works :(
Taryn
@Phrohdoh
Jan 26 2016 21:55
How are those two related?
Darnell Williams
@Seeker1437
Jan 26 2016 21:55
@grokys sorta like this?
public static readonly RoutedEvent<SelectionChangedEventArgs> SelectedDatesChangedEvent =
    RoutedEvent.Register<Calendar, SelectionChangedEventArgs>("SelectedDatesChanged", RoutingStrategies.Direct);

/// <summary>
/// Occurs when a date is selected.
/// </summary>
public event EventHandler<SelectionChangedEventArgs> SelectedDatesChanged
{
    add { AddHandler(SelectedDatesChangedEvent, value); }
    remove { RemoveHandler(SelectedDatesChangedEvent, value); }
}
Steven Kirk
@grokys
Jan 26 2016 21:56
@ImaBrokeDude yep exactly
Taryn
@Phrohdoh
Jan 26 2016 21:56
I'm working on my own designer built on top of a dsl and hoping to use Perspex as a good knowledgebase. So sorry if my questions seem harsh
Steven Kirk
@grokys
Jan 26 2016 21:56
@Phrohdoh sorry I didn't understand the question. what "two"?
Taryn
@Phrohdoh
Jan 26 2016 21:56
Porting from moonlight and noone understanding how it works.
Steven Kirk
@grokys
Jan 26 2016 21:57
ah... well because nobody who works on Perspex wrote it
it was written in C++ in moonlight
and i just converted the code to C#
Taryn
@Phrohdoh
Jan 26 2016 21:58
Alright, another question. Is Perspex's designer dogfooded currently or is it "write some xaml and load up perspex"?
Ah I didn't realize moonlight was written in C++
Steven Kirk
@grokys
Jan 26 2016 21:58
a lot of moonlight is C++ yes
our designer has lots of problems ;)
Darnell Williams
@Seeker1437
Jan 26 2016 21:58
In regards tot he designer, dogfooled?
Taryn
@Phrohdoh
Jan 26 2016 21:59
Mine does too, but everyone starts somewhere :)
Darnell Williams
@Seeker1437
Jan 26 2016 21:59
lol :)
the actualy view is injected ins a WinForms COntrol then displayed using magic
XD
@kekekeks can tell you much more accurately what is happening in the background
Steven Kirk
@grokys
Jan 26 2016 22:03
we have a number of problems in the designer currently, some of which are awaiting fixes from OmniXAML
but nobody is really working a lot on it
Darnell Williams
@Seeker1437
Jan 26 2016 22:08
AH I really hate asking questions, what is the best practice for listening to changes in a Perspec Property. Is there a way I can supply it a callback?
Im guess validate is used for Coercing and notifying is the changed callback?
Steven Kirk
@grokys
Jan 26 2016 22:31
if you're writing a control you usually do it like this: https://github.com/Perspex/Perspex/blob/master/src/Perspex.Controls/DropDown.cs#L46
or you can call .GetObservable(FooProperty) on the instance
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:32
Currently designer has separate engines for code completion and XAML preview
The preview part is basically a separate process that loads all compiled binaries and tries to load provided XAML
Then perspex window is injected back to visual studio
XAML editor uses a half-assed XML parser and metadata from compiled assemblies to provide some intellisense
Steven Kirk
@grokys
Jan 26 2016 22:39
i've tried changing the hot path of Grid to use pointers instead of array indexing and it speeds it up a bit, but not nearly enough
Taryn
@Phrohdoh
Jan 26 2016 22:40
Oh, so your designer is directly coupled with VS then? :(
Steven Kirk
@grokys
Jan 26 2016 22:40
seems that the number of times that code needs to be run is rows * columns which makes it exponential
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:41
Designer (aka XAML preview) itself can be launched separately
Code completion is currently coupled with VS
But there are no direct dependencies on VS
Taryn
@Phrohdoh
Jan 26 2016 22:41
Okay, I don't see a need for hand-rolled code-completion, but it is good to know users aren't tied to an IDE.
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:42
Porting designer isn't recommended until we'll get proper embedding support
Steven Kirk
@grokys
Jan 26 2016 22:42
it's doing a crazy number of iterations of the row and column matrixes for a 3*76 grid
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:43
When I'll get embedding support up and running I'm planning to get some standalone app with XAML editor/preview
Steven Kirk
@grokys
Jan 26 2016 22:43
so... anyone fancy writing a performant Grid? ;)
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:43
That would be easily embedded in any IDE
You'll need something like GtkSocket and a way to notify it about build events
@grokys Why does StreamGeometryImpl need to know about Transform?
And subsribe to events
It's better to handle on higher level
And you don't subsribe to changed event for some reason
Taryn
@Phrohdoh
Jan 26 2016 22:48
Interesting. How do you plan on building an embeddable designer? The designers I've played with are all built with a single use/ide/whatever in mind.
Steven Kirk
@grokys
Jan 26 2016 22:48
hmm, can't remember - that was a long time ago, let me try and remember
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:48
@Phrohdoh I don't see anything that XAML preview needs from IDE
And we can have our own text editor
Taryn
@Phrohdoh
Jan 26 2016 22:49
Right but the preview itself has to exist in some window which is tied to a gl context somehow.
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:49
Ehm
Windows are nested, you know
Taryn
@Phrohdoh
Jan 26 2016 22:50
I think we're talking about different things.
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:50
user32!SetParent, libX11.so!XReparentWindow, etc
Steven Kirk
@grokys
Jan 26 2016 22:50
@kekekeks it looks like it uses D2D's TransformedGeometry to get the bounds of geometry when a transform is applied
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:50
@grokys I'm talking about different matter
Steven Kirk
@grokys
Jan 26 2016 22:50
as that accepts a stroke thickness
ah.. ok, must've misunderstood. what were you talking about?
Nikita Tsukanov
@kekekeks
Jan 26 2016 22:51
Oh, wait
Nevermind, I've just mistyped something
And got a wrong type in IDE
And got confused a bit
Steven Kirk
@grokys
Jan 26 2016 22:55
ah ok :)
Steven Kirk
@grokys
Jan 26 2016 23:07
the crazy thing about Grid is even if the rows and columns are all * - i.e. the sizes can be known be dividing the available size
it still does a crazy amount of work that shouldn't even be necessary
i think the first thing i'm going to do is bring these tests into perspex: https://github.com/mono/moon/blob/master/test/2.0/moon-unit/System.Windows.Controls/GridTest.cs
Nikita Tsukanov
@kekekeks
Jan 26 2016 23:29
@KvanTTT Perspex/Perspex@a74e9b3
Nikita Tsukanov
@kekekeks
Jan 26 2016 23:40
@Phrohdoh Perspex/Perspex@3556a66