void JXGetStringDialog::BuildWindow ( const JCharacter* windowTitle, const JCharacter* prompt, const JCharacter* initialValue, const JBoolean password ) { // begin JXLayout JXWindow* window = new JXWindow(this, 310,110, ""); assert( window != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::JXGetStringDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 190,80, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::JXGetStringDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::JXGetStringDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 60,80, 60,20); assert( cancelButton != NULL ); cancelButton->SetShortcuts(JGetString("cancelButton::JXGetStringDialog::shortcuts::JXLayout")); itsInputField = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 20,40, 270,20); assert( itsInputField != NULL ); JXStaticText* promptDisplay = new JXStaticText(JGetString("promptDisplay::JXGetStringDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kFixedTop, 20,20, 270,20); assert( promptDisplay != NULL ); promptDisplay->SetToLabel(); // end JXLayout window->SetTitle(windowTitle); SetButtons(okButton, cancelButton); promptDisplay->SetText(prompt); if (password) { const JRect r = itsInputField->GetFrame(); delete itsInputField; itsInputField = new JXPasswordInput(window, JXWidget::kHElastic, JXWidget::kFixedTop, r.left, r.top, r.width(), r.height()); assert( itsInputField != NULL ); } else if (!JStringEmpty(initialValue)) { itsInputField->SetText(initialValue); } itsInputField->SetIsRequired(); }
void CBAboutDialog::BuildWindow ( const JCharacter* prevVersStr ) { // begin JXLayout JXWindow* window = new JXWindow(this, 430,180, ""); assert( window != NULL ); JXImageWidget* jccIcon = new JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 25,20, 40,40); assert( jccIcon != NULL ); JXStaticText* textWidget = new JXStaticText(JGetString("textWidget::CBAboutDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 90,20, 330,110); assert( textWidget != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::CBAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 320,150, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::CBAboutDialog::shortcuts::JXLayout")); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::CBAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 185,150, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::CBAboutDialog::shortcuts::JXLayout")); itsCreditsButton = new JXTextButton(JGetString("itsCreditsButton::CBAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,150, 60,20); assert( itsCreditsButton != NULL ); JXImageWidget* npsIcon = new JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,75, 65,65); assert( npsIcon != NULL ); // end JXLayout window->SetTitle("About"); SetButtons(okButton, NULL); ListenTo(itsHelpButton); ListenTo(itsCreditsButton); // text JString text = CBGetVersionStr(); if (!JStringEmpty(prevVersStr)) { const JCharacter* map[] = { "vers", prevVersStr }; text += JGetString("UpgradeNotice::CBAboutDialog"); (JGetStringManager())->Replace(&text, map, sizeof(map)); itsHelpButton->SetLabel(JGetString("ChangeButtonLabel::CBAboutDialog")); itsIsUpgradeFlag = kJTrue; } textWidget->SetText(text); // Code Crusader icon itsAnimTask = new CBAboutDialogIconTask(jccIcon); assert( itsAnimTask != NULL ); itsAnimTask->Start(); // NPS icon JXImage* image = new JXImage(GetDisplay(), new_planet_software); assert( image != NULL ); npsIcon->SetImage(image, kJTrue); // adjust window to fit text const JSize bdh = textWidget->GetBoundsHeight(); const JSize aph = textWidget->GetApertureHeight(); if (bdh > aph) { window->AdjustSize(0, bdh - aph); // safe to calculate once bdh > aph } }
void MDAboutDialog::BuildWindow ( const JCharacter* prevVersStr ) { // begin JXLayout JXWindow* window = new JXWindow(this, 370,120, ""); assert( window != NULL ); JXStaticText* textWidget = new JXStaticText(JGetString("textWidget::MDAboutDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 70,20, 280,50); assert( textWidget != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::MDAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 260,90, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::MDAboutDialog::shortcuts::JXLayout")); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::MDAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 155,90, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::MDAboutDialog::shortcuts::JXLayout")); JXImageWidget* imageWidget = new JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 40,40); assert( imageWidget != NULL ); itsCreditsButton = new JXTextButton(JGetString("itsCreditsButton::MDAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,90, 60,20); assert( itsCreditsButton != NULL ); // end JXLayout window->SetTitle(JGetString("WindowTitle::MDAboutDialog")); SetButtons(okButton, NULL); ListenTo(itsHelpButton); ListenTo(itsCreditsButton); JXImage* image = new JXImage(GetDisplay(), md_about_icon); assert( image != NULL ); imageWidget->SetImage(image, kJTrue); JString text = MDGetVersionStr(); if (!JStringEmpty(prevVersStr)) { const JCharacter* map[] = { "vers", prevVersStr }; text += JGetString(kUpgradeNoticeID); (JGetStringManager())->Replace(&text, map, sizeof(map)); itsHelpButton->SetLabel(JGetString(kChangeButtonLabelID)); itsIsUpgradeFlag = kJTrue; } textWidget->SetText(text); const JSize bdh = textWidget->GetBoundsHeight(); const JSize aph = textWidget->GetApertureHeight(); if (bdh > aph) { window->AdjustSize(0, bdh - aph); // safe to calculate once bdh > aph } }
void GLAboutDialog::BuildWindow ( const JCharacter* prevVersStr ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 430,180, ""); assert( window != NULL ); JXImageWidget* gloveIcon = jnew JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,15, 50,50); assert( gloveIcon != NULL ); JXStaticText* textWidget = jnew JXStaticText(JGetString("textWidget::GLAboutDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 90,20, 330,110); assert( textWidget != NULL ); JXImageWidget* npsIcon = jnew JXImageWidget(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,75, 65,65); assert( npsIcon != NULL ); JXTextButton* okButton = jnew JXTextButton(JGetString("okButton::GLAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 320,150, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::GLAboutDialog::shortcuts::JXLayout")); itsHelpButton = jnew JXTextButton(JGetString("itsHelpButton::GLAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 185,150, 60,20); assert( itsHelpButton != NULL ); itsCreditsButton = jnew JXTextButton(JGetString("itsCreditsButton::GLAboutDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,150, 60,20); assert( itsCreditsButton != NULL ); // end JXLayout window->SetTitle("About"); SetButtons(okButton, NULL); ListenTo(itsHelpButton); ListenTo(itsCreditsButton); const JCharacter* map1[] = { "version", JGetString("VERSION"), "copyright", JGetString("COPYRIGHT") }; JString text = JGetString(kDescriptionID, map1, sizeof(map1)); if (!JStringEmpty(prevVersStr)) { const JCharacter* map[] = { "vers", prevVersStr }; text += JGetString(kUpgradeNoticeID); (JGetStringManager())->Replace(&text, map, sizeof(map)); itsHelpButton->SetLabel(JGetString(kChangeButtonLabelID)); itsIsUpgradeFlag = kJTrue; } textWidget->SetText(text); JXImage* image = jnew JXImage(GetDisplay(), JXPM(glove_icon)); assert(image != NULL); gloveIcon->SetImage(image, kJTrue); // NPS icon image = jnew JXImage(GetDisplay(), nps); assert( image != NULL ); npsIcon->SetImage(image, kJTrue); const JSize bdh = textWidget->GetBoundsHeight(); const JSize aph = textWidget->GetApertureHeight(); if (bdh > aph) { window->AdjustSize(0, bdh - aph); // safe to calculate once bdh > aph } }
void CBEditSearchPathsDialog::BuildWindow ( const CBDirList& dirList, CBRelPathCSF* csf ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 370,370, ""); assert( window != NULL ); JXScrollbarSet* scrollbarSet = jnew JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,100, 240,220); assert( scrollbarSet != NULL ); JXTextButton* cancelButton = jnew JXTextButton(JGetString("cancelButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 70,340, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = jnew JXTextButton(JGetString("okButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 230,340, 70,20); assert( okButton != NULL ); JXStaticText* instrText = jnew JXStaticText(JGetString("instrText::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,20, 330,70); assert( instrText != NULL ); JXTextButton* addPathButton = jnew JXTextButton(JGetString("addPathButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,110, 70,20); assert( addPathButton != NULL ); addPathButton->SetShortcuts(JGetString("addPathButton::CBEditSearchPathsDialog::shortcuts::JXLayout")); JXTextButton* removePathButton = jnew JXTextButton(JGetString("removePathButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,140, 70,20); assert( removePathButton != NULL ); removePathButton->SetShortcuts(JGetString("removePathButton::CBEditSearchPathsDialog::shortcuts::JXLayout")); JXTextButton* choosePathButton = jnew JXTextButton(JGetString("choosePathButton::CBEditSearchPathsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,190, 70,20); assert( choosePathButton != NULL ); choosePathButton->SetShortcuts(JGetString("choosePathButton::CBEditSearchPathsDialog::shortcuts::JXLayout")); // end JXLayout instrText->SetText(JGetString(kInstructionsID)); window->AdjustSize(0, instrText->GetBoundsHeight() - instrText->GetFrameHeight()); instrText->SetSizing(JXWidget::kHElastic, JXWidget::kFixedTop); scrollbarSet->SetSizing(JXWidget::kHElastic, JXWidget::kVElastic); addPathButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); removePathButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); choosePathButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); window->SetTitle("Search Paths for Symbol Database"); window->PlaceAsDialogWindow(); window->LockCurrentMinSize(); UseModalPlacement(kJFalse); SetButtons(okButton, cancelButton); itsTable = jnew CBPathTable(dirList, addPathButton, removePathButton, choosePathButton, csf, scrollbarSet, scrollbarSet->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 10,10); assert( itsTable != NULL ); }
void SCFeedbackDirector::BuildWindow ( SCCircuitDocument* doc ) { const SCCircuit* circuit = doc->GetCircuit(); JArray<JCoordinate> heights(4); heights.AppendElement(kInitExprHeight); heights.AppendElement(kInitExprHeight); heights.AppendElement(kInitExprHeight); heights.AppendElement(kInitExprHeight); JArray<JCoordinate> minHeights(4); minHeights.AppendElement(kMinExprHeight); minHeights.AppendElement(kMinExprHeight); minHeights.AppendElement(kMinExprHeight); minHeights.AppendElement(kMinExprHeight); // begin JXLayout JXWindow* window = new JXWindow(this, 360,520, ""); assert( window != NULL ); itsMainPartition = new JXVertPartition(heights, 0, minHeights, window, JXWidget::kHElastic, JXWidget::kVElastic, 0,110, 365,415); assert( itsMainPartition != NULL ); itsInputSource = new SCComponentMenu(circuit, SCACSourceFilter, "Input source:", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 150,30); assert( itsInputSource != NULL ); itsDepSource = new SCComponentMenu(circuit, SCDepSourceFilter, "Dependent source:", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,60, 150,30); assert( itsDepSource != NULL ); itsEvalButton = new JXTextButton(JGetString("itsEvalButton::SCFeedbackDirector::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 230,20, 80,20); assert( itsEvalButton != NULL ); JXStaticText* layoutMessage = new JXStaticText(JGetString("layoutMessage::SCFeedbackDirector::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 240,50, 110,60); assert( layoutMessage != NULL ); // end JXLayout const JCoordinate kMinWindowWidth = window->GetBoundsWidth(); window->SetTitle("Feedback Theorem"); window->SetMinSize(kMinWindowWidth, window->GetBoundsHeight()); layoutMessage->SetText( "Output fn\nH0 | Hinf\n T | Tn\nScratch area"); itsInputSource->SetToPopupChoice(kJTrue); itsDepSource->SetToPopupChoice(kJTrue); ListenTo(itsEvalButton); // create sub-partitions const JCoordinate w = (itsMainPartition->GetBoundsWidth() - JPartition::kDragRegionSize)/2; JArray<JCoordinate> widths(2); widths.AppendElement(w); widths.AppendElement(w); const JCoordinate wMin = (kMinWindowWidth - JPartition::kDragRegionSize)/2; JArray<JCoordinate> minWidths(2); minWidths.AppendElement(wMin); minWidths.AppendElement(wMin); JXContainer* encl = itsMainPartition->GetCompartment(2); itsHPartition = new JXHorizPartition(widths, 0, minWidths, encl, JXWidget::kHElastic, JXWidget::kVElastic, 0,0, encl->GetBoundsWidth(), encl->GetBoundsHeight()); assert( itsHPartition != NULL ); encl = itsMainPartition->GetCompartment(3); itsTPartition = new JXHorizPartition(widths, 0, minWidths, encl, JXWidget::kHElastic, JXWidget::kVElastic, 0,0, encl->GetBoundsWidth(), encl->GetBoundsHeight()); assert( itsTPartition != NULL ); // create expressions SCExprEditorSet* exprSet = new SCExprEditorSet(doc, &itsOutputFn, itsMainPartition->GetCompartment(1), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( exprSet != NULL ); exprSet->FitToEnclosure(); exprSet = new SCExprEditorSet(doc, itsOutputFn, &itsH0, itsHPartition->GetCompartment(1), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( exprSet != NULL ); exprSet->FitToEnclosure(); exprSet = new SCExprEditorSet(doc, itsOutputFn, &itsHinf, itsHPartition->GetCompartment(2), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( exprSet != NULL ); exprSet->FitToEnclosure(); exprSet = new SCExprEditorSet(doc, itsOutputFn, &itsT, itsTPartition->GetCompartment(1), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( exprSet != NULL ); exprSet->FitToEnclosure(); exprSet = new SCExprEditorSet(doc, itsOutputFn, &itsTn, itsTPartition->GetCompartment(2), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( exprSet != NULL ); exprSet->FitToEnclosure(); exprSet = new SCExprEditorSet(doc, itsOutputFn, &itsScratchFn, itsMainPartition->GetCompartment(4), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( exprSet != NULL ); exprSet->FitToEnclosure(); // add our menu items JXTextMenu* menu = itsOutputFn->GetExtraMenu(); menu->AppendItem(kBuildH0FormItemStr); itsBuildH0Index = menu->GetItemCount(); menu->AppendItem(kBuildHinfFormItemStr); itsBuildHinfIndex = menu->GetItemCount(); menu->ShowSeparatorAfter(itsBuildH0Index-1); ListenTo(menu); }
void CBEditStylerDialog::BuildWindow ( const JCharacter* windowTitle, const JBoolean active, const JCharacter** typeNames, const JArray<JFontStyle>& typeStyles, const JArray<CBStylerBase::WordStyle>& wordList, const CBTextFileType fileType ) { // begin JXLayout JXWindow* window = new JXWindow(this, 370,390, ""); assert( window != NULL ); JXScrollbarSet* scrollbarSet1 = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kVElastic, 20,110, 240,110); assert( scrollbarSet1 != NULL ); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 40,360, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 250,360, 70,20); assert( okButton != NULL ); JXStaticText* instrText = new JXStaticText(JGetString("instrText::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,50, 330,50); assert( instrText != NULL ); JXTextButton* newWordButton = new JXTextButton(JGetString("newWordButton::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,240, 70,20); assert( newWordButton != NULL ); newWordButton->SetShortcuts(JGetString("newWordButton::CBEditStylerDialog::shortcuts::JXLayout")); JXTextButton* removeButton = new JXTextButton(JGetString("removeButton::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 280,270, 70,20); assert( removeButton != NULL ); removeButton->SetShortcuts(JGetString("removeButton::CBEditStylerDialog::shortcuts::JXLayout")); JXScrollbarSet* scrollbarSet2 = new JXScrollbarSet(window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 20,230, 240,110); assert( scrollbarSet2 != NULL ); itsActiveCB = new JXTextCheckbox(JGetString("itsActiveCB::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 80,15, 220,20); assert( itsActiveCB != NULL ); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::CBEditStylerDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 145,360, 70,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::CBEditStylerDialog::shortcuts::JXLayout")); // end JXLayout window->SetTitle(windowTitle); SetButtons(okButton, cancelButton); itsActiveCB->SetState(active); instrText->SetText(JGetString(kInstructionsID)); ListenTo(itsHelpButton); // create tables itsTypeTable = new CBStylerTable(typeNames, typeStyles, scrollbarSet1, scrollbarSet1->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 10,10); assert( itsTypeTable != NULL ); itsTypeTable->FitToEnclosure(); itsWordTable = new CBStylerTable(fileType, wordList, newWordButton, removeButton, scrollbarSet2, scrollbarSet2->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 10,10); assert( itsWordTable != NULL ); itsWordTable->FitToEnclosure(); // adjust window size JCoordinate rowBorderWidth; JColorIndex rowBorderColor; itsTypeTable->GetRowBorderInfo(&rowBorderWidth, &rowBorderColor); const JCoordinate bdh = JMin(itsTypeTable->GetBoundsHeight(), kMaxTypeRowCount * itsTypeTable->GetDefaultRowHeight() + (kMaxTypeRowCount-1) * rowBorderWidth); const JCoordinate aph = itsTypeTable->GetApertureHeight(); window->AdjustSize(0, bdh - aph); scrollbarSet1->SetSizing(JXWidget::kHElastic, JXWidget::kFixedTop); scrollbarSet2->SetSizing(JXWidget::kHElastic, JXWidget::kVElastic); okButton->SetSizing(JXWidget::kFixedLeft, JXWidget::kFixedBottom); cancelButton->SetSizing(JXWidget::kFixedLeft, JXWidget::kFixedBottom); itsHelpButton->SetSizing(JXWidget::kFixedLeft, JXWidget::kFixedBottom); newWordButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); removeButton->SetSizing(JXWidget::kFixedRight, JXWidget::kFixedTop); UseModalPlacement(kJFalse); window->PlaceAsDialogWindow(); window->LockCurrentMinSize(); }