CBExecOutputDocument::CBExecOutputDocument ( const CBTextFileType fileType, const JCharacter* helpSectionName, const JBoolean focusToCmd, const JBoolean allowStop ) : CBTextDocument(fileType, helpSectionName, kJFalse), itsFocusToCmdFlag(focusToCmd) { itsProcess = NULL; itsRecordLink = NULL; itsDataLink = NULL; itsCmdStream = NULL; itsReceivedDataFlag = kJFalse; itsProcessPausedFlag = kJFalse; itsClearWhenStartFlag = kJTrue; itsUseCount = 0; itsDontCloseMsg = JGetString("WaitCloseMsg::CBExecOutputDocument"); // buttons in upper right JXWindow* window = GetWindow(); const JRect rect = window->GetBounds(); JXMenuBar* menuBar = GetMenuBar(); const JSize h = menuBar->GetFrameHeight(); const JCoordinate x = (allowStop ? 3 : 2) * kMenuButtonWidth; itsPauseButton = jnew JXTextButton(JGetString("PauseLabel::CBExecOutputDocument"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, rect.right - x,0, kMenuButtonWidth,h); assert( itsPauseButton != NULL ); ListenTo(itsPauseButton); itsPauseButton->SetShortcuts("^Z"); itsPauseButton->SetHint(JGetString("PauseButtonHint::CBExecOutputDocument")); if (allowStop) { itsStopButton = jnew JXTextButton(JGetString("StopLabel::CBExecOutputDocument"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, rect.right - 2*kMenuButtonWidth,0, kMenuButtonWidth,h); assert( itsStopButton != NULL ); ListenTo(itsStopButton); itsStopButton->SetShortcuts("^C#."); itsStopButton->SetHint(JGetString("StopButtonHint::CBExecOutputDocument")); } else { itsStopButton = NULL; } itsKillButton = jnew JXTextButton(JGetString("KillLabel::CBExecOutputDocument"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, rect.right - kMenuButtonWidth,0, kMenuButtonWidth,h); assert( itsKillButton != NULL ); ListenTo(itsKillButton); if (!allowStop) { itsKillButton->SetShortcuts("^C#."); itsKillButton->SetHint(JGetString("StopButtonHint::CBExecOutputDocument")); } menuBar->AdjustSize(-x, 0); // command line input JXWidget::HSizingOption hSizing; JXWidget::VSizingOption vSizing; GetFileDisplayInfo(&hSizing, &vSizing); itsCmdPrompt = jnew JXStaticText(JGetString("CmdPrompt::CBExecOutputDocument"), window, JXWidget::kFixedLeft, vSizing, -1000, -1000, 0, 500); assert( itsCmdPrompt != NULL ); itsCmdPrompt->SetToLabel(); itsCmdPrompt->Hide(); itsCmdInput = jnew CBCmdLineInput(this, window, hSizing, vSizing, -1000, -1000, 500, 500); assert( itsCmdInput != NULL ); itsCmdInput->ShareEditMenu(GetTextEditor()); itsCmdInput->Hide(); itsEOFButton = jnew JXTextButton(JGetString("EOFButtonTitle::CBExecOutputDocument"), window, JXWidget::kFixedRight, vSizing, -1000, -1000, 500, 500); assert( itsEOFButton != NULL ); itsEOFButton->SetShortcuts("^D"); itsEOFButton->Hide(); ListenTo(itsEOFButton); JXUrgentTask* task = jnew CBExecOutputPostFTCTask(this); assert( task != NULL ); task->Go(); GetTextEditor()->SetWritable(kJFalse); (JXGetDocumentManager())->DocumentMustStayOpen(this, kJTrue); window->SetWMClass(CBGetWMClassInstance(), CBGetExecOutputWindowClass()); }