Re: [Lazarus] Inversion of control (IoC) and Dependency injection (DI)

2015-01-05 Thread luiz americo pereira camara
2015-01-05 21:44 GMT-03:00 Marcos Douglas :

> On Mon, Jan 5, 2015 at 6:07 PM, luiz americo pereira camara
> >
> > I created a IoC Container that can be found at
> >
> https://code.google.com/p/luipack/source/browse/trunk/luicomponents/luiioccontainer.pas
> > . It has no dependencies.
>
> >
> > So in the end, i use the service locator and have plans to use Property
> > Injection pattern
> >
> > BTW: Custom Attributes support would help to have a nicer Property
> Injection
> > implementation
>
> Interesting.
> Could you give us some example how this class works?
>
>
There's a demo in demos/ioccontainer

In a working project i use a IPresentationManager
https://code.google.com/p/luipack/source/browse/trunk/luicontrols/presentationmanager.pas#36

When a class needs to use it, resolves from a TIoCContainer (Service
Locator pattern). The global variable and concrete class are not exposed.
In the other hand depends of the IoCContainer. I have plans to switch to a
Property Injection pattern that helps to decouple a bit more.

Luiz
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TMPlayerControl

2015-01-05 Thread Michael Thompson
G'day,

> -fs does not appear in parameters list ... correct?

Correct.  -fs does not appear when I call "mplayer -input cmdlist".

I note it does appear in the following page though:
http://mplayerhq.hu/DOCS/man/en/mplayer.1.html#GENERAL%20OPTIONS

Maybe they're more diligent on updating the web than the cmdlist?

I also note there is a "get_vo_fullscreen" property in the "mplayer -input
cmdlist" output, which implies a "set_vo_fullscreen" (though none is listed)

And finally I note there's a caveat on the webpage saying -fs doesn't work
with all video drivers...

Using MPlayer on Windows, despite no -fs appearing in the above, I can
still play video in full screen passing the -fs parameter.  Which means
this *should* work in the Lazarus TMplayerControl control by simply adding
-fs to StartParam.

How this works in reality though I'm unsure :-)  If you get a chance to
experiment, I'd love to know the results.  From the documentation I've
found so far, I'm unsure how to toggle FullScreen, and how to determine
which monitor gets the video...

I also suspect this conversation is going to veer more into the mplayer
arena than the Lazarus arena, so I'm happy for this continue as a personal
email chain (just reply to me, not to Lazarus).  I'll update the wiki with
the outcome

http://wiki.freepascal.org/TMPlayerControl

Mike
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] Inversion of control (IoC) and Dependency injection (DI)

2015-01-05 Thread Marcos Douglas
On Mon, Jan 5, 2015 at 6:07 PM, luiz americo pereira camara
 wrote:
> Starting a new thread.
>
>
> 2015-01-05 15:16 GMT-03:00 silvioprog :
>>
>> On Mon, Jan 5, 2015 at 12:54 PM, Marco van de Voort 
>> wrote:
>>>
>>>
>>> As a first step in the 3.0.0 release process the stable branch was
>>> branched
>>> off to branches/fixes_3_0 and the version number was updated to 3.0.1
>>>
>>> The version in trunk was raised to 3.1.1
>>>
>>> Scripts might need modification accordingly.
>>
>>
>> Good news!
>>
>> Chances of custom attributes[1] (or something like this) in release 3.0? I
>> have plans to use IoC[2] and DI using this feature.
>>
>
> I created a IoC Container that can be found at
> https://code.google.com/p/luipack/source/browse/trunk/luicomponents/luiioccontainer.pas
> . It has no dependencies.
>
> With it is possible to implement Service Locator and Property Injection
> patterns. Constructor Injection is not possible due to lacking of Extended
> RTTI support in fpc.
>
> While the C# crowd  praises the Constructor Injection pattern (
> http://www.devtrends.co.uk/blog/how-not-to-do-dependency-injection-the-static-or-singleton-container
> ), i had hard times figuring how it would work in real world / Lazarus
> projects. Also, polluting the constructor  signature is not something that i
> like. And finally with Constructor Injection is not possible to use with
> TComponent / TForm
>
> So in the end, i use the service locator and have plans to use Property
> Injection pattern
>
> BTW: Custom Attributes support would help to have a nicer Property Injection
> implementation

Interesting.
Could you give us some example how this class works?

Regards,
Marcos Douglas

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TMPlayerControl

2015-01-05 Thread Philippe
 

Em 05.01.2015 20:58, Michael Thompson escreveu: 

> G'day, 
> 
> On
5 January 2015 at 23:24, Philippe  wrote:
> 
>>
someone may confirm: 
>> 
>> TMPlayerControl does not allow fullscreen
option.
> 
> When I extended the control last year I did not test full
screen - in fact I didn't even consider it. So long as MPlayer supports
this though, I can't see that there should be a problem. I will play
with this later today and get back to you. 
> 
> Are you on Linux or
Windows? Short term, I'll only have Windows to test on... 
> 
> Mike

>
Windows.
 -fs does not appear in parameters list ... correct?


--
___
Lazarus mailing
list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/list>


> 
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] TMPlayerControl

2015-01-05 Thread Michael Thompson
G'day,

On 5 January 2015 at 23:24, Philippe  wrote:

>  someone may confirm:
>
> TMPlayerControl does not allow fullscreen option.
>
>
When I extended the control last year I did not test full screen - in fact
I didn't even consider it.   So long as MPlayer supports this though, I
can't see that there should be a problem.   I will play with this later
today and get back to you.

Are you on Linux or Windows?  Short term, I'll only have Windows to test
on...

Mike
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Inversion of control (IoC) and Dependency injection (DI)

2015-01-05 Thread luiz americo pereira camara
Starting a new thread.


2015-01-05 15:16 GMT-03:00 silvioprog :

> On Mon, Jan 5, 2015 at 12:54 PM, Marco van de Voort 
> wrote:
>
>>
>> As a first step in the 3.0.0 release process the stable branch was
>> branched
>> off to branches/fixes_3_0 and the version number was updated to 3.0.1
>>
>> The version in trunk was raised to 3.1.1
>>
>> Scripts might need modification accordingly.
>
>
> Good news!
>
> Chances of custom attributes[1] (or something like this) in release 3.0? I
> have plans to use IoC[2] and DI using this feature.
>
>
I created a IoC Container that can be found at
https://code.google.com/p/luipack/source/browse/trunk/luicomponents/luiioccontainer.pas
. It has no dependencies.

With it is possible to implement Service Locator and Property Injection
patterns. Constructor Injection is not possible due to lacking of Extended
RTTI support in fpc.

While the C# crowd  praises the Constructor Injection pattern (
http://www.devtrends.co.uk/blog/how-not-to-do-dependency-injection-the-static-or-singleton-container
), i had hard times figuring how it would work in real world / Lazarus
projects. Also, polluting the constructor  signature is not something that
i like. And finally with Constructor Injection is not possible to use with
TComponent / TForm

So in the end, i use the service locator and have plans to use Property
Injection pattern

BTW: Custom Attributes support would help to have a nicer Property
Injection implementation

Luiz
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] HEADS UP: FPC 3.0.1 stable branched off.

2015-01-05 Thread Michael Van Canneyt



On Mon, 5 Jan 2015, silvioprog wrote:


On Mon, Jan 5, 2015 at 12:54 PM, Marco van de Voort  wrote:

  As a first step in the 3.0.0 release process the stable branch was 
branched
  off to branches/fixes_3_0 and the version number was updated to 3.0.1

  The version in trunk was raised to 3.1.1

  Scripts might need modification accordingly.


Good news!

Chances of custom attributes[1] (or something like this) in release 3.0? I have 
plans to use IoC[2] and DI using this feature.


No. One of the reasons for branching off 3.0 now is that the custom attributes 
can be merged to trunk
(or so I understood)

Michael.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] Gtk3 - Set entry placeholder

2015-01-05 Thread Krzysztof
Hi,

I'm testing Gtk3 (I know that it is in alpha stage). I have latest lazarus
from svn (1.3)

When using low level Gtk3 api then this code work fine:

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Interfaces, // this includes the LCL widgetset
  LazGtk3, LazGObject2;

{$R *.res}

var
  window: PGtkWindow;
  entry1, entry2: PGtkWidget;
  vbox: PGtkWidget;

begin
  gtk_init (@argc, @argv);

  window := gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (window, 'Window');

  g_signal_connect_data(window, 'destroy', TGCallback(@gtk_main_quit), nil,
nil, 0);

  vbox := gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
  gtk_container_add (PGtkContainer(window), vbox);

  entry1 := gtk_entry_new ();
  gtk_entry_set_text(PGtkEntry(entry1), 'Hello');

  entry2 := gtk_entry_new ();
  gtk_entry_set_placeholder_text(PGtkEntry(entry2), '');

  gtk_box_pack_start(PGtkBox(vbox), entry1, True, True, 0);
  gtk_box_pack_start(PGtkBox(vbox), entry2, True, True, 0);

  gtk_widget_show_all (window);

  gtk_main ();
end.

But if I create LCL application, then change LCLWidgetType to Gtk3 and call
this:

procedure TForm1.Button1Click(Sender: TObject);
begin
  gtk_entry_set_placeholder_text(Edit1.Handle), PChar('Test'));
end;

Then it doesn't work. Edit1.Handle should point to gtk widget right?
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] HEADS UP: FPC 3.0.1 stable branched off.

2015-01-05 Thread Vojtěch Čihák

So finally there'll be no 2.8 ?
 
Anyway, it works well. I just updated to 29419 and built it with 2.6.4.
Lazarus compiled well too. Just have Lazarus 1.3 r47310M FPC 3.1.1 
x86_64-linux-qt.
 
Thanks
 
Vojtěch 
__

Od: Marco van de Voort 
Komu: 
Datum: 05.01.2015 16:55
Předmět: [Lazarus] HEADS UP: FPC 3.0.1 stable branched off.



As a first step in the 3.0.0 release process the stable branch was branched
off to branches/fixes_3_0 and the version number was updated to 3.0.1

The version in trunk was raised to 3.1.1

Scripts might need modification accordingly.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus 


--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


Re: [Lazarus] HEADS UP: FPC 3.0.1 stable branched off.

2015-01-05 Thread silvioprog
On Mon, Jan 5, 2015 at 12:54 PM, Marco van de Voort  wrote:

>
> As a first step in the 3.0.0 release process the stable branch was branched
> off to branches/fixes_3_0 and the version number was updated to 3.0.1
>
> The version in trunk was raised to 3.1.1
>
> Scripts might need modification accordingly.


Good news!

Chances of custom attributes[1] (or something like this) in release 3.0? I
have plans to use IoC[2] and DI using this feature.

Thank you!

[1] - http://forum.codecall.net/topic/76463-introducing-attribute/
[2] - http://martinfowler.com/articles/injection.html
--
Silvio Clécio
My public projects - github.com/silvioprog
--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] HEADS UP: FPC 3.0.1 stable branched off.

2015-01-05 Thread Marco van de Voort

As a first step in the 3.0.0 release process the stable branch was branched
off to branches/fixes_3_0 and the version number was updated to 3.0.1

The version in trunk was raised to 3.1.1

Scripts might need modification accordingly.

--
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


[Lazarus] TMPlayerControl

2015-01-05 Thread Philippe
 

someone may confirm: 

TMPlayerControl does not allow fullscreen
option. 

Philippe --
___
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus