Re-enabled printing

Added numbers to terminal windows
Some usability tweaks to the preferences window
Removed the do-nothing Find menu items
Other minor UI tweaks


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12587 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2005-05-07 16:20:06 +00:00
parent 04efb239b7
commit 0001f0bda6
6 changed files with 53 additions and 32 deletions

View File

@ -118,11 +118,11 @@ PrefDlg::SetupContent()
// OK, Apply and Cancel button.
//
fSaveAsFileButton = new BButton(BRect(50,215,150,20), "okbutton", "Save", new BMessage(MSG_SAVEAS_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
fSaveAsFileButton = new BButton(BRect(50,215,150,20), "savebutton", "Save to File", new BMessage(MSG_SAVEAS_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
top->AddChild(fSaveAsFileButton);
fRevertButton = new BButton(BRect(180,215,250,20), "applybutton", "Cancel", new BMessage(MSG_REVERT_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
fRevertButton = new BButton(BRect(180,215,250,20), "revertbutton", "Cancel", new BMessage(MSG_REVERT_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
top->AddChild(fRevertButton);
fSaveButton = new BButton(BRect(260,215,330,20), "cancelbutton", "OK", new BMessage(MSG_SAVE_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
fSaveButton = new BButton(BRect(260,215,330,20), "okbutton", "OK", new BMessage(MSG_SAVE_PRESSED), B_FOLLOW_TOP, B_WILL_DRAW);
top->AddChild(fSaveButton);
@ -154,12 +154,14 @@ PrefDlg::QuitRequested ()
BAlert *alert = new BAlert("",
"Save changes to this preference panel?",
"Cancel", "Don't save",
"Cancel", "Don't Save",
"Save",
B_WIDTH_AS_USUAL,
B_OFFSET_SPACING,
B_WARNING_ALERT);
alert->SetShortcut(0, B_ESCAPE);
alert->SetShortcut(1, 'd');
alert->SetShortcut(2, 's');
int32 button_index = alert->Go();
switch (button_index) {
@ -271,7 +273,7 @@ PrefDlg::MessageReceived(BMessage *msg)
switch (msg->what) {
case MSG_SAVE_PRESSED:
doSave();
Quit();
PostMessage(B_QUIT_REQUESTED);
break;
case MSG_SAVEAS_PRESSED:
@ -280,6 +282,7 @@ PrefDlg::MessageReceived(BMessage *msg)
case MSG_REVERT_PRESSED:
doRevert();
PostMessage(B_QUIT_REQUESTED);
break;
case MSG_PREF_MODIFIED:

View File

@ -77,10 +77,10 @@ TermApp::TermApp (void)
BList teams;
be_roster->GetAppList(TERM_SIGNATURE, &teams);
int window_num = teams.CountItems();
fWindowNumber = teams.CountItems();
int i = window_num / 16;
int j = window_num % 16;
int i = fWindowNumber / 16;
int j = fWindowNumber % 16;
int k = (j * 16) + (i * 64) + 50;
int l = (j * 16) + 50;
@ -406,7 +406,7 @@ TermApp::MakeTermWindow (BRect &frame)
/* Create Window Object. */
fTermWindow = new TermWindow (frame);
fTermWindow = new TermWindow (frame, fWindowNumber);
fTermWindow->Show ();
@ -448,7 +448,7 @@ TermApp::SwitchTerm()
int32 numTerms = teams.CountItems();
if (numTerms <= 1 ) return; //Can't Switch !!
// Find posion of mine in app teams.
// Find position of mine in app teams.
int32 i;
for(i = 0; i < numTerms; i++){
@ -459,7 +459,7 @@ TermApp::SwitchTerm()
if(--i < 0) i = numTerms - 1;
}while(IsMinimize(reinterpret_cast<team_id>(teams.ItemAt(i))));
// Activare switched terminal.
// Activate switched terminal.
ActivateTermWindow(reinterpret_cast<team_id>(teams.ItemAt(i)));
}
////////////////////////////////////////////////////////////////////////////

View File

@ -72,6 +72,7 @@ private:
bool IsMinimize (team_id);
int fRows, fCols, fXpos, fYpos;
int fWindowNumber;
rgb_color fFg, fBg, fCurFg, fCurBg, fSelFg, fSelbg;
rgb_color fImfg, fImbg, fImSel;

View File

@ -1942,9 +1942,12 @@ TermView::DoCopy()
be_clipboard->Unlock();
}
if (!fMouseTracking) {
this->DeSelect ();
}
// Deselecting the current selection is not the behavior that
// R5's Terminal app displays. We want to mimic the behavior, so we will
// no longer do the deselection
// if (!fMouseTracking) {
// this->DeSelect ();
// }
}
////////////////////////////////////////////////////////////////////////////

View File

@ -88,9 +88,11 @@ void SetCoding (int);
// TermWindow Constructer
//
////////////////////////////////////////////////////////////////////////////
TermWindow::TermWindow( BRect frame)
TermWindow::TermWindow( BRect frame, int32 windownumber)
: BWindow (frame, NULL, B_DOCUMENT_WINDOW, B_CURRENT_WORKSPACE)
{
sprintf(gWindowName,"Terminal %ld",windownumber);
InitWindow();
SetWindowTitle();
fPrintSettings = NULL;
@ -258,10 +260,10 @@ TermWindow::SetupMenu(void)
fFilemenu->AddItem(new BMenuItem("Switch Terminals", new BMessage(MENU_SWITCH_TERM),'G'));
fFilemenu->AddItem(new BMenuItem("Start New Terminal", new BMessage(MENU_NEW_TREM), 'N'));
fFilemenu->AddSeparatorItem();
fFilemenu->AddItem(new BMenuItem("Preferences", new BMessage(MENU_PREF_OPEN)));
fFilemenu->AddItem(new BMenuItem("About Terminal...", new BMessage(MENU_SHOW_ABOUT)));
fFilemenu->AddSeparatorItem();
fFilemenu->AddItem(new BMenuItem("Page Setup", new BMessage(MENU_PAGE_SETUP)));
fFilemenu->AddItem(new BMenuItem("Print", new BMessage(MENU_PRINT), 'P'));
fFilemenu->AddItem(new BMenuItem("Page Setup...", new BMessage(MENU_PAGE_SETUP)));
fFilemenu->AddItem(new BMenuItem("Print", new BMessage(MENU_PRINT),'P'));
fFilemenu->AddSeparatorItem();
fFilemenu->AddItem(new BMenuItem("Quit", new BMessage(MENU_FILE_QUIT), 'Q'));
fMenubar->AddItem(fFilemenu);
@ -274,10 +276,14 @@ TermWindow::SetupMenu(void)
fEditmenu->AddItem (new BMenuItem ("Paste", new BMessage (B_PASTE),'V'));
fEditmenu->AddSeparatorItem ();
fEditmenu->AddItem (new BMenuItem ("Select All", new BMessage (B_SELECT_ALL), 'A'));
fEditmenu->AddItem (new BMenuItem ("Clear All", new BMessage (MENU_CLEAR_ALL)));
fEditmenu->AddItem (new BMenuItem ("Clear All", new BMessage (MENU_CLEAR_ALL), 'L'));
/*
// TODO: Implement Finding
fEditmenu->AddSeparatorItem ();
fEditmenu->AddItem (new BMenuItem ("Find", new BMessage (MENU_FIND_STRING),'F'));
fEditmenu->AddItem (new BMenuItem ("Find Again", new BMessage (MENU_FIND_AGAIN), '['));
fEditmenu->AddItem (new BMenuItem ("Find Again", new BMessage (MENU_FIND_AGAIN), ']'));
*/
fMenubar->AddItem (fEditmenu);
@ -291,7 +297,10 @@ TermWindow::SetupMenu(void)
fWindowSizeMenu->AddItem(new BMenuItem("80x40", new BMessage(EIGHTYFORTY)));
fWindowSizeMenu->AddItem(new BMenuItem("132x24", new BMessage(ONETHREETWOTWENTYFOUR)));
fWindowSizeMenu->AddItem(new BMenuItem("132x25", new BMessage(ONETHREETWOTWENTYFIVE)));
fNewFontMenu = new BMenu("Font");
// Considering we have this in the preferences window, this menu is not
// needed and should not be shown if we are to not confuse the user
/* fNewFontMenu = new BMenu("Font");
fNewFontMenu->SetRadioMode(true);
int32 numFamilies1 = count_font_families();
for ( int32 i = 0; i < numFamilies1; i++ ) {
@ -303,13 +312,16 @@ TermWindow::SetupMenu(void)
}
}
fNewFontMenu->FindItem (gTermPref->getString(PREF_HALF_FONT_FAMILY))->SetMarked(true);
*/
fEncodingmenu = new BMenu("Font Encoding");
fEncodingmenu->SetRadioMode(true);
MakeEncodingMenu(fEncodingmenu, gNowCoding, true);
fHelpmenu->AddItem(fEncodingmenu);
fHelpmenu->AddItem(fWindowSizeMenu);
fHelpmenu->AddItem(fNewFontMenu);
fHelpmenu->AddItem(new BMenuItem("About Terminal", new BMessage(MENU_SHOW_ABOUT)));
fHelpmenu->AddItem(fEncodingmenu);
// fHelpmenu->AddItem(fNewFontMenu);
fHelpmenu->AddSeparatorItem();
fHelpmenu->AddItem(new BMenuItem("Preferences", new BMessage(MENU_PREF_OPEN)));
fMenubar->AddItem(fHelpmenu);
@ -592,9 +604,7 @@ void
TermWindow::SetWindowTitle (void)
{
char windowname[256];
sprintf(windowname, gWindowName
);
sprintf(windowname, gWindowName);
this->SetTitle (windowname);
}
@ -701,7 +711,7 @@ TermWindow::DoPageSetup()
void
TermWindow::DoPrint()
{
#if B_BEOS_VERSION < 0x0460
//#if B_BEOS_VERSION < 0x0460
BPrintJob job("Print");
if((! fPrintSettings) && (DoPageSetup() != B_NO_ERROR)) {
@ -709,7 +719,7 @@ TermWindow::DoPrint()
return;
}
job.SetSettings(new BMessage(fPrintSettings));
job.SetSettings(new BMessage(*fPrintSettings));
BRect pageRect = job.PrintableRect();
BRect curPageRect = pageRect;
@ -732,12 +742,16 @@ TermWindow::DoPrint()
job.SpoolPage();
if(!job.CanContinue()){
(new BAlert("Cancel", "Print job cancelled", "OK"))->Go();
// It is likely that the only way that the job was cancelled is
// because the user hit 'Cancel' in the page setup window, in which
// case, the user does *not* need to be told that it was cancelled.
// He/she will simply expect that it was done.
// (new BAlert("Cancel", "Print job cancelled", "OK"))->Go();
return;
}
}
/* commit the job, send the spool file */
job.CommitJob();
#endif
//#endif
}

View File

@ -48,7 +48,7 @@ class FindDlg;
class TermWindow : public BWindow
{
public:
TermWindow (BRect frame);
TermWindow (BRect frame, int32 windownumber=1);
~TermWindow ();
void Quit (void);