Re: [Lazarus] Embedded font

2017-02-06 Thread Luca Olivetti via Lazarus

El 06/02/17 a les 22:06, Darius Blaszyk via Lazarus ha escrit:

Hi,

Is it possible to embed a font for a GUI application in Lazarus in a
platform independent way? I've been looking on the internet and I only
found windows specific solutions so far.


You already know the windows way, so I'll omit it.

With qt you can use QFontDatabase_addApplicationFont, e.g.

uses qt4;
...
procedure TForm1.FormCreate(Sender: TObject);
var ws:WideString;
begin
  ws:='/file/with/the/font.ttf';
  QFontDatabase_addApplicationFont(@ws)
end;


There's also a addApplicationFontFromData if you want to load the font 
from a resource.


With GTK you can use fontconfig, e.g.

uses fontconfig;

function FcConfigAppFontAddFile(config:pointer; 
fname:Pchar):FcBool;stdcall;external 'libfontconfig.so';



procedure TForm1.FormCreate(Sender: TObject);
var
  res: FcBool;
begin
  res:=FcConfigAppFontAddFile(nil,'/file/with/the/font.ttf');
end;


There isn't a function to load the font from data, so if you want to use 
resources I guess you should save it to a temporary file and load the 
font from it.


What I couldn't find is a way to know if the application is using qt or 
gtk (or win): LCLWidgetType is an ide macro, not a define.



Bye
--
Luca Olivetti
Wetron Automation Technology http://www.wetron.es/
Tel. +34 93 5883004 (Ext.3010)  Fax +34 93 5883007
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] TDataModule for non-database non-visual components

2017-02-06 Thread Mattias Gaertner via Lazarus
On Mon, 6 Feb 2017 21:17:48 +0200
Kostas Michalopoulos via Lazarus  wrote:

> Hi all,
> 
> A simple question, is it ok to use a TDataModule for non-visual components
> that can be shared among forms (and generally contain app-wide stuff)?

Yes. That's their purpose.


>[...]

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Embedded font

2017-02-06 Thread Darius Blaszyk via Lazarus
Hi,

Is it possible to embed a font for a GUI application in Lazarus in a
platform independent way? I've been looking on the internet and I only
found windows specific solutions so far.

Regards, Darius -- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] TDataModule for non-database non-visual components

2017-02-06 Thread Kostas Michalopoulos via Lazarus
Hi all,

A simple question, is it ok to use a TDataModule for non-visual components
that can be shared among forms (and generally contain app-wide stuff)?
There doesn't seem to be a plain TModule or something like that. I ask
because the docs do not make the distinction clear (the name doesn't help)
and the wiki has it in the database section.

I suspect this is the case and in Delphi/Embarcadero docs it explicitly
mentions that you can use it for non-database components, i just want to
make it sure it wont blow up in the future (and that there isn't another
way to create non-visual components from the IDE) because i just realized
that TDataModule can be used like that (currently i'm creating
non-form-specific components either in the main form or manually via code
in a dedicated unit).

My use case is a few custom non-visual components which can be shared among
forms (and to decouple the logic from the form when it has nothing to do
with it).

Kostas
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Synedit Highligter: hide found character sequence

2017-02-06 Thread Michael Schnell via Lazarus

On 06.02.2017 15:48, Martin Frb via Lazarus wrote:

...

Martin, thanks a lot.

So in fact there is some hope to tweak SynEdit for the task at hand.

If so, it seems that this is a better idea than to write a new Editor 
from scratch.


Thanks again,
-Michael

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


Re: [Lazarus] Synedit Highligter: hide found character sequence

2017-02-06 Thread Martin Frb via Lazarus

On 06/02/2017 11:42, Michael Schnell via Lazarus wrote:

Hi SynEdit Experts,

Doing a special kind of text editor (that in fact needs to feature an 
invisible signature for each word in the text):


Is it possible to do a highlighter that results in hiding the 
character sequences found by the highlighting criterion (in fact on 
screen replaces it by a blank) ?


Not a highlighter, no.

But it may (not sure) be possible writing your custom wrapper to the 
textbuffer.

look at other sub classes to   TSynEditStringsLinked
Also look at TLazSynDisplayViewEx


Look in SynEditFoldedView
TLazSynDisplayFold is a TLazSynDisplayViewEx that visually adds the 
[...] at the end of a fold line.



So TLazSynDisplayViewEx is the place to modify the text.
If your TSynEditStringsLinked is  up high enough in the chain (included 
before (search for) FTheLinesView ) then most parts of synedit will see 
this as the actual text.


The TLazSynDisplayFold  is included after FTheLinesView , so for display 
only (FDisplayView)


-
You also must intercept all the Edit* methods in TSynEditStringsLinked . 
If the editor specifies an x pos, you must map it to the x pos with the 
invisible included and vice versa, also if the editor acts on a 
selection you may have to map the length too.


Note some functions (like matching bracket highlight) require that the 
Highlighter itself delivers tokens for the visible part only (you can 
filter them in TLazSynDisplayViewEx , but that is for painting only)


Of course if your highlighter does filter them, maybe you do not need 
TLazSynDisplayViewEx
You do need to intercept all the Edit* calls. (And watch id new ones get 
added in future)





Is there a way to wrap the (visible) text to a predefined line length 
(using the usual line breaks as paragraph indicator) ?

not yet
again, all the elements from above will be involved.

the tricky bit is to create a map between real line num and wrapped line 
num.

this must be fast for
- lookup in both direction
- insert/remove/change of rows
A normal array may not be efficient enough. (it may be for you, but not 
to include for everyone)



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


Re: [Lazarus] Synedit tab

2017-02-06 Thread Mattias Gaertner via Lazarus
On Mon, 6 Feb 2017 13:21:04 +0100
Michael Schnell via Lazarus  wrote:

> On 06.02.2017 12:56, Mattias Gaertner via Lazarus wrote:
> > I hope this helps:
> > http://wiki.lazarus.freepascal.org/Lazarus_Packages#Package_states  
> Yep, perfect !
> 
> So seemingly the green cross should mean "not used". 

The "Installed" was misleading. I changed to "Install".

The term "used" in this dialog is somewhat difficult, because there
are two sets of "used" IDE packages: The currently running and the
future (used when the IDE is rebuilt).
The left side (install) lists the future "used". Packages with a green
cross are new, i.e. not yet running packages.
 
> Great but 
> doubleclicking moves it to the uninstalled list and there seems no means 
> in the "Install/Uninstall Packages" menu to make it "used", or take you 
> to the menu where it can be set to "used" (and the IDE be recompiled).

The dialog is simple: left side will be installed.
Some packages of the right might be installed automatically due to
dependencies.


>[...]

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Show a window under GTK2 in front without stealing the focus

2017-02-06 Thread Michael Fuchs via Lazarus
Am 19.01.2017 um 15:04 schrieb zeljko:
>> Under windows this works with >> ShowWindow(MyForm.Handle, 
>> SW_SHOWNOACTIVATE); >> But how can I do
this under GTK2? > > Don't know now exactly, but
gtk_window_set_focus_on_map(Window, > False) maybe could help. Have you
looked into gtk2winapi ? eg Qt have > such flag and it can show window
without activating. > > zeljko

Hi,

thanks for your help. With gtk_window_set_focus_on_map and
gtk_window_set_accept_focusit seems to work under GTK.

   MyForm.Visible := True;
   // HACK: SW_SHOWNOACTIVATE is not implemented under GTK2, we will use
a direct GTK calls
   {$IFDEF LCLGTK2}
 GtkWindow := PGtkWindow(MyForm.Handle);
 gtk_window_set_keep_above(GtkWindow, True);
 gtk_window_set_accept_focus(GtkWindow, False);
 gtk_window_set_focus_on_map(GtkWindow, False);
 gtk_window_present(GtkWindow);
   {$ELSE}
 ShowWindow(MyForm.Handle, SW_SHOWNOACTIVATE);
   {$ENDIF}

Unfortunately I discovered that under Windows SW_SHOWNOACTIVATE does not
work as I expected. So in the end, I build a form that inherits from
THintWindow. This resolves my problem.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] DockManager: how to truly close form

2017-02-06 Thread Valdas Jankūnas via Lazarus

Hello,

I decided to use DockManager in my project. I fount that closing 
secondary form by pressing a X button in window of that form it becomes 
hidden not destroyed.
 How to actually close (destroy and free) a secondary from when 
DockManager is used?
 "CloseAction:= caFree" not helped. I tried forcibly "Free" but that 
produces crash of app.


ps: sorry for bad English.

--
  Valdas Jankūnas
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Synedit tab

2017-02-06 Thread Michael Schnell via Lazarus

On 06.02.2017 12:56, Mattias Gaertner via Lazarus wrote:

I hope this helps:
http://wiki.lazarus.freepascal.org/Lazarus_Packages#Package_states

Yep, perfect !

So seemingly the green cross should mean "not used". Great but 
doubleclicking moves it to the uninstalled list and there seems no means 
in the "Install/Uninstall Packages" menu to make it "used", or take you 
to the menu where it can be set to "used" (and the IDE be recompiled).


And with that the text in the Package info window in the 
"Install/Uninstall Packages" menu it should not read "not installed" but 
"not used".


(Using the current svn version of Lazarus.)

Thanks,
-Michael

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


Re: [Lazarus] IDE Component-dialog: small button

2017-02-06 Thread Vojtěch Čihák via Lazarus

AFAIK in Lazarus dialogs is often used component TButtonPanel (Misc palette) 
with OK, Cancel, Close and Help buttons. These buttons are autosized with 
Constraints.MinWidth:=DefButtonSize.cx; (this value is taken from Themes: 
DefButtonSize := ThemeServices.GetDetailSize(Details); it is 75 on Qt).
 
V.
__

Od: C Western via Lazarus 
Komu: Lazarus mailing list 
Datum: 06.02.2017 09:49
Předmět: Re: [Lazarus] IDE Component-dialog: small button


On 06/02/17 02:28, wkitty42--- via Lazarus wrote:
> On 02/05/2017 07:41 PM, Alexey via Lazarus wrote:
>> In this dialog, button Use is too narrow. Can i make diff, to make it
>> wide, e.g.
>> 80pix?
>
> ummm, it looks plenty big enough... all of the letters show with no
> clipping on either side... what am i missing??
>
It looks like a button that has been autosized; I must admit my feeling 
is that autosized buttons should have a minimum width, something like 
the width of a "Cancel" button, say. The general GUI convention seems to 
be to have all buttons of similar sizes, and the lazarus autosize 
algorithm produces buttons that can often look on the small side 
compared to most programs. Turning off autosizing is a bad idea because 
of the variety of system fonts.


Colin
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus 


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


Re: [Lazarus] Synedit tab

2017-02-06 Thread Mattias Gaertner via Lazarus
On Mon, 6 Feb 2017 12:22:06 +0100
Michael Schnell via Lazarus  wrote:

>[...]
> (Regarding Packages there seems to be some ambiguity with "installed" 
> "used" and "loaded". )

I hope this helps:
http://wiki.lazarus.freepascal.org/Lazarus_Packages#Package_states

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Synedit Highligter: hide found character sequence

2017-02-06 Thread Michael Schnell via Lazarus

Hi SynEdit Experts,

Doing a special kind of text editor (that in fact needs to feature an 
invisible signature for each word in the text):


Is it possible to do a highlighter that results in hiding the character 
sequences found by the highlighting criterion (in fact on screen 
replaces it by a blank) ?


Can we do software that with a cursor move event gets/finds the word 
under cursor plus the invisible "highlighted" string before that word ?


Can the highlighted / invisible character sequence be protected from 
being modified by the user's text editing actions ?


Is there a way to wrap the (visible) text to a predefined line length 
(using the usual line breaks as paragraph indicator) ?


If such features are not available does it make sense to do a local fork 
of SynEdit to implement such options or would a different implementation 
be more viable ?


Thanks for any comments !
-Michael


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


Re: [Lazarus] Synedit tab

2017-02-06 Thread Michael Schnell via Lazarus

On 06.02.2017 11:30, Ondrej Pokorny via Lazarus wrote:


Check if you installed syneditdsgn package.
In the "Install/Uninstall Packages" menu in the "Installed" Window there 
is "SynEditDsgn". But other than "SynEdit 1.0" same features a small 
green "+". No Idea if this is an error indication. In the "Package Info" 
it nonetheless says "not installed" (contradicting to it's being listed 
as "installed" ).


Doing "use" in the "open installed packages did the trick: now the 
SynEdit tab is shown. :-)


(Regarding Packages there seems to be some ambiguity with "installed" 
"used" and "loaded". )


Thanks a lot !
-Michael
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Synedit tab

2017-02-06 Thread Ondrej Pokorny via Lazarus

On 06.02.2017 11:20, Michael Schnell via Lazarus wrote:
I tried to open an old project I once started to test using SynEdit. 
It does compile and work, but when trying to see the form I get an 
messages of not installed components. In fact the "sysEdit" tab that 
is described in the Wiki is not seen in the Lazarus IDE. How to 
activate it ?


Check if you installed syneditdsgn package.

Ondrej
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Synedit tab

2017-02-06 Thread Michael Schnell via Lazarus
I tried to open an old project I once started to test using SynEdit. It 
does compile and work, but when trying to see the form I get an messages 
of not installed components. In fact the "sysEdit" tab that is described 
in the Wiki is not seen in the Lazarus IDE. How to activate it ?


Thanks,

-Michael

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


Re: [Lazarus] DateTimePicker not installed?

2017-02-06 Thread Ondrej Pokorny via Lazarus

On 06.02.2017 1:52, Alexey via Lazarus wrote:

I installed pkg DateTimeControls. picture added.


You have to install the design-time package DateTimeCtrlsDsgn.

We have this documented (sometimes we don't forget :) ) 
http://wiki.freepascal.org/Lazarus_1.8.0_release_notes#DateTimeCtrls_split_into_DateTimeCtrls_and_DateTimeCtrlsDsgn_packages


Ondrej
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] DateTimePicker not installed?

2017-02-06 Thread Alexey via Lazarus

I installed pkg DateTimeControls. picture added.

I dont see its controls: DateTimePicker (and DB version) in Components 
dialog (filter "date" dont show). And in CommonControls tab by hands - 
not there too. Rebuilt IDE. (even with Clean, no help).



--
Regards,
Alexey

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


Re: [Lazarus] IDE Component-dialog: small button

2017-02-06 Thread Ondrej Pokorny via Lazarus

On 06.02.2017 10:15, C Western via Lazarus wrote:
Indeed, though this minimum width should also depend on the font size, 
so requires some programming on each form (though maybe a single fixed 
value would work in most cases).


Constraints are scaled according to current DPI settings in Lazarus 1.7+ 
(with high DPI enabled).


If you change the Font.Size property it's your own responsibility to 
assign a valid value to Constraints.


Ondrej
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] IDE Component-dialog: small button

2017-02-06 Thread C Western via Lazarus

On 06/02/17 09:04, Ondrej Pokorny via Lazarus wrote:

On 06.02.2017 9:49, C Western via Lazarus wrote:

It looks like a button that has been autosized; I must admit my
feeling is that autosized buttons should have a minimum width


You can use the Constraints property to set the minimum width in your
own programs.

Indeed, though this minimum width should also depend on the font size, 
so requires some programming on each form (though maybe a single fixed 
value would work in most cases).


Colin

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


Re: [Lazarus] IDE Component-dialog: small button

2017-02-06 Thread Ondrej Pokorny via Lazarus

On 06.02.2017 9:49, C Western via Lazarus wrote:
It looks like a button that has been autosized; I must admit my 
feeling is that autosized buttons should have a minimum width


You can use the Constraints property to set the minimum width in your 
own programs.


Ondrej
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] IDE Component-dialog: small button

2017-02-06 Thread Ondrej Pokorny via Lazarus

On 06.02.2017 3:28, wkitty42--- via Lazarus wrote:

On 02/05/2017 07:41 PM, Alexey via Lazarus wrote:
In this dialog, button Use is too narrow. Can i make diff, to make it 
wide, e.g.

80pix?


ummm, it looks plenty big enough... all of the letters show with no 
clipping on either side... what am i missing??


You don't miss anything. The button is just OK.

Ondrej

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


Re: [Lazarus] IDE Component-dialog: small button

2017-02-06 Thread C Western via Lazarus

On 06/02/17 02:28, wkitty42--- via Lazarus wrote:

On 02/05/2017 07:41 PM, Alexey via Lazarus wrote:

In this dialog, button Use is too narrow. Can i make diff, to make it
wide, e.g.
80pix?


ummm, it looks plenty big enough... all of the letters show with no
clipping on either side... what am i missing??

It looks like a button that has been autosized; I must admit my feeling 
is that autosized buttons should have a minimum width, something like 
the width of a "Cancel" button, say. The general GUI convention seems to 
be to have all buttons of similar sizes, and the lazarus autosize 
algorithm produces buttons that can often look on the small side 
compared to most programs. Turning off autosizing is a bad idea because 
of the variety of system fonts.


Colin
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus