[haiku-commits] Re: r34184 - in haiku/trunk/src: apps/terminal tests/apps/terminal_replicant

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 22 Nov 2009 14:39:11 +0100

Hi Stefano,

On 2009-11-22 at 13:13:19 [+0100], stefano.ceccherini@xxxxxxxxx wrote:
> Author: jackburton
> Date: 2009-11-22 13:13:18 +0100 (Sun, 22 Nov 2009) New Revision: 34184
> Changeset: http://dev.haiku-os.org/changeset/34184/haiku
> 
> Modified:
>    haiku/trunk/src/apps/terminal/TermView.cpp
>    haiku/trunk/src/apps/terminal/TermView.h
>    haiku/trunk/src/apps/terminal/TermWindow.cpp
>    haiku/trunk/src/tests/apps/terminal_replicant/main.cpp
> Log:
> Fixed TermView when used with the constructor which accepts a BRect: In 
> that case TermView computes rows and columns based on the frame size. 
> This also made simpler to attach a TermView to a given BWindow, like done 
> in the RepliTerminal test app. Changed Repliterminal accordingly. Removed 
> the bool parameter from SetTermSize(), and added a SetTermSize which 
> accept a BRect, as well.

[...]
> @@ -325,7 +333,7 @@
>          return B_NO_MEMORY;
>  
>      SetTermFont(be_fixed_font);
> -    SetTermSize(fRows, fColumns, false);
> +    SetTermSize(fRows, fColumns);

It is not so nice that SetTermSize is called with the member values already 
changed. Same here:

>  void
> +TermView::SetTermSize(BRect rect)
> +{
> +    GetTermSizeFromRect(rect, &fRows, &fColumns);
> +    SetTermSize(fRows, fColumns);
> +}

This looks better:

> +void
>  TermView::SetTextColor(rgb_color fore, rgb_color back) {
>      fTextForeColor = fore;
> @@ -1383,7 +1416,7 @@
>      if (fResizeViewDisableCount > 0)
>          fResizeViewDisableCount--;
>  
> -    SetTermSize(rows, columns, false);
> +    SetTermSize(rows, columns);
>  
>      fFrameResized = true;
>  }

I would expect the member values to be changed in SetTermSize() and only 
there.

Best regards,
-Stephan

Other related posts: