[Gambas-user] Strange way of working about form dimensions

ron ronstk at ...239...
Fri May 26 19:27:17 CEST 2006


On Friday 26 May 2006 17:53, Benoit Minisini wrote:
> On Friday 26 May 2006 17:37, ron wrote:
----8<---


> 
> > I believe MAIN_SCALE should be "(fm.width()/fm.height()) x fm.width()"
> > in the first place. But should it not be more correct to use
> > "(screen.width()/screen.height()) x screen.width()" as that is the
> > intension ? 
> 
> ??

I did asume a value for height to width relation but itis more like a zoom factor.


> 
> > The character dimensions are in no way related to the screen 
> > dimensions for width/height values.
> >
> > The idea behind it is not bad but it works out not always to be a wanted
> > side effect. Now I understand the form size problems between the to
> > machines/monitor I'm using.
> >
> > Could it not be made a option for the project in gb.Application or
> > gb.qt.Desktop to use xxxScaled or not ?
> 
> Yes.
> 
> >
> > When I use MyForm.Height = MyForm.Width * DeskTop.Scale there is now
> > something wrong with the height :(
> 
> ???? You didn't undestand what MAIN_Scale is. Look at the source code of the 
> MoveScaled and ResizeScaled methods.

I saw in the code both are using the x,y,w,h / MAIN_Scale and then
calling the not Scaled function.

CWidget.cpp:
BEGIN_METHOD(CWIDGET_resize_scaled, GB_FLOAT w; GB_FLOAT h)

  int w, h;

  w = (int)(VARG(w) * MAIN_scale);
  h = (int)(VARG(h) * MAIN_scale);

  resize_widget(_object, w , h);

END_METHOD

Here it act as a zoom factor instead screen width/height relation. 

> 
> >
> > I thought [object].Width * DeskTop.Scale = [object].Height
> >
> >
> > My 2 x DeskTop.Scale Cents
> >
> > Ron
> >
> >
> >
> > PS
> > For Joe1962:
> > As I asume the Fontmetrics are used as reference I asume a 8x16 font is
> > used as default metrics.
> >
> > You can try in gb.qt/src/main.cpp at line 117:
> > int MAIN_in_wait = 0;
> > int MAIN_loop_level = 0;
> > int MAIN_scale = 8; //<---- Change this to MAIN_scale = 16; (the height)
> 
> This default value is never used, so you can put what you want there.

OK

> 
> >
> > static bool in_event_loop = false;
> >
> >
> > and at line 366:
> >
> > void MAIN_update_scale(void)
> > {
> > 	QFontMetrics fm(QApplication::font());
> >   MAIN_scale = fm.height() / 2; // <--- change this to fm.height() / 1;
> > }
> >
> > This should effective disable the xxxScale but I have not tested this.
> > Do not forget the "make; make install"
> 
> Of course not, you just scale things twice!

?? if in the CWidget.cpp the MAIN_scale equals 1 the valuas for x,y,w, and h
stay the same.

> 
> You can't disable scale at the moment, unless assigning a fixed value to 
> MAIN_scale. But it won't solve everything, as the IDE already uses the 
> scaling process, i.e. instead of saving absolute coordinates, it saves 
> absolutes coordinates divided by the current scale (see the IDE source code).
> 

As you say above "But it isn't finished." we wait till it is :)

Greets from rainy Holland

Ron

------------------------------------------------------------------------------
A programmer does never finish his project, 
he always find something is missing. :)




More information about the User mailing list