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:
@@ -517,7 +517,11 @@ TermWindow::_GetWindowPositionFile(BFile* file, uint32 openMode)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
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)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
@@ -1035,23 +1039,19 @@ TermWindow::_DoPageSetup()
|
|||||||
void
|
void
|
||||||
TermWindow::_DoPrint()
|
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");
|
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 pageRect = job.PrintableRect();
|
||||||
BRect curPageRect = pageRect;
|
BRect curPageRect = pageRect;
|
||||||
|
|
||||||
int pHeight = (int)pageRect.Height();
|
int pHeight = (int)pageRect.Height();
|
||||||
int pWidth = (int)pageRect.Width();
|
int pWidth = (int)pageRect.Width();
|
||||||
float w,h;
|
float w, h;
|
||||||
_ActiveTermView()->GetFrameSize(&w, &h);
|
_ActiveTermView()->GetFrameSize(&w, &h);
|
||||||
int xPages = (int)ceil(w / pWidth);
|
int xPages = (int)ceil(w / pWidth);
|
||||||
int yPages = (int)ceil(h / pHeight);
|
int yPages = (int)ceil(h / pHeight);
|
||||||
|
|||||||
Reference in New Issue
Block a user