Terminal:Fix printing and windows settings path.

* Fixes #7986 - behavior of Print command fixed to be consistent
  with other application, like StyledEdit. This change
  display the print job settings dialog instead of "Printing
  was cancelled" alert;
* Fixes #6998 - the path to storing windows settings changed from
  ~/config/settings/Terminal_windows to ~/c/s/Terminal/Windows;

  This patch was created during GCI 2011 by doctorkohaku.
  Thanks for the contribution!
This commit is contained in:
Siarzhuk Zharski 2011-12-03 19:47:38 +01:00
parent 7418dbd908
commit d79b659e26

View File

@ -517,7 +517,11 @@ TermWindow::_GetWindowPositionFile(BFile* file, uint32 openMode)
if (status != B_OK)
return status;
status = path.Append("Terminal_windows");
status = path.Append("Terminal");
if (status != B_OK)
return status;
status = path.Append("Windows");
if (status != B_OK)
return status;
@ -1035,23 +1039,19 @@ TermWindow::_DoPageSetup()
void
TermWindow::_DoPrint()
{
if (!fPrintSettings || _DoPageSetup() != B_OK) {
BAlert* alert = new BAlert(B_TRANSLATE("Cancel"),
B_TRANSLATE("Print cancelled."), B_TRANSLATE("OK"));
alert->SetShortcut(0, B_ESCAPE);
alert->Go();
return;
}
BPrintJob job("Print");
job.SetSettings(new BMessage(*fPrintSettings));
if (fPrintSettings)
job.SetSettings(new BMessage(*fPrintSettings));
if (job.ConfigJob() != B_OK)
return;
BRect pageRect = job.PrintableRect();
BRect curPageRect = pageRect;
int pHeight = (int)pageRect.Height();
int pWidth = (int)pageRect.Width();
float w,h;
float w, h;
_ActiveTermView()->GetFrameSize(&w, &h);
int xPages = (int)ceil(w / pWidth);
int yPages = (int)ceil(h / pHeight);