Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions graf2d/gpad/src/TCanvas.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ of the canvas. It gives a short explanation about the canvas' menus.
A canvas may be automatically divided into pads via `TPad::Divide`.

At creation time, no matter if in interactive or batch mode, the constructor
defines the size of the canvas window (including the size of the window
manager's decoration). To define precisely the graphics area size of a canvas in
the interactive mode, the following four lines of code should be used:
defines the size of the canvas window (including the size of the ROOT menu bar but
excluding the size of the OS window manager's decoration). To define precisely the
graphics area size of a canvas in batch/interactive mode, the following code should
be used:
~~~ {.cpp}
{
Double_t w = 600;
Expand All @@ -123,9 +124,18 @@ the interactive mode, the following four lines of code should be used:
c->SetWindowSize(w + (w - c->GetWw()), h + (h - c->GetWh()));
}
~~~
and in the batch mode simply do:

To ensure similar painting size for the canvas created with default size for both interactive and batch mode:
~~~ {.cpp}
{
auto c = new TCanvas("c", "c");
c->SetWindowSize(c->GetWindowWidth() + (c->GetWindowWidth() - c->GetWw()), c->GetWindowHeight() + (c->GetWindowHeight() - c->GetWh()));
}
~~~

Comment thread
linev marked this conversation as resolved.
If you are in batch mode, you can also specify the fixed painting area as follows:
~~~ {.cpp}
c->SetCanvasSize(w,h);
c->SetCanvasSize(w, h);
~~~

If the canvas size exceeds the window size, scroll bars will be added to the canvas
Expand Down Expand Up @@ -1940,8 +1950,8 @@ void TCanvas::SetBatch(Bool_t batch)
/// are greater than the current canvas window a scroll bar is automatically
/// generated. Use this function to zoom in a canvas and navigate via
/// the scroll bars. The Width and Height in this method are different from those
/// given in the TCanvas constructors where these two dimension include the size
/// of the window decoration whereas they do not in this method.
/// given in the TCanvas constructors where these two dimensions include the size
/// of the ROOT canvas menubar decoration whereas they do not in this method.
/// When both ww==0 and wh==0, auto resize mode will be enabled again and
/// canvas drawing area will automatically fit available window size

Expand Down