Re: [lazarus] ColorToRGB in console app

2008-02-11 Thread mramirez

Quoting Giuliano Colla <[EMAIL PROTECTED]>:


Knowing a bit Redmond people, I'm afraid it's MSDos based! ;-)


"All things old become new again"
;-)

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-11 Thread John

Graeme Geldenhuys wrote:


On 11/02/2008, Giuliano Colla <[EMAIL PROTECTED]> wrote:
 


Our Linux based company servers have KDE running 24/7, so that unskilled
people can check daily backups, and do other minor things, clicking on a
few dedicated icons on the desktop. No problem whatsoever. Uptime
depends only on kernel updates.
   



We run a Windows 2003 server and Ubuntu 6.06 LTS (Linux) server side
by side. The Linux server has no GUI. All maintenance on the Linux
server is done via scripts and works beautifully. I'm thinking of
rewriting some of those scripts into a single maintenance application
using FPC's console GUI framework (that Turbo Pascal look - I can't
remember the name now).

The Linux server does about four times the work compared to the
Windows server, and it's uptime is also way higher (as in months).
Start-up time is also impressive. The Windows server takes about 5-7
minutes to boot - Linux is up in 30 seconds (and it's a slower
machine). The latter drives the windows administrators nuts!  :-)
Based on our company servers I think non-GUI servers kick ass.
but now I'm way off-topic again

Regards,
 - Graeme -

 


Hi Graeme,

I don't doubt anything you have said, but you are mistaking the 
difference between windows and *nix for the difference between gui and 
non-gui.  I ran HP-UX servers for years  without any problems, despite 
always having the CDE GUI environment available. 


cheers,
John

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-11 Thread Graeme Geldenhuys
On 11/02/2008, Giuliano Colla <[EMAIL PROTECTED]> wrote:
>
> Our Linux based company servers have KDE running 24/7, so that unskilled
> people can check daily backups, and do other minor things, clicking on a
> few dedicated icons on the desktop. No problem whatsoever. Uptime
> depends only on kernel updates.

We run a Windows 2003 server and Ubuntu 6.06 LTS (Linux) server side
by side. The Linux server has no GUI. All maintenance on the Linux
server is done via scripts and works beautifully. I'm thinking of
rewriting some of those scripts into a single maintenance application
using FPC's console GUI framework (that Turbo Pascal look - I can't
remember the name now).

The Linux server does about four times the work compared to the
Windows server, and it's uptime is also way higher (as in months).
Start-up time is also impressive. The Windows server takes about 5-7
minutes to boot - Linux is up in 30 seconds (and it's a slower
machine). The latter drives the windows administrators nuts!  :-)
Based on our company servers I think non-GUI servers kick ass.
but now I'm way off-topic again

Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-11 Thread Giuliano Colla

Felipe Monteiro de Carvalho ha scritto:

On Feb 11, 2008 8:21 AM, Vincent Snijders <[EMAIL PROTECTED]> wrote:

You do not get true console applications under Windows, because all
windows installations have a GUI installed.

All Mac OS X installations too. :-)


Actually Macs have a server edition and althougth I never saw that I
think it doesn't have a gui:

http://en.wikipedia.org/wiki/Xserve



Nope. Take a look at the Getting Started Manual:

http://images.apple.com/server/macosx/docs/Getting_Started_v10.5.pdf

The idea of just point and click is originally an Apple idea. It was 
part of the idea "one computer if each house", which was revolutionary 
for the time!



Also, I read somewhere that Microsoft recently launched or at least
made a beta of a new revolutionary Windows Server.

The great inovation? It doesn't have a GUI, so it's more stable



Knowing a bit Redmond people, I'm afraid it's MSDos based! ;-)


Having said that I have also seen Linux and FreeBSD servers with GUI
(KDE) running 24/7. I personally think the technicians were lazy, but
it seamed to work well.



Our Linux based company servers have KDE running 24/7, so that unskilled 
people can check daily backups, and do other minor things, clicking on a 
few dedicated icons on the desktop. No problem whatsoever. Uptime 
depends only on kernel updates.


Giuliano

--
Giuliano Colla

Whenever people agree with me, I always feel I must be wrong (O. Wilde)

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


RE: [lazarus] ColorToRGB in console app

2008-02-11 Thread Hess, Philip J
Hi Graeme,

Thanks for the tips.

Console apps with the Laz GUI linked in (i.e., linked against a
widgetset via inclusion of interfaces unit) work fine on Windows and
Carbon and even with GTK on OS X if run in an X termimal. However, I
would like to be able to have a truer console app (and a much smaller
one too).

ColorToRGB is widgetset-dependent so I can't use that if I want a true
console app.

Another problem I've run into is trying to decide what RGB value to use
for color constants. For example, ColorToRGB(clBtnFace) returns
different RGB values on Windows, OS X Carbon and OS X GTK, as
implemented by the widgetsets' GetSysColor. Probably different values
would also be returned on the same platform depending on user
preferences too. So I guess my problem is how to map color constants for
use, say, in other programs or in a Web browser. Maybe just use a
default Windows set of RGB values or something would make sense.

Thanks.

-Phil


-Original Message-
From: Graeme Geldenhuys [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 11, 2008 2:09 AM
To: lazarus@miraclec.com
Subject: Re: [lazarus] ColorToRGB in console app

On 10/02/2008, Hess, Philip J <[EMAIL PROTECTED]> wrote:
>
> Of course, now the app has the same issues as any Mac GUI app compiled
with
> GTK, in that even though it's a console app (sort of), it will only
run under X11. And
> no way to compile for Carbon with lazbuild unless the framework carbon
stuff already
> set in the .lpi.


That's correct. You can't include the 'interfaces' unit in a console
application because it requires (pulls in) GUI code. You will not
notice anything under Windows, because Windows always has a GUI
installed. Under Linux it's easily noticed when you don't run a X
Server and try an execute a console application that uses 'interfaces'
unit.

I had this same issue in the tiOPF project and console unit tests on
my Linux server which doesn't run a X Window server installed.  Some
unit tests required the clipboard, which is a GUI feature in LCL or
VCL. I had to rework the unit tests to exclude those tests when run as
a true console application.

> RGB value _or_ a color constant like clBtnFace (value of 15). If
someone passes a
> color constant to one of these functions, they'll get an unexpected
result. So it
> seems as though RedGreenBlue, etc. should either call ColorToRGB first
or else the
> param type should be


Again correct and what I forgot to mention in my previous post.  If
you pass in a cl color alias (like clBtnFace etc) you first need
to lookup the RGB equivalent color value via ColorToRGB. In fpGUI it's
possible to do without requiring a true GUI installed, but I'm not
sure what would happen under Windows etc...


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-11 Thread Mattias Gaertner
On Mon, 11 Feb 2008 08:54:59 +0200
"Graeme Geldenhuys" <[EMAIL PROTECTED]> wrote:

> On 10/02/2008, Mattias Gaertner <[EMAIL PROTECTED]> wrote:
> > >
> > > This console app runs okay on Delphi. Is there something I'm
> > > missing here or is this just not possible with Lazarus?
> >
> > Did you add the 'interfaces' unit as one of the first units of your
> > program?
> 
> 
> You can't do that Mattias! It then it becomes a GUI application.  The
> 'interfaces' unit pulls in GUI code which then requires X Server under
> Linux etc...

Yes. The LCL is a visual component library.
When someone asks on this list about 'console app runs okay on Delphi' I
assume he wants a short answer to get something Delphi compatible and
not a long answer about pros and cons. 


Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-11 Thread Graeme Geldenhuys
On 11/02/2008, Felipe Monteiro de Carvalho
<[EMAIL PROTECTED]> wrote:
> >
> > All Mac OS X installations too. :-)
>
> Actually Macs have a server edition and althougth I never saw that I
> think it doesn't have a gui:
>
> http://en.wikipedia.org/wiki/Xserve

I thought there had to be something like that...


> Also, I read somewhere that Microsoft recently launched or at least
> made a beta of a new revolutionary Windows Server.
>
> The great innovation? It doesn't have a GUI, so it's more stable

And let me guess, they already submitted their patent application for
it.  :-)  Should we tell them *unix has done it since forever!


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-10 Thread Felipe Monteiro de Carvalho
On Feb 11, 2008 8:21 AM, Vincent Snijders <[EMAIL PROTECTED]> wrote:
> > You do not get true console applications under Windows, because all
> > windows installations have a GUI installed.
>
> All Mac OS X installations too. :-)

Actually Macs have a server edition and althougth I never saw that I
think it doesn't have a gui:

http://en.wikipedia.org/wiki/Xserve

Also, I read somewhere that Microsoft recently launched or at least
made a beta of a new revolutionary Windows Server.

The great inovation? It doesn't have a GUI, so it's more stable

Having said that I have also seen Linux and FreeBSD servers with GUI
(KDE) running 24/7. I personally think the technicians were lazy, but
it seamed to work well.

bye,
-- 
Felipe Monteiro de Carvalho

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-10 Thread Vincent Snijders

Graeme Geldenhuys schreef:

On 09/02/2008, Hess, Philip J <[EMAIL PROTECTED]> wrote:

 This console app runs okay on Delphi. Is there something I'm missing here
or is this just not possible with Lazarus?


You do not get true console applications under Windows, because all
windows installations have a GUI installed. 


All Mac OS X installations too. :-)

Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-10 Thread Graeme Geldenhuys
On 11/02/2008, Vincent Snijders <[EMAIL PROTECTED]> wrote:
> >
> > You do not get true console applications under Windows, because all
> > windows installations have a GUI installed.
>
> All Mac OS X installations too. :-)

Interesting, even servers? Or don't you get Mac OS X servers?  So even
though Macs use the *BSD OS (forgot it's name) as the underlying OS,
you can't install without a GUI? As you can guess I know next to
nothing about Macs.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-10 Thread Graeme Geldenhuys
On 10/02/2008, Hess, Philip J <[EMAIL PROTECTED]> wrote:
>
> Of course, now the app has the same issues as any Mac GUI app compiled with
> GTK, in that even though it's a console app (sort of), it will only run under 
> X11. And
> no way to compile for Carbon with lazbuild unless the framework carbon stuff 
> already
> set in the .lpi.


That's correct. You can't include the 'interfaces' unit in a console
application because it requires (pulls in) GUI code. You will not
notice anything under Windows, because Windows always has a GUI
installed. Under Linux it's easily noticed when you don't run a X
Server and try an execute a console application that uses 'interfaces'
unit.

I had this same issue in the tiOPF project and console unit tests on
my Linux server which doesn't run a X Window server installed.  Some
unit tests required the clipboard, which is a GUI feature in LCL or
VCL. I had to rework the unit tests to exclude those tests when run as
a true console application.

> RGB value _or_ a color constant like clBtnFace (value of 15). If someone 
> passes a
> color constant to one of these functions, they'll get an unexpected result. 
> So it
> seems as though RedGreenBlue, etc. should either call ColorToRGB first or 
> else the
> param type should be


Again correct and what I forgot to mention in my previous post.  If
you pass in a cl color alias (like clBtnFace etc) you first need
to lookup the RGB equivalent color value via ColorToRGB. In fpGUI it's
possible to do without requiring a true GUI installed, but I'm not
sure what would happen under Windows etc...


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-10 Thread Graeme Geldenhuys
On 10/02/2008, Mattias Gaertner <[EMAIL PROTECTED]> wrote:
> >
> > This console app runs okay on Delphi. Is there something I'm missing
> > here or is this just not possible with Lazarus?
>
> Did you add the 'interfaces' unit as one of the first units of your
> program?


You can't do that Mattias! It then it becomes a GUI application.  The
'interfaces' unit pulls in GUI code which then requires X Server under
Linux etc...

Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


Re: [lazarus] ColorToRGB in console app

2008-02-10 Thread Graeme Geldenhuys
On 09/02/2008, Hess, Philip J <[EMAIL PROTECTED]> wrote:
>
>  This console app runs okay on Delphi. Is there something I'm missing here
> or is this just not possible with Lazarus?

You do not get true console applications under Windows, because all
windows installations have a GUI installed. You can access for example
the clipboard in a console application under Windows, but you can't
under a true Linux console application.

You will have to implement the color conversion yourself.

Below is some code I use in fpGUI. Just remember that in fpGUI the
TfpgColor type is define as RRGGBB, but under Delphi (and Lazarus)
TColor is defined as BBGGRR due to Windows.

function fpgColorToRGBTriple(const AColor: TfpgColor): TRGBTriple;
begin
  with Result do
  begin
Red   := fpgGetRed(AColor);
Green := fpgGetGreen(AColor);
Blue  := fpgGetBlue(AColor);
//Alpha := fpgGetAlpha(AColor);
  end
end;

function RGBTripleTofpgColor(const AColor: TRGBTriple): TfpgColor;
begin
  Result := AColor.Blue or (AColor.Green shl 8) or (AColor.Red shl
16);// or (AColor.Alpha shl 32);
end;

function fpgGetRed(const AColor: TfpgColor): word;
begin
  // AARRGGBB format
  Result := Word((AColor shr 16) and $FF);
end;

function fpgGetGreen(const AColor: TfpgColor): word;
begin
  // AARRGGBB format
  Result := Word((AColor shr 8) and $FF);
end;

function fpgGetBlue(const AColor: TfpgColor): word;
begin
  // AARRGGBB format
  Result := Word(AColor and $FF);
end;


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives


RE: [lazarus] ColorToRGB in console app

2008-02-10 Thread Hess, Philip J
Not concerned about myself. I'm preparing something for others to compile and 
want to make it as easy as possible.

Thanks.

-Phil


-Original Message-
From: Vincent Snijders [mailto:[EMAIL PROTECTED]
Sent: Sun 2/10/2008 1:12 AM
To: lazarus@miraclec.com
Subject: Re: [lazarus] ColorToRGB in console app
 
Hess, Philip J schreef:
> Of course, now the app has the same issues as any Mac GUI app compiled with 
> GTK, in that even though it's a console app (sort of), it will only run under 
> X11. And no way to compile for Carbon with lazbuild unless the framework 
> carbon stuff already set in the .lpi.
> 

Maybe you should set the framework parameters in the fpc.cfg, under 
#ifdef LCLCarbon, if you don't want to pass them always.

Vincent

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

<>

Re: [lazarus] ColorToRGB in console app

2008-02-09 Thread Vincent Snijders

Hess, Philip J schreef:

Of course, now the app has the same issues as any Mac GUI app compiled with 
GTK, in that even though it's a console app (sort of), it will only run under 
X11. And no way to compile for Carbon with lazbuild unless the framework carbon 
stuff already set in the .lpi.



Maybe you should set the framework parameters in the fpc.cfg, under 
#ifdef LCLCarbon, if you don't want to pass them always.


Vincent

_
To unsubscribe: mail [EMAIL PROTECTED] with
   "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives


RE: [lazarus] ColorToRGB in console app

2008-02-09 Thread Hess, Philip J
Excellent, that's what I was forgetting.

Of course, now the app has the same issues as any Mac GUI app compiled with 
GTK, in that even though it's a console app (sort of), it will only run under 
X11. And no way to compile for Carbon with lazbuild unless the framework carbon 
stuff already set in the .lpi.

Also, looking at some of the functions in Graphics.pp, I wonder if it's 
confusing to use TColor for params with functions like RedGreenBlue, 
InvertColor, etc. TColor can be a full RGB value _or_ a color constant like 
clBtnFace (value of 15). If someone passes a color constant to one of these 
functions, they'll get an unexpected result. So it seems as though 
RedGreenBlue, etc. should either call ColorToRGB first or else the param type 
should be LongInt or something to make it clearer that a color constant should 
not be passed. Same with ColorToRGB - in Delphi the return type is LongInt, not 
TColor, since it only returns RGB values, not color constants.

Thanks.

-Phil



-Original Message-
From: Mattias Gaertner [mailto:[EMAIL PROTECTED]
Sent: Sat 2/9/2008 6:53 PM
To: lazarus@miraclec.com
Subject: Re: [lazarus] ColorToRGB in console app
 
On Sat, 9 Feb 2008 15:42:22 -0500
"Hess, Philip J" <[EMAIL PROTECTED]> wrote:

> 
> I need to call ColorToRGB in a console app. Adding Graphics to uses
> allows lazbuild to compile the console app okay, but I get an AV when
> running it, presumably because the widgetset that actually implements
> ColorToRGB isn't getting linked into the app, as evidenced by otool
> -L (on Mac):
> 
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 88.1.10)
> 
> If any widgetset code were linked in, I would see something like this:
> 
> /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
> (compatibility version 2.0.0, current version
> 128.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 88.1.10)
> 
> This console app runs okay on Delphi. Is there something I'm missing
> here or is this just not possible with Lazarus?

Did you add the 'interfaces' unit as one of the first units of your
program?

Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

<>

Re: [lazarus] ColorToRGB in console app

2008-02-09 Thread Mattias Gaertner
On Sat, 9 Feb 2008 15:42:22 -0500
"Hess, Philip J" <[EMAIL PROTECTED]> wrote:

> 
> I need to call ColorToRGB in a console app. Adding Graphics to uses
> allows lazbuild to compile the console app okay, but I get an AV when
> running it, presumably because the widgetset that actually implements
> ColorToRGB isn't getting linked into the app, as evidenced by otool
> -L (on Mac):
> 
> /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 88.1.10)
> 
> If any widgetset code were linked in, I would see something like this:
> 
> /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
> (compatibility version 2.0.0, current version
> 128.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,
> current version 88.1.10)
> 
> This console app runs okay on Delphi. Is there something I'm missing
> here or is this just not possible with Lazarus?

Did you add the 'interfaces' unit as one of the first units of your
program?

Mattias

_
 To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives