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 } }
const JCharacter* SyGGetWMClassInstance() { return JGetString("SyGName"); }
const JCharacter* THXGetVersionNumberStr() { return JGetString("VERSION"); }
void CBExtEditorDialog::BuildWindow ( const JBoolean editTextLocally, const JCharacter* editTextFileCmd, const JCharacter* editTextFileLineCmd, const JBoolean editBinaryLocally, const JCharacter* editBinaryFileCmd ) { // begin JXLayout JXWindow* window = new JXWindow(this, 450,220, ""); assert( window != NULL ); itsEditTextFileCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 200,40, 230,20); assert( itsEditTextFileCmdInput != NULL ); itsEditTextFileLineCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 200,60, 230,20); assert( itsEditTextFileLineCmdInput != NULL ); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 100,190, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 270,190, 70,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::CBExtEditorDialog::shortcuts::JXLayout")); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 160,80, 270,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetFontSize(8); obj1_JXLayout->SetToLabel(); JXStaticText* obj2_JXLayout = new JXStaticText(JGetString("obj2_JXLayout::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,40, 170,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetToLabel(); JXStaticText* obj3_JXLayout = new JXStaticText(JGetString("obj3_JXLayout::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,60, 170,20); assert( obj3_JXLayout != NULL ); obj3_JXLayout->SetToLabel(); itsExtTextEditorCB = new JXTextCheckbox(JGetString("itsExtTextEditorCB::CBExtEditorDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,20, 160,20); assert( itsExtTextEditorCB != NULL ); itsEditBinaryFileCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 200,130, 230,20); assert( itsEditBinaryFileCmdInput != NULL ); JXStaticText* obj4_JXLayout = new JXStaticText(JGetString("obj4_JXLayout::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 200,150, 230,20); assert( obj4_JXLayout != NULL ); obj4_JXLayout->SetFontSize(8); obj4_JXLayout->SetToLabel(); JXStaticText* obj5_JXLayout = new JXStaticText(JGetString("obj5_JXLayout::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,130, 170,20); assert( obj5_JXLayout != NULL ); obj5_JXLayout->SetToLabel(); itsExtBinaryEditorCB = new JXTextCheckbox(JGetString("itsExtBinaryEditorCB::CBExtEditorDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,110, 180,20); assert( itsExtBinaryEditorCB != NULL ); // end JXLayout window->SetTitle("External Editor"); SetButtons(okButton, cancelButton); itsExtTextEditorCB->SetState(!editTextLocally); itsEditTextFileCmdInput->SetText(editTextFileCmd); itsEditTextFileCmdInput->SetCharacterInWordFunction(JXChooseSaveFile::IsCharacterInWord); itsEditTextFileLineCmdInput->SetText(editTextFileLineCmd); itsEditTextFileLineCmdInput->SetCharacterInWordFunction(JXChooseSaveFile::IsCharacterInWord); itsExtBinaryEditorCB->SetState(!editBinaryLocally); itsEditBinaryFileCmdInput->SetText(editBinaryFileCmd); itsEditBinaryFileCmdInput->SetCharacterInWordFunction(JXChooseSaveFile::IsCharacterInWord); // until we have a built-in one itsExtBinaryEditorCB->SetState(kJTrue); itsExtBinaryEditorCB->Deactivate(); UpdateDisplay(); ListenTo(itsExtTextEditorCB); ListenTo(itsExtBinaryEditorCB); }
void TestInputFieldsDialog::BuildWindow() { // begin JXLayout JXWindow* window = new JXWindow(this, 620,180, ""); assert( window != NULL ); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 180,150, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 390,150, 70,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::TestInputFieldsDialog::shortcuts::JXLayout")); JXInputField* text1 = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,20, 180,20); assert( text1 != NULL ); JXInputField* text2 = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,40, 180,20); assert( text2 != NULL ); JXInputField* text3 = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,60, 180,20); assert( text3 != NULL ); JXInputField* text4 = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,80, 180,20); assert( text4 != NULL ); JXFloatInput* f1 = new JXFloatInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 380,20, 90,20); assert( f1 != NULL ); JXFloatInput* f2 = new JXFloatInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 380,40, 90,20); assert( f2 != NULL ); JXFloatInput* f3 = new JXFloatInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 380,60, 90,20); assert( f3 != NULL ); JXFloatInput* f4 = new JXFloatInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 380,80, 90,20); assert( f4 != NULL ); JXIntegerInput* i1 = new JXIntegerInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 550,20, 50,20); assert( i1 != NULL ); itsLowerValue = new JXIntegerInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 550,40, 50,20); assert( itsLowerValue != NULL ); itsUpperValue = new JXIntegerInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 550,60, 50,20); assert( itsUpperValue != NULL ); JXIntegerInput* i4 = new JXIntegerInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 550,80, 50,20); assert( i4 != NULL ); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,20, 100,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetToLabel(); JXStaticText* obj2_JXLayout = new JXStaticText(JGetString("obj2_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,40, 100,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetFontName("Times"); obj2_JXLayout->SetFontSize(8); const JFontStyle obj2_JXLayout_style(kJTrue, kJFalse, 0, kJFalse, (GetColormap())->GetGreenColor()); obj2_JXLayout->SetFontStyle(obj2_JXLayout_style); obj2_JXLayout->SetToLabel(); JXStaticText* obj3_JXLayout = new JXStaticText(JGetString("obj3_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,60, 100,20); assert( obj3_JXLayout != NULL ); obj3_JXLayout->SetFontName("Times"); const JFontStyle obj3_JXLayout_style(kJTrue, kJTrue, 0, kJFalse, (GetColormap())->GetBlackColor()); obj3_JXLayout->SetFontStyle(obj3_JXLayout_style); obj3_JXLayout->SetToLabel(); JXStaticText* obj4_JXLayout = new JXStaticText(JGetString("obj4_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,80, 100,20); assert( obj4_JXLayout != NULL ); obj4_JXLayout->SetFontSize(8); const JFontStyle obj4_JXLayout_style(kJFalse, kJTrue, 0, kJFalse, (GetColormap())->GetBlackColor()); obj4_JXLayout->SetFontStyle(obj4_JXLayout_style); obj4_JXLayout->SetToLabel(); JXStaticText* obj5_JXLayout = new JXStaticText(JGetString("obj5_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 300,20, 80,20); assert( obj5_JXLayout != NULL ); obj5_JXLayout->SetToLabel(); JXStaticText* obj6_JXLayout = new JXStaticText(JGetString("obj6_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 300,40, 80,20); assert( obj6_JXLayout != NULL ); obj6_JXLayout->SetToLabel(); JXStaticText* obj7_JXLayout = new JXStaticText(JGetString("obj7_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 300,60, 80,20); assert( obj7_JXLayout != NULL ); obj7_JXLayout->SetToLabel(); JXStaticText* obj8_JXLayout = new JXStaticText(JGetString("obj8_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 300,80, 80,20); assert( obj8_JXLayout != NULL ); obj8_JXLayout->SetToLabel(); JXStaticText* obj9_JXLayout = new JXStaticText(JGetString("obj9_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 480,40, 70,20); assert( obj9_JXLayout != NULL ); obj9_JXLayout->SetToLabel(); JXStaticText* obj10_JXLayout = new JXStaticText(JGetString("obj10_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 480,60, 70,20); assert( obj10_JXLayout != NULL ); obj10_JXLayout->SetToLabel(); JXStaticText* obj11_JXLayout = new JXStaticText(JGetString("obj11_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 480,80, 70,20); assert( obj11_JXLayout != NULL ); obj11_JXLayout->SetToLabel(); JXStaticText* obj12_JXLayout = new JXStaticText(JGetString("obj12_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 480,20, 70,20); assert( obj12_JXLayout != NULL ); obj12_JXLayout->SetToLabel(); JXPasswordInput* pwInput = new JXPasswordInput(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,110, 180,20); assert( pwInput != NULL ); JXStaticText* obj13_JXLayout = new JXStaticText(JGetString("obj13_JXLayout::TestInputFieldsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,110, 100,20); assert( obj13_JXLayout != NULL ); obj13_JXLayout->SetToLabel(); // end JXLayout window->SetTitle("Testing Input Fields"); SetButtons(okButton, cancelButton); text2->SetText("required"); text2->SetIsRequired(); text3->SetMaxLength(5); text4->SetText("max 10"); text4->SetIsRequired(); text4->SetMaxLength(10); f2->SetLowerLimit(-3.2); f3->SetUpperLimit(-3.2); f4->SetLimits(2.1, 10.3); itsLowerValue->SetLowerLimit(-3); itsUpperValue->SetUpperLimit(8); i4->SetLimits(-2, 24); // always set initial values so they don't generate errors itsLowerValue->SetValue(-1); // never store real passwords as plaintext! pwInput->SetText("password"); pwInput->SetHint("For security, the actual password is not displayed"); }
JBoolean JXDockWidget::Dock ( JXWindow* w, const JBoolean reportError ) { if (itsChildPartition != NULL) { return kJFalse; } const JRect geom = GetApertureGlobal(); JPoint minSize; if (w->Dock(this, (GetWindow())->GetXWindow(), geom, &minSize)) { if (itsWindowList == NULL) { itsWindowList = new JPtrArray<JXWindow>(JPtrArrayT::kForgetAll); assert( itsWindowList != NULL ); } const JSize count = itsWindowList->GetElementCount(); assert( count == itsTabGroup->GetTabCount() ); const JCharacter* title = JXFileDocument::SkipNeedsSavePrefix(w->GetTitle()); JIndex index = count+1; for (JIndex i=1; i<=count; i++) { const JCharacter* t = JXFileDocument::SkipNeedsSavePrefix((itsWindowList->NthElement(i))->GetTitle()); if (JStringCompare(title, t, kJFalse) < 0) { index = i; break; } } itsWindowList->InsertAtIndex(index, w); ListenTo(w); UpdateMinSize(); itsTabGroup->InsertTab(index, w->GetTitle()); // Can't call ShowTab() because window might be partially constructed, // so Activate() could blow up. JXSelectTabTask* task = new JXSelectTabTask(itsTabGroup, index); assert( task != NULL ); (JXGetApplication())->InstallUrgentTask(task); return kJTrue; } else { if (reportError) { (JGetUserNotification())->ReportError(JGetString(kWindowWillNotFitID)); } return kJFalse; } }
void CBEditTextPrefsDialog::BuildWindow ( CBTextDocument* doc ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 640,530, ""); assert( window != NULL ); itsTabCharCountInput = jnew JXIntegerInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 540,130, 40,20); assert( itsTabCharCountInput != NULL ); itsCRMLineWidthInput = jnew JXIntegerInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 540,150, 40,20); assert( itsCRMLineWidthInput != NULL ); itsUndoDepthInput = jnew JXIntegerInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 540,170, 40,20); assert( itsUndoDepthInput != NULL ); JXTextButton* cancelButton = jnew JXTextButton(JGetString("cancelButton::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 40,490, 60,20); assert( cancelButton != NULL ); JXTextButton* okButton = jnew JXTextButton(JGetString("okButton::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 220,490, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::CBEditTextPrefsDialog::shortcuts::JXLayout")); itsCreateBackupCB = jnew JXTextCheckbox(JGetString("itsCreateBackupCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,230, 300,20); assert( itsCreateBackupCB != NULL ); itsAutoIndentCB = jnew JXTextCheckbox(JGetString("itsAutoIndentCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,160, 280,20); assert( itsAutoIndentCB != NULL ); JXStaticText* spacesPerTabLabel = jnew JXStaticText(JGetString("spacesPerTabLabel::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,130, 210,20); assert( spacesPerTabLabel != NULL ); spacesPerTabLabel->SetToLabel(); itsExtraSpaceWindTitleCB = jnew JXTextCheckbox(JGetString("itsExtraSpaceWindTitleCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,310, 300,20); assert( itsExtraSpaceWindTitleCB != NULL ); itsOpenComplFileOnTopCB = jnew JXTextCheckbox(JGetString("itsOpenComplFileOnTopCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,280, 300,20); assert( itsOpenComplFileOnTopCB != NULL ); itsFontMenu = jnew JXChooseMonoFont(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 280,60); assert( itsFontMenu != NULL ); itsEmulatorMenu = jnew JXTextMenu(JGetString("itsEmulatorMenu::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,90, 280,25); assert( itsEmulatorMenu != NULL ); JXStaticText* undoDepthLabel = jnew JXStaticText(JGetString("undoDepthLabel::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,170, 210,20); assert( undoDepthLabel != NULL ); undoDepthLabel->SetToLabel(); itsUseDNDCB = jnew JXTextCheckbox(JGetString("itsUseDNDCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,130, 280,20); assert( itsUseDNDCB != NULL ); itsOnlyBackupIfNoneCB = jnew JXTextCheckbox(JGetString("itsOnlyBackupIfNoneCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,250, 300,20); assert( itsOnlyBackupIfNoneCB != NULL ); itsLeftToFrontOfTextCB = jnew JXTextCheckbox(JGetString("itsLeftToFrontOfTextCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,450, 300,20); assert( itsLeftToFrontOfTextCB != NULL ); itsHelpButton = jnew JXTextButton(JGetString("itsHelpButton::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 130,490, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::CBEditTextPrefsDialog::shortcuts::JXLayout")); itsBalanceWhileTypingCB = jnew JXTextCheckbox(JGetString("itsBalanceWhileTypingCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,310, 280,20); assert( itsBalanceWhileTypingCB != NULL ); itsScrollToBalanceCB = jnew JXTextCheckbox(JGetString("itsScrollToBalanceCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,330, 280,20); assert( itsScrollToBalanceCB != NULL ); itsBeepWhenTypeUnbalancedCB = jnew JXTextCheckbox(JGetString("itsBeepWhenTypeUnbalancedCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,350, 280,20); assert( itsBeepWhenTypeUnbalancedCB != NULL ); JXStaticText* cpmLabel = jnew JXStaticText(JGetString("cpmLabel::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,150, 210,20); assert( cpmLabel != NULL ); cpmLabel->SetToLabel(); itsSmartTabCB = jnew JXTextCheckbox(JGetString("itsSmartTabCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,220, 280,20); assert( itsSmartTabCB != NULL ); itsPWModRG = jnew JXRadioGroup(window, JXWidget::kHElastic, JXWidget::kVElastic, 460,350, 160,80); assert( itsPWModRG != NULL ); JXTextRadioButton* ctrlMetaLabel = jnew JXTextRadioButton(JXTEBase::kCtrlMetaPWMod, JGetString("ctrlMetaLabel::CBEditTextPrefsDialog::JXLayout"), itsPWModRG, JXWidget::kHElastic, JXWidget::kVElastic, 10,10, 90,20); assert( ctrlMetaLabel != NULL ); JXTextRadioButton* mod2Label = jnew JXTextRadioButton(JXTEBase::kMod2PWMod, JGetString("mod2Label::CBEditTextPrefsDialog::JXLayout"), itsPWModRG, JXWidget::kHElastic, JXWidget::kVElastic, 10,30, 70,20); assert( mod2Label != NULL ); JXTextRadioButton* mod3Label = jnew JXTextRadioButton(JXTEBase::kMod3PWMod, JGetString("mod3Label::CBEditTextPrefsDialog::JXLayout"), itsPWModRG, JXWidget::kHElastic, JXWidget::kVElastic, 10,50, 70,20); assert( mod3Label != NULL ); JXTextRadioButton* mod4Label = jnew JXTextRadioButton(JXTEBase::kMod4PWMod, JGetString("mod4Label::CBEditTextPrefsDialog::JXLayout"), itsPWModRG, JXWidget::kHElastic, JXWidget::kVElastic, 90,30, 60,20); assert( mod4Label != NULL ); JXTextRadioButton* mod5Label = jnew JXTextRadioButton(JXTEBase::kMod5PWMod, JGetString("mod5Label::CBEditTextPrefsDialog::JXLayout"), itsPWModRG, JXWidget::kHElastic, JXWidget::kVElastic, 90,50, 60,20); assert( mod5Label != NULL ); JXStaticText* partialWordTitle = jnew JXStaticText(JGetString("partialWordTitle::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,360, 120,60); assert( partialWordTitle != NULL ); itsCopyWhenSelectCB = jnew JXTextCheckbox(JGetString("itsCopyWhenSelectCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,250, 280,20); assert( itsCopyWhenSelectCB != NULL ); itsColorButton[CBPrefsManager::kTextColorIndex-1] = jnew JXTextButton(JGetString("itsColorButton[CBPrefsManager::kTextColorIndex-1]::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 400,50, 40,20); assert( itsColorButton[CBPrefsManager::kTextColorIndex-1] != NULL ); itsColorButton[CBPrefsManager::kBackColorIndex-1] = jnew JXTextButton(JGetString("itsColorButton[CBPrefsManager::kBackColorIndex-1]::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 440,50, 80,20); assert( itsColorButton[CBPrefsManager::kBackColorIndex-1] != NULL ); JXStaticText* changeColorLabel = jnew JXStaticText(JGetString("changeColorLabel::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 310,50, 90,20); assert( changeColorLabel != NULL ); changeColorLabel->SetToLabel(); itsColorButton[CBPrefsManager::kSelColorIndex-1] = jnew JXTextButton(JGetString("itsColorButton[CBPrefsManager::kSelColorIndex-1]::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 560,50, 60,20); assert( itsColorButton[CBPrefsManager::kSelColorIndex-1] != NULL ); itsColorButton[CBPrefsManager::kSelLineColorIndex-1] = jnew JXTextButton(JGetString("itsColorButton[CBPrefsManager::kSelLineColorIndex-1]::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 400,70, 50,20); assert( itsColorButton[CBPrefsManager::kSelLineColorIndex-1] != NULL ); itsColorButton[CBPrefsManager::kCaretColorIndex-1] = jnew JXTextButton(JGetString("itsColorButton[CBPrefsManager::kCaretColorIndex-1]::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 520,50, 40,20); assert( itsColorButton[CBPrefsManager::kCaretColorIndex-1] != NULL ); itsDefColorsButton = jnew JXTextButton(JGetString("itsDefColorsButton::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 400,95, 100,20); assert( itsDefColorsButton != NULL ); itsInvColorsButton = jnew JXTextButton(JGetString("itsInvColorsButton::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 500,95, 100,20); assert( itsInvColorsButton != NULL ); JXStaticText* colorSetsLabel = jnew JXStaticText(JGetString("colorSetsLabel::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 310,95, 90,20); assert( colorSetsLabel != NULL ); colorSetsLabel->SetToLabel(); itsTabToSpacesCB = jnew JXTextCheckbox(JGetString("itsTabToSpacesCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,190, 280,20); assert( itsTabToSpacesCB != NULL ); itsHomeEndCB = jnew JXTextCheckbox(JGetString("itsHomeEndCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 330,470, 300,20); assert( itsHomeEndCB != NULL ); itsScrollCaretCB = jnew JXTextCheckbox(JGetString("itsScrollCaretCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 330,490, 300,20); assert( itsScrollCaretCB != NULL ); itsSortFnMenuCB = jnew JXTextCheckbox(JGetString("itsSortFnMenuCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,390, 280,20); assert( itsSortFnMenuCB != NULL ); itsPackFnMenuCB = jnew JXTextCheckbox(JGetString("itsPackFnMenuCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,430, 280,20); assert( itsPackFnMenuCB != NULL ); itsColorButton[CBPrefsManager::kRightMarginColorIndex-1] = jnew JXTextButton(JGetString("itsColorButton[CBPrefsManager::kRightMarginColorIndex-1]::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 450,70, 160,20); assert( itsColorButton[CBPrefsManager::kRightMarginColorIndex-1] != NULL ); itsRightMarginCB = jnew JXTextCheckbox(JGetString("itsRightMarginCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 330,190, 210,20); assert( itsRightMarginCB != NULL ); itsRightMarginInput = jnew JXIntegerInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 540,190, 40,20); assert( itsRightMarginInput != NULL ); itsSampleText = jnew CBSampleText(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 310,20, 310,25); assert( itsSampleText != NULL ); itsNSInFnMenuCB = jnew JXTextCheckbox(JGetString("itsNSInFnMenuCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,410, 280,20); assert( itsNSInFnMenuCB != NULL ); JXStaticText* wordWrapHint = jnew JXStaticText(JGetString("wordWrapHint::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 40,460, 250,20); assert( wordWrapHint != NULL ); wordWrapHint->SetFontSize(JGetDefaultFontSize()-2); wordWrapHint->SetToLabel(); itsMiddleButtonPasteCB = jnew JXTextCheckbox(JGetString("itsMiddleButtonPasteCB::CBEditTextPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,270, 280,20); assert( itsMiddleButtonPasteCB != NULL ); // end JXLayout window->SetTitle("Text Editor Preferences"); SetButtons(okButton, cancelButton); ListenTo(itsHelpButton); itsEmulatorMenu->SetMenuItems(kEmulatorMenuStr); itsEmulatorMenu->SetUpdateAction(JXMenu::kDisableNone); itsEmulatorMenu->SetToPopupChoice(kJTrue, itsEmulatorIndex); ListenTo(itsEmulatorMenu); itsCreateBackupCB->SetState(doc->WillMakeBackupFile()); itsOnlyBackupIfNoneCB->SetState(!doc->WillMakeNewBackupEveryOpen()); itsExtraSpaceWindTitleCB->SetState(doc->WillAllocateTitleSpace()); itsOpenComplFileOnTopCB->SetState(doc->WillOpenComplFileOnTop()); CBTextEditor* te = doc->GetTextEditor(); itsAutoIndentCB->SetState(te->WillAutoIndent()); itsUseDNDCB->SetState(te->CBAllowsDragAndDrop()); itsLeftToFrontOfTextCB->SetState(te->WillMoveToFrontOfText()); itsBalanceWhileTypingCB->SetState(te->WillBalanceWhileTyping()); itsScrollToBalanceCB->SetState(te->WillScrollToBalance()); itsBeepWhenTypeUnbalancedCB->SetState(te->WillBeepWhenTypeUnbalanced()); CBFnMenuUpdater* updater = CBGetFnMenuUpdater(); itsSortFnMenuCB->SetState(updater->WillSortFnNames()); itsNSInFnMenuCB->SetState(updater->WillIncludeNamespace()); itsPackFnMenuCB->SetState(updater->WillPackFnNames()); itsSmartTabCB->SetState(te->TabIsSmart()); itsTabToSpacesCB->SetState(te->TabInsertsSpaces()); itsCopyWhenSelectCB->SetState(te->WillCopyWhenSelect()); itsMiddleButtonPasteCB->SetState(te->MiddleButtonWillPaste()); const JFont& font = te->GetDefaultFont(); itsFontMenu->SetFont(font.GetName(), font.GetSize()); itsTabCharCountInput->SetValue(te->GetTabCharCount()); itsTabCharCountInput->SetLowerLimit(1); itsCRMLineWidthInput->SetValue(te->GetCRMLineWidth()); itsCRMLineWidthInput->SetLowerLimit(1); itsUndoDepthInput->SetValue(te->GetUndoDepth()); itsUndoDepthInput->SetLowerLimit(1); JSize margin; itsRightMarginCB->SetState(te->GetRightMarginWidth(&margin)); itsRightMarginInput->SetValue(margin); itsRightMarginInput->SetLowerLimit(1); itsPWModRG->SelectItem(te->GetPartialWordModifier()); itsHomeEndCB->SetState(JXTEBase::WillUseWindowsHomeEnd()); itsScrollCaretCB->SetState(CBTextEditor::CaretWillFollowScroll()); ListenTo(itsCreateBackupCB); ListenTo(itsBalanceWhileTypingCB); UpdateDisplay(); // must do this after SetWindow() CBPrefsManager* prefsMgr = CBGetPrefsManager(); JXColormap* colormap = GetColormap(); for (JIndex i=0; i<CBPrefsManager::kColorCount; i++) { itsColor[i] = prefsMgr->GetColor(i+1); ListenTo(itsColorButton[i]); } ListenTo(itsDefColorsButton); ListenTo(itsInvColorsButton); ListenTo(itsFontMenu); ListenTo(itsRightMarginCB); UpdateSampleText(); }
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 JXChooseFileDialog::BuildWindow ( const JCharacter* origName, const JCharacter* message ) { // begin JXLayout JXWindow* window = new JXWindow(this, 310,340, ""); assert( window != NULL ); SetWindow(window); itsOpenButton = new JXTextButton(JGetString("itsOpenButton::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 219,279, 72,22); assert( itsOpenButton != NULL ); itsOpenButton->SetShortcuts(JGetString("itsOpenButton::JXChooseFileDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,310, 70,20); assert( cancelButton != NULL ); JXTextButton* homeButton = new JXTextButton(JGetString("homeButton::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 250,140, 40,20); assert( homeButton != NULL ); JXStaticText* pathLabel = new JXStaticText(JGetString("pathLabel::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 20,20, 40,20); assert( pathLabel != NULL ); JXScrollbarSet* scrollbarSet = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,140, 180,190); assert( scrollbarSet != NULL ); JXStaticText* filterLabel = new JXStaticText(JGetString("filterLabel::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 20,50, 40,20); assert( filterLabel != NULL ); JXTextCheckbox* showHiddenCB = new JXTextCheckbox(JGetString("showHiddenCB::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 60,80, 130,20); assert( showHiddenCB != NULL ); JXPathInput* pathInput = new JXPathInput(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 60,20, 200,20); assert( pathInput != NULL ); JXInputField* filterInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 60,50, 200,20); assert( filterInput != NULL ); JXPathHistoryMenu* pathHistory = new JXPathHistoryMenu(1, "", window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 260,20, 30,20); assert( pathHistory != NULL ); JXStringHistoryMenu* filterHistory = new JXStringHistoryMenu(1, "", window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 260,50, 30,20); assert( filterHistory != NULL ); JXTextButton* upButton = new JXTextButton(JGetString("upButton::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,140, 30,20); assert( upButton != NULL ); itsSelectAllButton = new JXTextButton(JGetString("itsSelectAllButton::JXChooseFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,170, 70,20); assert( itsSelectAllButton != NULL ); JXCurrentPathMenu* currPathMenu = new JXCurrentPathMenu("/", window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,110, 180,20); assert( currPathMenu != NULL ); // end JXLayout SetObjects(scrollbarSet, pathLabel, pathInput, pathHistory, filterLabel, filterInput, filterHistory, itsOpenButton, cancelButton, upButton, homeButton, itsSelectAllButton, showHiddenCB, currPathMenu, origName, message); }
void SyGFindFileDialog::BuildWindow() { // begin JXLayout JXWindow* window = new JXWindow(this, 360,220, ""); assert( window != NULL ); itsActionRG = new JXRadioGroup(window, JXWidget::kHElastic, JXWidget::kFixedTop, 10,50, 340,120); assert( itsActionRG != NULL ); itsCloseButton = new JXTextButton(JGetString("itsCloseButton::SyGFindFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 120,190, 60,20); assert( itsCloseButton != NULL ); itsCloseButton->SetShortcuts(JGetString("itsCloseButton::SyGFindFileDialog::shortcuts::JXLayout")); itsSearchButton = new JXTextButton(JGetString("itsSearchButton::SyGFindFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 280,190, 60,20); assert( itsSearchButton != NULL ); itsSearchButton->SetShortcuts(JGetString("itsSearchButton::SyGFindFileDialog::shortcuts::JXLayout")); itsFileInput = new JXInputField(itsActionRG, JXWidget::kHElastic, JXWidget::kFixedTop, 35,30, 295,20); assert( itsFileInput != NULL ); JXTextRadioButton* obj1_JXLayout = new JXTextRadioButton(kFindFileAction, JGetString("obj1_JXLayout::SyGFindFileDialog::JXLayout"), itsActionRG, JXWidget::kHElastic, JXWidget::kFixedTop, 10,10, 320,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetShortcuts(JGetString("obj1_JXLayout::SyGFindFileDialog::shortcuts::JXLayout")); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::SyGFindFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 200,190, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::SyGFindFileDialog::shortcuts::JXLayout")); itsStayOpenCB = new JXTextCheckbox(JGetString("itsStayOpenCB::SyGFindFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,190, 90,20); assert( itsStayOpenCB != NULL ); itsExprInput = new JXInputField(itsActionRG, JXWidget::kHElastic, JXWidget::kFixedTop, 35,90, 295,20); assert( itsExprInput != NULL ); JXTextRadioButton* obj2_JXLayout = new JXTextRadioButton(kFindExprAction, JGetString("obj2_JXLayout::SyGFindFileDialog::JXLayout"), itsActionRG, JXWidget::kHElastic, JXWidget::kFixedTop, 10,70, 320,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetShortcuts(JGetString("obj2_JXLayout::SyGFindFileDialog::shortcuts::JXLayout")); JXStaticText* obj3_JXLayout = new JXStaticText(JGetString("obj3_JXLayout::SyGFindFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 50,20); assert( obj3_JXLayout != NULL ); obj3_JXLayout->SetToLabel(); itsPathInput = new JXPathInput(window, JXWidget::kHElastic, JXWidget::kFixedTop, 70,20, 210,20); assert( itsPathInput != NULL ); itsChoosePathButton = new JXTextButton(JGetString("itsChoosePathButton::SyGFindFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 280,20, 60,20); assert( itsChoosePathButton != NULL ); // end JXLayout window->SetTitle("Find files"); window->SetCloseAction(JXWindow::kDeactivateDirector); window->PlaceAsDialogWindow(); window->LockCurrentMinSize(); window->ShouldFocusWhenShow(kJTrue); itsActionRG->SetBorderWidth(0); ListenTo(itsChoosePathButton); ListenTo(itsActionRG); ListenTo(itsSearchButton); ListenTo(itsCloseButton); ListenTo(itsHelpButton); itsPathInput->ShouldAllowInvalidPath(); itsFileInput->ShouldBroadcastAllTextChanged(kJTrue); itsFileInput->SetCharacterInWordFunction(JXChooseSaveFile::IsCharacterInWord); itsFileInput->SetFont(JGetMonospaceFontName(), kJDefaultMonoFontSize, JFontStyle()); ListenTo(itsFileInput); itsExprInput->ShouldBroadcastAllTextChanged(kJTrue); itsExprInput->SetCharacterInWordFunction(JXChooseSaveFile::IsCharacterInWord); itsExprInput->SetFont(JGetMonospaceFontName(), kJDefaultMonoFontSize, JFontStyle()); ListenTo(itsExprInput); itsStayOpenCB->SetState(kJTrue); UpdateDisplay(); }
void JX2DPlotPrintEPSDialog::BuildWindow ( const JCharacter* fileName, const JBoolean printPreview, const JBoolean bw, const JCoordinate w, const JCoordinate h, const Unit unit ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 370,190, ""); assert( window != NULL ); JXTextButton* chooseFileButton = jnew JXTextButton(JGetString("chooseFileButton::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 80,20); assert( chooseFileButton != NULL ); chooseFileButton->SetShortcuts(JGetString("chooseFileButton::JX2DPlotPrintEPSDialog::shortcuts::JXLayout")); JXTextButton* okButton = jnew JXTextButton(JGetString("okButton::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 230,160, 70,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::JX2DPlotPrintEPSDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = jnew JXTextButton(JGetString("cancelButton::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 80,160, 70,20); assert( cancelButton != NULL ); cancelButton->SetShortcuts(JGetString("cancelButton::JX2DPlotPrintEPSDialog::shortcuts::JXLayout")); JXTextCheckbox* bwCB = jnew JXTextCheckbox(JGetString("bwCB::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 190,120, 150,20); assert( bwCB != NULL ); bwCB->SetShortcuts(JGetString("bwCB::JX2DPlotPrintEPSDialog::shortcuts::JXLayout")); JXTextCheckbox* previewCB = jnew JXTextCheckbox(JGetString("previewCB::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 30,120, 130,20); assert( previewCB != NULL ); previewCB->SetShortcuts(JGetString("previewCB::JX2DPlotPrintEPSDialog::shortcuts::JXLayout")); JXFileInput* fileInput = jnew JXFileInput(window, JXWidget::kHElastic, JXWidget::kFixedTop, 100,20, 250,20); assert( fileInput != NULL ); itsWidthInput = jnew JXFloatInput(window, JXWidget::kHElastic, JXWidget::kFixedTop, 70,60, 60,20); assert( itsWidthInput != NULL ); itsHeightInput = jnew JXFloatInput(window, JXWidget::kHElastic, JXWidget::kFixedTop, 70,80, 60,20); assert( itsHeightInput != NULL ); JXStaticText* widthLabel = jnew JXStaticText(JGetString("widthLabel::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,60, 50,20); assert( widthLabel != NULL ); widthLabel->SetToLabel(); JXStaticText* heightLabel = jnew JXStaticText(JGetString("heightLabel::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,80, 50,20); assert( heightLabel != NULL ); heightLabel->SetToLabel(); itsUnitMenu = jnew JXTextMenu(JGetString("itsUnitMenu::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 130,70, 60,20); assert( itsUnitMenu != NULL ); itsPredefSizeMenu = jnew JXTextMenu(JGetString("itsPredefSizeMenu::JX2DPlotPrintEPSDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 220,65, 120,30); assert( itsPredefSizeMenu != NULL ); // end JXLayout // size itsWidthInput->SetValue(w); itsWidthInput->SetLowerLimit(0.01); itsHeightInput->SetValue(h); itsHeightInput->SetLowerLimit(0.01); // unit itsUnit = kPixels; HandleUnitMenu(unit); itsUnitMenu->SetMenuItems(kUnitMenuStr); itsUnitMenu->SetUpdateAction(JXMenu::kDisableNone); itsUnitMenu->SetToPopupChoice(kJTrue, unit); ListenTo(itsUnitMenu); // predefined sizes itsPredefSizeMenu->SetMenuItems(kPredefSizeMenuStr); itsPredefSizeMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsPredefSizeMenu); // last, because file chooser may open, and that runs FTC SetObjects(okButton, cancelButton, fileInput, fileName, chooseFileButton, previewCB, printPreview, bwCB, bw); }
JBoolean JXFloatInput::InputValid() { if (!JXInputField::InputValid()) { return kJFalse; } else { const JString& text = GetText(); if (!IsRequired() && text.IsEmpty()) { return kJTrue; } JFloat value; if (!text.ConvertToFloat(&value)) { (JGetUserNotification())->ReportError(JGetString(kNotANumberID)); return kJFalse; } const JBoolean valid = ValueValid(value); JString errorStr; if (!valid && itsHasLowerLimitFlag && itsHasUpperLimitFlag) { const JString n(itsLowerLimit), m(itsUpperLimit); const JCharacter* map[] = { "min", n.GetCString(), "max", m.GetCString() }; errorStr = JGetString(kOutsideRangeID, map, sizeof(map)); } else if (!valid && itsHasLowerLimitFlag) { const JString n(itsLowerLimit); const JCharacter* map[] = { "min", n.GetCString() }; errorStr = JGetString(kBelowMinID, map, sizeof(map)); } else if (!valid) { assert( itsHasUpperLimitFlag ); const JString n(itsUpperLimit); const JCharacter* map[] = { "max", n.GetCString() }; errorStr = JGetString(kAboveMaxID, map, sizeof(map)); } if (!valid) { (JGetUserNotification())->ReportError(errorStr); } return valid; } }
void JXEditWWWPrefsDialog::BuildWindow ( const JCharacter* showURLCmd, const JCharacter* showFileContentCmd, const JCharacter* showFileLocationCmd, const JCharacter* composeMailCmd ) { // begin JXLayout JXWindow* window = new JXWindow(this, 510,290, ""); assert( window != NULL ); SetWindow(window); itsShowURLCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 240,20, 250,20); assert( itsShowURLCmdInput != NULL ); itsShowFileContentCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 240,80, 250,20); assert( itsShowFileContentCmdInput != NULL ); itsShowFileLocationCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 240,140, 250,20); assert( itsShowFileLocationCmdInput != NULL ); itsComposeMailCmdInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 240,200, 250,20); assert( itsComposeMailCmdInput != NULL ); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 110,260, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 319,259, 72,22); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::JXEditWWWPrefsDialog::shortcuts::JXLayout")); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 240,40, 150,20); assert( obj1_JXLayout != NULL ); JXStaticText* obj2_JXLayout = new JXStaticText(JGetString("obj2_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,23, 220,20); assert( obj2_JXLayout != NULL ); JXStaticText* obj3_JXLayout = new JXStaticText(JGetString("obj3_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,203, 220,20); assert( obj3_JXLayout != NULL ); JXStaticText* obj4_JXLayout = new JXStaticText(JGetString("obj4_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 240,220, 170,20); assert( obj4_JXLayout != NULL ); JXStaticText* obj5_JXLayout = new JXStaticText(JGetString("obj5_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 240,100, 140,20); assert( obj5_JXLayout != NULL ); JXStaticText* obj6_JXLayout = new JXStaticText(JGetString("obj6_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,83, 220,20); assert( obj6_JXLayout != NULL ); JXStaticText* obj7_JXLayout = new JXStaticText(JGetString("obj7_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 240,160, 140,20); assert( obj7_JXLayout != NULL ); JXStaticText* obj8_JXLayout = new JXStaticText(JGetString("obj8_JXLayout::JXEditWWWPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,143, 220,20); assert( obj8_JXLayout != NULL ); // end JXLayout window->SetTitle("Web Browser Preferences"); SetButtons(okButton, cancelButton); itsShowURLCmdInput->SetText(showURLCmd); itsShowURLCmdInput->SetIsRequired(); itsShowFileContentCmdInput->SetText(showFileContentCmd); itsShowFileContentCmdInput->SetIsRequired(); itsShowFileLocationCmdInput->SetText(showFileLocationCmd); itsShowFileLocationCmdInput->SetIsRequired(); itsComposeMailCmdInput->SetText(composeMailCmd); itsComposeMailCmdInput->SetIsRequired(); }
JBoolean CBCommand::Start ( const CBCommandManager::CmdInfo& info ) { CBCommandManager* mgr = (itsProjDoc != NULL ? itsProjDoc->GetCommandManager() : CBGetCommandManager()); if (info.isMake) { itsUpdateSymbolDatabaseFlag = kJTrue; CBCommand* p = itsParent; while (p != NULL) { if (p->itsBuildOutputDoc != NULL) { itsOutputDoc = p->itsBuildOutputDoc; break; } p = p->itsParent; } if (itsOutputDoc == NULL) { itsOutputDoc = mgr->GetCompileDoc(itsProjDoc); itsOutputDoc->IncrementUseCount(); } SetCompileDocStrings(); itsBuildOutputDoc = itsOutputDoc; } else if (info.useWindow) { CBCommand* p = itsParent; while (p != NULL) { if (p->itsRunOutputDoc != NULL) { itsOutputDoc = p->itsRunOutputDoc; break; } p = p->itsParent; } if (itsOutputDoc == NULL) { itsOutputDoc = mgr->GetOutputDoc(); itsOutputDoc->IncrementUseCount(); } itsDontCloseMsg = JGetString("RunCloseMsg::CBCommand"); itsWindowTitle = JGetString("RunWindowTitlePrefix::CBCommand"); if (!(info.menuText)->IsEmpty()) { itsWindowTitle += *(info.menuText); } else { itsWindowTitle += *(info.cmd); } itsRunOutputDoc = itsOutputDoc; } if (info.saveAll) // ok, now that we have decided that command can be executed { (CBGetDocumentManager())->SaveTextDocuments(kJFalse); } if (info.isVCS) { itsUpdateSymbolDatabaseFlag = kJTrue; } if (itsUpdateSymbolDatabaseFlag) { (CBGetDocumentManager())->CancelUpdateSymbolDatabases(); } // after saving all files, update Makefile JBoolean waitForMakeDepend = kJFalse; if (info.isMake && itsProjDoc != NULL) { waitForMakeDepend = (itsProjDoc->GetBuildManager())->UpdateMakefile(itsOutputDoc, &itsMakeDependCmd); } if (waitForMakeDepend) { if (itsMakeDependCmd != NULL) { itsCmdList->PrependElement(CmdInfo(NULL, itsMakeDependCmd, NULL, kJTrue)); ListenTo(itsMakeDependCmd); // many may need to hear; can't use SetParent() return kJTrue; } else { DeleteThis(); return kJFalse; } } else if (StartProcess()) { if (itsOutputDoc != NULL && info.raiseWindowWhenStart) { itsOutputDoc->Activate(); } return kJTrue; } else // we have been deleted { return kJFalse; } }
void JX2DPlotLabelDialog::BuildWindow() { // begin JXLayout JXWindow* window = new JXWindow(this, 540,150, ""); assert( window != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::JX2DPlotLabelDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 350,120, 70,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::JX2DPlotLabelDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::JX2DPlotLabelDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 120,120, 70,20); assert( cancelButton != NULL ); cancelButton->SetShortcuts(JGetString("cancelButton::JX2DPlotLabelDialog::shortcuts::JXLayout")); itsPlotTitle = new JXInputField(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 110,20, 220,20); assert( itsPlotTitle != NULL ); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::JX2DPlotLabelDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,20, 90,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetToLabel(); itsXAxisLabel = new JXInputField(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 110,50, 220,20); assert( itsXAxisLabel != NULL ); JXStaticText* obj2_JXLayout = new JXStaticText(JGetString("obj2_JXLayout::JX2DPlotLabelDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,50, 90,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetToLabel(); itsYAxisLabel = new JXInputField(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 110,80, 220,20); assert( itsYAxisLabel != NULL ); JXStaticText* obj3_JXLayout = new JXStaticText(JGetString("obj3_JXLayout::JX2DPlotLabelDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,80, 90,20); assert( obj3_JXLayout != NULL ); obj3_JXLayout->SetToLabel(); itsFontMenu = new JXFontNameMenu("Font:", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 350,20, 170,30); assert( itsFontMenu != NULL ); itsSizeMenu = new JXFontSizeMenu(itsFontMenu, "Size:", window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 350,60, 170,30); assert( itsSizeMenu != NULL ); // end JXLayout window->SetTitle("Edit Plot Labels"); SetButtons(okButton, cancelButton); itsFontMenu->SetToPopupChoice(); itsSizeMenu->SetToPopupChoice(); }
void CMRegistersDir::BuildWindow() { // begin JXLayout JXWindow* window = new JXWindow(this, 450,500, ""); assert( window != NULL ); JXMenuBar* menuBar = new JXMenuBar(window, JXWidget::kHElastic, JXWidget::kFixedTop, 0,0, 450,30); assert( menuBar != NULL ); JXScrollbarSet* scrollbarSet = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kVElastic, 0,30, 450,470); assert( scrollbarSet != NULL ); // end JXLayout window->SetTitle(JGetString("WindowTitleSuffix::CMRegistersDir")); window->SetCloseAction(JXWindow::kDeactivateDirector); window->SetMinSize(150, 150); window->ShouldFocusWhenShow(kJTrue); window->SetWMClass(CMGetWMClassInstance(), CMGetRegistersWindowClass()); (CMGetPrefsManager())->GetWindowSize(kRegistersWindowSizeID, window); JXDisplay* display = GetDisplay(); JXImage* icon = new JXImage(display, medic_registers_window); assert( icon != NULL ); window->SetIcon(icon); itsWidget = new JXStaticText("", kJFalse, kJTrue, scrollbarSet, scrollbarSet->GetScrollEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert(itsWidget != NULL); itsWidget->FitToEnclosure(); JString name; JSize size; (CMGetPrefsManager())->GetDefaultFont(&name, &size); itsWidget->SetFont(name, size); // menus itsFileMenu = menuBar->PrependTextMenu(kFileMenuTitleStr); itsFileMenu->SetMenuItems(kFileMenuStr, "CMThreadsDir"); itsFileMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsFileMenu); itsFileMenu->SetItemImage(kOpenCmd, jx_file_open); itsWidget->AppendEditMenu(menuBar); JXWDMenu* wdMenu = new JXWDMenu(kWindowsMenuTitleStr, menuBar, JXWidget::kFixedLeft, JXWidget::kVElastic, 0,0, 10,10); assert( wdMenu != NULL ); menuBar->AppendMenu(wdMenu); itsHelpMenu = menuBar->AppendTextMenu(kHelpMenuTitleStr); itsHelpMenu->SetMenuItems(kHelpMenuStr, "CMRegistersDir"); itsHelpMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsHelpMenu); itsHelpMenu->SetItemImage(kTOCCmd, jx_help_toc); itsHelpMenu->SetItemImage(kThisWindowCmd, jx_help_specific); }
void JXPTPrintSetupDialog::BuildWindow ( const JXPTPrinter::Destination dest, const JCharacter* printCmd, const JCharacter* fileName, const JBoolean printLineNumbers ) { // begin JXLayout JXWindow* window = new JXWindow(this, 370,220, ""); assert( window != NULL ); itsPrintCmdLabel = new JXStaticText(JGetString("itsPrintCmdLabel::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,70, 100,19); assert( itsPrintCmdLabel != NULL ); itsPrintCmdLabel->SetToLabel(); JXTextButton* okButton = new JXTextButton(JGetString("okButton::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 220,190, 70,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::JXPTPrintSetupDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 70,190, 70,20); assert( cancelButton != NULL ); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 50,30, 80,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetToLabel(); itsDestination = new JXRadioGroup(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 135,20, 139,39); assert( itsDestination != NULL ); JXTextRadioButton* obj2_JXLayout = new JXTextRadioButton(1, JGetString("obj2_JXLayout::JXPTPrintSetupDialog::JXLayout"), itsDestination, JXWidget::kFixedLeft, JXWidget::kFixedTop, 5,8, 70,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetShortcuts(JGetString("obj2_JXLayout::JXPTPrintSetupDialog::shortcuts::JXLayout")); JXTextRadioButton* obj3_JXLayout = new JXTextRadioButton(2, JGetString("obj3_JXLayout::JXPTPrintSetupDialog::JXLayout"), itsDestination, JXWidget::kFixedLeft, JXWidget::kFixedTop, 75,8, 50,20); assert( obj3_JXLayout != NULL ); obj3_JXLayout->SetShortcuts(JGetString("obj3_JXLayout::JXPTPrintSetupDialog::shortcuts::JXLayout")); itsPrintCmd = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedTop, 110,70, 240,20); assert( itsPrintCmd != NULL ); itsChooseFileButton = new JXTextButton(JGetString("itsChooseFileButton::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 30,70, 80,20); assert( itsChooseFileButton != NULL ); itsChooseFileButton->SetShortcuts(JGetString("itsChooseFileButton::JXPTPrintSetupDialog::shortcuts::JXLayout")); itsCopyCount = new JXIntegerInput(window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 140,110, 40,20); assert( itsCopyCount != NULL ); itsFirstPageIndex = new JXIntegerInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 230,150, 40,20); assert( itsFirstPageIndex != NULL ); itsLastPageIndex = new JXIntegerInput(window, JXWidget::kFixedRight, JXWidget::kFixedTop, 290,150, 40,20); assert( itsLastPageIndex != NULL ); itsPrintAllCB = new JXTextCheckbox(JGetString("itsPrintAllCB::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 40,150, 120,20); assert( itsPrintAllCB != NULL ); itsPrintAllCB->SetShortcuts(JGetString("itsPrintAllCB::JXPTPrintSetupDialog::shortcuts::JXLayout")); itsFirstPageIndexLabel = new JXStaticText(JGetString("itsFirstPageIndexLabel::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 160,150, 70,20); assert( itsFirstPageIndexLabel != NULL ); itsFirstPageIndexLabel->SetToLabel(); itsLastPageIndexLabel = new JXStaticText(JGetString("itsLastPageIndexLabel::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 270,150, 20,20); assert( itsLastPageIndexLabel != NULL ); itsLastPageIndexLabel->SetToLabel(); JXStaticText* obj4_JXLayout = new JXStaticText(JGetString("obj4_JXLayout::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 25,110, 115,20); assert( obj4_JXLayout != NULL ); obj4_JXLayout->SetToLabel(); itsPrintLineNumbersCB = new JXTextCheckbox(JGetString("itsPrintLineNumbersCB::JXPTPrintSetupDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedTop, 220,110, 130,20); assert( itsPrintLineNumbersCB != NULL ); itsPrintLineNumbersCB->SetShortcuts(JGetString("itsPrintLineNumbersCB::JXPTPrintSetupDialog::shortcuts::JXLayout")); // end JXLayout SetObjects(okButton, cancelButton, itsDestination, dest, itsPrintCmdLabel, itsPrintCmd, printCmd, itsChooseFileButton, fileName, itsCopyCount, itsPrintAllCB, itsFirstPageIndexLabel, itsFirstPageIndex, itsLastPageIndexLabel, itsLastPageIndex, itsPrintLineNumbersCB, printLineNumbers); }
const JString& CMRegistersDir::GetName() const { return JGetString("WindowsMenuText::CMRegistersDir"); }
JBoolean JXPathInput::InputValid() { if (itsAllowInvalidPathFlag) { return kJTrue; } else if (!JXInputField::InputValid()) { return kJFalse; } const JString& text = GetText(); if (text.IsEmpty()) // paranoia -- JXInputField should have reported { return !IsRequired(); } JString path; if (JIsRelativePath(text) && !HasBasePath()) { (JGetUserNotification())->ReportError(JGetString(kNoRelPathID)); RecalcAll(kJTrue); return kJFalse; } if (!JConvertToAbsolutePath(text, itsBasePath, &path)) { (JGetUserNotification())->ReportError(JGetString(kInvalidPathID)); RecalcAll(kJTrue); return kJFalse; } const JString currDir = JGetCurrentDirectory(); const JError err = JChangeDirectory(path); JChangeDirectory(currDir); if (err.OK()) { if (!JDirectoryReadable(path)) { (JGetUserNotification())->ReportError(JGetString(kUnreadableID)); RecalcAll(kJTrue); return kJFalse; } else if (itsRequireWriteFlag && !JDirectoryWritable(path)) { (JGetUserNotification())->ReportError(JGetString(kUnwritableID)); RecalcAll(kJTrue); return kJFalse; } else { return kJTrue; } } const JCharacter* errID; if (err == kJAccessDenied) { errID = kAccessDeniedID; } else if (err == kJBadPath) { errID = kBadPathID; } else if (err == kJComponentNotDirectory) { errID = kCompNotDirID; } else { errID = kInvalidDirID; } (JGetUserNotification())->ReportError(JGetString(errID)); RecalcAll(kJTrue); return kJFalse; }
void CBExecOutputDocument::SetConnection ( JProcess* p, const int inFD, const int outFD, const JCharacter* windowTitle, const JCharacter* dontCloseMsg, const JCharacter* execDir, const JCharacter* execCmd, const JBoolean showPID ) { assert( !ProcessRunning() && itsRecordLink == NULL && itsDataLink == NULL ); itsProcess = p; ListenTo(itsProcess); if (NeedsFormattedData()) { itsRecordLink = new RecordLink(inFD); assert( itsRecordLink != NULL ); ListenTo(itsRecordLink); } else { itsDataLink = new DataLink(inFD); assert( itsDataLink != NULL ); ListenTo(itsDataLink); } if (outFD != ACE_INVALID_HANDLE) { itsCmdStream = jnew JOutPipeStream(outFD, kJTrue); assert( itsCmdStream != NULL ); } CBTextEditor* te = GetTextEditor(); if (itsClearWhenStartFlag) { te->SetText(""); } else if (!te->IsEmpty()) { const JString& text = te->GetText(); JIndex i = text.GetLength()+1; while (i > 1 && text.GetCharacter(i-1) == '\n') { i--; } if (text.IndexValid(i)) { te->SetSelection(i, text.GetLength()); } te->Paste("\n\n----------\n\n"); te->ClearUndo(); } if (execCmd != NULL) { const JString timeStamp = JGetTimeStamp(); te->Paste(timeStamp); te->Paste("\n"); te->Paste(execDir); te->Paste("\n"); te->Paste(execCmd); if (showPID) { te->Paste("\n"); te->Paste(JGetString("ProcessID::CBExecOutputDocument")); te->Paste(JString(p->GetPID(), JString::kBase10)); } te->Paste("\n\n"); te->ClearUndo(); } itsPath = execDir; itsReceivedDataFlag = kJFalse; itsProcessPausedFlag = kJFalse; itsDontCloseMsg = dontCloseMsg; FileChanged(windowTitle, kJFalse); UpdateButtons(); te->SetWritable(kJFalse); itsCmdInput->SetText(""); }
void CMSourceDirector::BuildWindow() { const JIndex prefID = itsType == kMainSourceType ? kMainSrcToolBarID : itsType == kMainAsmType ? kMainAsmToolBarID : itsType == kAsmType ? kOtherAsmToolBarID : kOtherSrcToolBarID; // begin JXLayout JXWindow* window = jnew JXWindow(this, 600,550, ""); assert( window != NULL ); itsMenuBar = jnew JXMenuBar(window, JXWidget::kHElastic, JXWidget::kFixedTop, 0,0, 600,30); assert( itsMenuBar != NULL ); itsToolBar = jnew JXToolBar(CMGetPrefsManager(), prefID, itsMenuBar, window, JXWidget::kHElastic, JXWidget::kVElastic, 0,30, 600,500); assert( itsToolBar != NULL ); itsFileDisplay = jnew JXFileNameDisplay("", window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,530, 580,20); assert( itsFileDisplay != NULL ); CMFileDragSource* dragSource = jnew CMFileDragSource(this, window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 0,530, 20,20); assert( dragSource != NULL ); // end JXLayout window->SetTitle(JGetString( itsType == kMainAsmType ? "InitAsmWindowTitle::CMSourceDirector" : "InitSourceWindowTitle::CMSourceDirector")); window->SetMinSize(300, 200); if (itsType == kMainSourceType) { window->SetCloseAction(JXWindow::kDeactivateDirector); window->SetWMClass(CMGetWMClassInstance(), CMGetMainSourceWindowClass()); CMGetPrefsManager()->GetWindowSize(kMainCodeWindSizeID, window); JXDisplay* display = GetDisplay(); JXImage* icon = jnew JXImage(display, medic_current_source_window); assert( icon != NULL ); window->SetIcon(icon); } else if (itsType == kMainAsmType) { window->SetCloseAction(JXWindow::kDeactivateDirector); window->SetWMClass(CMGetWMClassInstance(), CMGetMainAsmWindowClass()); CMGetPrefsManager()->GetWindowSize(kMainAsmWindSizeID, window); JXDisplay* display = GetDisplay(); JXImage* icon = jnew JXImage(display, medic_current_asm_window); assert( icon != NULL ); window->SetIcon(icon); } else if (itsType == kAsmType) { window->SetWMClass(CMGetWMClassInstance(), CMGetAsmViewWindowClass()); CMGetPrefsManager()->GetWindowSize(kAsmWindSizeID, window, kJTrue); } else { window->SetWMClass(CMGetWMClassInstance(), CMGetSourceViewWindowClass()); CMGetPrefsManager()->GetWindowSize(kCodeWindSizeID, window, kJTrue); } JCoordinate w = window->GetFrameWidth(); itsFileMenu = itsMenuBar->AppendTextMenu(kFileMenuTitleStr); itsFileMenu->SetMenuItems(kFileMenuStr, "CMSourceDirector"); itsFileMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsFileMenu); itsFileMenu->SetItemImage(kOpenCmd, jx_file_open); itsFileMenu->SetItemImage(kPrintCmd, jx_file_print); // appends Edit & Search menus const JCoordinate kInitTableWidth = 50; JXScrollbarSet* scrollbarSet = jnew JXScrollbarSet(itsToolBar->GetWidgetEnclosure(), JXWidget::kHElastic, JXWidget::kVElastic, 0,0, 100,100); assert( scrollbarSet != NULL ); scrollbarSet->FitToEnclosure(); JXContainer* encl = scrollbarSet->GetScrollEnclosure(); itsText = jnew CMSourceText(this, itsCommandDir, itsMenuBar, scrollbarSet, encl, JXWidget::kHElastic, JXWidget::kVElastic, kInitTableWidth, 0, encl->GetApertureWidth()-kInitTableWidth, 100); assert( itsText != NULL ); itsText->FitToEnclosure(kJFalse, kJTrue); ListenTo(itsText); if (itsType == kMainAsmType || itsType == kAsmType) { itsTable = jnew CMLineAddressTable(this, itsText, scrollbarSet, encl, JXWidget::kFixedLeft, JXWidget::kVElastic, 0, 0, kInitTableWidth, 100); } else { itsTable = jnew CMLineNumberTable(this, itsText, scrollbarSet, encl, JXWidget::kFixedLeft, JXWidget::kVElastic, 0, 0, kInitTableWidth, 100); } assert( itsTable != NULL ); itsTable->FitToEnclosure(kJFalse, kJTrue); // requires itsText itsDebugMenu = itsCommandDir->CreateDebugMenu(itsMenuBar); ListenTo(itsDebugMenu); itsFnMenu = jnew CBFunctionMenu(NULL, kCBUnknownFT, itsText, itsMenuBar, JXWidget::kFixedLeft, JXWidget::kFixedTop, 0,0, 10,10); assert( itsFnMenu != NULL ); itsFnMenu->Hide(); itsPrefsMenu = itsMenuBar->AppendTextMenu(kPrefsMenuTitleStr); itsPrefsMenu->SetMenuItems(kPrefsMenuStr, "CMSourceDirector"); itsPrefsMenu->SetUpdateAction(JXMenu::kDisableNone); if (IsMainSourceWindow()) { itsPrefsMenu->RemoveItem(kWindowSizeCmd); } ListenTo(itsPrefsMenu); itsHelpMenu = itsMenuBar->AppendTextMenu(kHelpMenuTitleStr); itsHelpMenu->SetMenuItems(kHelpMenuStr, "CMSourceDirector"); itsHelpMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsHelpMenu); itsHelpMenu->SetItemImage(kTOCCmd, jx_help_toc); itsHelpMenu->SetItemImage(kThisWindowCmd, jx_help_specific); if (!IsMainSourceWindow()) { (GetDisplay()->GetWDManager())->DirectorCreated(this); } }
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()); }
void WizConnectDialog::BuildWindow ( const JCharacter* serverAddr, const JCharacter* playerName ) { // begin JXLayout JXWindow* window = new JXWindow(this, 370,110, ""); assert( window != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::WizConnectDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 260,85, 60,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::WizConnectDialog::shortcuts::JXLayout")); JXTextButton* quitButton = new JXTextButton(JGetString("quitButton::WizConnectDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 50,85, 60,20); assert( quitButton != NULL ); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::WizConnectDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 155,85, 60,20); assert( itsHelpButton != NULL ); itsHelpButton->SetShortcuts(JGetString("itsHelpButton::WizConnectDialog::shortcuts::JXLayout")); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::WizConnectDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,20, 100,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetToLabel(); JXStaticText* obj2_JXLayout = new JXStaticText(JGetString("obj2_JXLayout::WizConnectDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,40, 100,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetToLabel(); itsServerAddr = new JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 120,20, 230,20); assert( itsServerAddr != NULL ); itsPlayerName = new JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 120,40, 230,20); assert( itsPlayerName != NULL ); // end JXLayout window->SetTitle("Connect to WizWar server"); SetButtons(okButton, quitButton); ListenTo(itsHelpButton); itsServerAddr->SetText(serverAddr); itsServerAddr->SetIsRequired(); itsPlayerName->SetText(playerName); itsPlayerName->SetIsRequired(); }
JBoolean CBExecOutputDocument::ProcessFinished ( const JProcess::Finished& info ) { // Since the process has terminated, we know that it has written // everything to the pipe. When handle_input() no longer broadcasts, // we know we have read everything. do { itsReceivedDataFlag = kJFalse; JXApplication::CheckACEReactor(); } while (itsReceivedDataFlag); const pid_t pid = itsProcess->GetPID(); JProcess* p = itsProcess; itsProcess = NULL; jdelete p; delete itsRecordLink; itsRecordLink = NULL; delete itsDataLink; itsDataLink = NULL; CloseOutFD(); UpdateButtons(); CBTextEditor* te = GetTextEditor(); const JXTEBase::DisplayState state = te->SaveDisplayState(); te->SetCaretLocation(te->GetTextLength()+1); JBoolean stayOpen = kJTrue; int result; const JChildExitReason reason = info.GetReason(&result); if (info.Successful() || (reason == kJChildSignalled && result == SIGKILL)) { DataReverted(); te->ClearUndo(); if (!IsActive()) { stayOpen = kJFalse; } else { const JString reasonStr = JPrintChildExitReason(reason, result); te->Paste("\n"); te->Paste(reasonStr); te->Paste("\n"); DataReverted(); te->ClearUndo(); } } else { const JString reasonStr = JPrintChildExitReason(reason, result); te->Paste("\n"); te->Paste(reasonStr); te->Paste("\n"); if (reason != kJChildFinished) { #ifdef _J_OSX const JCharacter* path = "/cores/"; #else const JCharacter* path = itsPath; #endif const JString coreName = "core." + JString(pid, JString::kBase10); const JString coreFull = JCombinePathAndName(path, coreName); if (JFileExists(coreFull)) { te->Paste(JGetString("CoreLocation::CBExecOutputDocument")); te->SetCurrentFontBold(kJTrue); te->Paste(coreFull); te->SetCurrentFontBold(kJFalse); } else { const JCharacter* map[] = { "name", coreName }; const JString msg = JGetString("CoreName::CBExecOutputDocument", map, sizeof(map)); te->Paste(msg); } te->Paste("\n"); } DataReverted(); te->ClearUndo(); if (!IsActive() || GetWindow()->IsIconified()) // don't raise if active { Activate(); } GetDisplay()->Beep(); } if (state.hadSelection) { te->RestoreDisplayState(state); } return stayOpen; }
TestWidget::TestWidget ( const JBoolean isMaster, const JBoolean isImage, JXMenuBar* menuBar, JXScrollbarSet* scrollbarSet, JXContainer* enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h ) : JXScrollableWidget(scrollbarSet, enclosure, hSizing, vSizing, x,y, w,h), itsRNG() { JIndex i; itsFillFlag = kJFalse; itsRandPointCount = 10; itsResizeDialog = NULL; SetBackColor(GetColormap()->GetDefaultBackColor()); // cursors JXDisplay* display = GetDisplay(); itsTrekCursor = display->CreateBuiltInCursor("XC_trek", XC_trek); itsGumbyCursor = display->CreateBuiltInCursor("XC_gumby", XC_gumby); itsBogosityCursor = display->CreateBuiltInCursor("XC_bogosity", XC_bogosity); itsFleurCursor = display->CreateBuiltInCursor("XC_fleur", XC_fleur); SetDefaultCursor(itsTrekCursor); // menus itsActionsMenu = menuBar->AppendTextMenu(kActionsMenuTitleStr); itsActionsMenu->SetTitleFontStyle(GetColormap()->GetWhiteColor()); itsActionsMenu->SetShortcuts(kActionsMenuShortcutStr); itsActionsMenu->SetMenuItems(kActionsMenuStr); itsActionsMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsActionsMenu); itsPointMenu = jnew JXTextMenu(itsActionsMenu, kPointMenuCmd, menuBar); assert( itsPointMenu != NULL ); itsPointMenu->SetMenuItems(kPointMenuStr); itsPointMenu->SetUpdateAction(JXMenu::kDisableNone); ListenTo(itsPointMenu); // This tests the JX response to an empty menu. JXTextMenu* emptyMenu = jnew JXTextMenu(itsActionsMenu, kEmptyMenuCmd, menuBar); assert( emptyMenu != NULL ); JXMenu* prevMenu = itsActionsMenu; JIndex prevMenuIndex = kAdviceMenuCmd; for (i=1; i<=kAdviceMenuCount; i++) { JXTextMenu* adviceMenu = jnew JXTextMenu(prevMenu, prevMenuIndex, menuBar); assert( adviceMenu != NULL ); adviceMenu->SetMenuItems(kAdviceMenuStr[i-1]); adviceMenu->SetUpdateAction(JXMenu::kDisableNone); if (i == kAdviceBoldMenuIndex) { adviceMenu->SetItemFontStyle(2, JFontStyle(kJTrue, kJFalse, 0, kJFalse, GetColormap()->GetBlackColor())); } prevMenu = adviceMenu; prevMenuIndex = 2; } BuildXlsfontsMenu(itsActionsMenu, menuBar); // secret menus are a bad idea because the user can't find them! itsSecretMenu = jnew JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10); assert( itsSecretMenu != NULL ); itsSecretMenu->SetMenuItems(kSecretMenuStr); itsSecretMenu->SetUpdateAction(JXMenu::kDisableNone); itsSecretMenu->SetToHiddenPopupMenu(kJTrue); // will assert() otherwise itsSecretMenu->Hide(); ListenTo(itsSecretMenu); itsSecretSubmenu = jnew JXTextMenu(itsSecretMenu, kSecretSubmenuIndex, this); assert( itsSecretSubmenu != NULL ); itsSecretSubmenu->SetMenuItems(kSecretSubmenuStr); itsSecretSubmenu->SetUpdateAction(JXMenu::kDisableNone); // we don't ListenTo() it because it's only there for show // image from xpm itsXPMImage = jnew JXImage(GetDisplay(), JXPM(macapp_xpm)); assert( itsXPMImage != NULL ); // partial image from image itsPartialXPMImage = jnew JXImage(*itsXPMImage, JRect(5,5,14,16)); assert( itsPartialXPMImage != NULL ); // home symbol itsHomeImage = jnew JXImage(GetDisplay(), JXPM(home_xpm)); assert( itsHomeImage != NULL ); itsHomeRect = itsHomeImage->GetBounds(); itsHomeRect.Shift(120, 10); // buffer contents of Widget in JXImage itsImageBuffer = NULL; if (isImage) { CreateImageBuffer(); } // initial size SetBounds(400,400); // enclosed objects itsAnimButton = jnew JXTextButton("Start", this, JXWidget::kFixedLeft, JXWidget::kFixedTop, 37,175, 50,30); assert( itsAnimButton != NULL ); itsAnimButton->SetShortcuts("#A"); ListenTo(itsAnimButton); if (isMaster) { itsQuitButton = jnew JXTextButton(JGetString("Quit::TestWidget"), this, JXWidget::kFixedRight, JXWidget::kFixedBottom, x,y, 50,30); assert( itsQuitButton != NULL ); JXColormap* colormap = GetColormap(); itsQuitButton->CenterWithinEnclosure(kJTrue, kJTrue); itsQuitButton->SetFontStyle(JFontStyle(kJTrue, kJFalse, 0, kJFalse, colormap->GetRedColor())); itsQuitButton->SetNormalColor(colormap->GetCyanColor()); itsQuitButton->SetPushedColor(colormap->GetBlueColor()); ListenTo(itsQuitButton); } else { itsQuitButton = NULL; } ExpandToFitContent(); // drops on iconfied window JXWindowIcon* windowIcon; const JBoolean hasIconWindow = GetWindow()->GetIconWidget(&windowIcon); assert( hasIconWindow ); ListenTo(windowIcon); }
void CBExecOutputDocument::UpdateButtons() { if (ProcessRunning()) { itsPauseButton->Activate(); itsKillButton->Activate(); if (itsStopButton != NULL) { itsStopButton->Activate(); } itsCmdPrompt->Show(); itsCmdInput->Show(); itsEOFButton->Show(); SetFileDisplayVisible(kJFalse); if (itsProcessPausedFlag) { itsPauseButton->SetLabel(JGetString("ResumeLabel::CBExecOutputDocument")); } else { itsPauseButton->SetLabel(JGetString("PauseLabel::CBExecOutputDocument")); } if (!itsProcessPausedFlag && itsCmdStream != NULL) { itsCmdInput->Activate(); itsEOFButton->Activate(); if (itsFocusToCmdFlag) { itsCmdInput->Focus(); } } else if (itsCmdStream == NULL) { itsCmdPrompt->Hide(); itsCmdInput->Hide(); itsEOFButton->Hide(); GetTextEditor()->Focus(); } else { itsCmdInput->Deactivate(); itsEOFButton->Deactivate(); GetTextEditor()->Focus(); } } else { itsPauseButton->Deactivate(); itsKillButton->Deactivate(); if (itsStopButton != NULL) { itsStopButton->Deactivate(); } itsCmdPrompt->Hide(); itsCmdInput->Hide(); itsEOFButton->Hide(); SetFileDisplayVisible(kJTrue); GetTextEditor()->Focus(); itsPauseButton->SetLabel(JGetString("PauseLabel::CBExecOutputDocument")); } }
void GMailPrefsDialog::BuildWindow ( const JBoolean showstate, const JBoolean autoQuote, const JBoolean showSender, const JString& senderString, const JString& fontname, const JSize fontsize, const JSize maxQuotedReply, const JBoolean reportSCErrors, const JSize spacesPerTab, const JBoolean beepOnNewMail, const JIndex encType, const JString& filterFile, const JString& defInbox, const JBoolean openMailboxWindow ) { // begin JXLayout JXWindow* window = new JXWindow(this, 360,550, ""); assert( window != NULL ); itsMaxReplyInput = new JXIntegerInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 270,335, 40,20); assert( itsMaxReplyInput != NULL ); itsSenderStringInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 100,385, 240,20); assert( itsSenderStringInput != NULL ); itsSpacesPerTabInput = new JXIntegerInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 140,80, 40,20); assert( itsSpacesPerTabInput != NULL ); JXTextButton* okButton = new JXTextButton(JGetString("okButton::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 260,515, 70,20); assert( okButton != NULL ); okButton->SetShortcuts(JGetString("okButton::GMailPrefsDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,515, 70,20); assert( cancelButton != NULL ); cancelButton->SetShortcuts(JGetString("cancelButton::GMailPrefsDialog::shortcuts::JXLayout")); itsShowStateInTitle = new JXTextCheckbox(JGetString("itsShowStateInTitle::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,310, 250,20); assert( itsShowStateInTitle != NULL ); itsAutoQuote = new JXTextCheckbox(JGetString("itsAutoQuote::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,335, 250,20); assert( itsAutoQuote != NULL ); itsShowSenderString = new JXTextCheckbox(JGetString("itsShowSenderString::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,360, 250,20); assert( itsShowSenderString != NULL ); itsSenderText = new JXStaticText(JGetString("itsSenderText::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 50,385, 50,20); assert( itsSenderText != NULL ); itsSenderText->SetToLabel(); itsHelpButton = new JXTextButton(JGetString("itsHelpButton::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 145,515, 70,20); assert( itsHelpButton != NULL ); itsFontMenu = new JXChooseMonoFont(window, JXWidget::kHElastic, JXWidget::kVElastic, 20,10, 310,60); assert( itsFontMenu != NULL ); JXStaticText* obj1_JXLayout = new JXStaticText(JGetString("obj1_JXLayout::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 315,335, 30,20); assert( obj1_JXLayout != NULL ); obj1_JXLayout->SetToLabel(); itsReportSCErrorsCB = new JXTextCheckbox(JGetString("itsReportSCErrorsCB::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,420, 250,20); assert( itsReportSCErrorsCB != NULL ); JXStaticText* obj2_JXLayout = new JXStaticText(JGetString("obj2_JXLayout::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 40,80, 100,20); assert( obj2_JXLayout != NULL ); obj2_JXLayout->SetToLabel(); itsBeepOnNewMailCB = new JXTextCheckbox(JGetString("itsBeepOnNewMailCB::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,285, 250,20); assert( itsBeepOnNewMailCB != NULL ); itsEncryptionType = new JXRadioGroup(window, JXWidget::kHElastic, JXWidget::kVElastic, 45,175, 145,70); assert( itsEncryptionType != NULL ); JXTextRadioButton* obj3_JXLayout = new JXTextRadioButton(1, JGetString("obj3_JXLayout::GMailPrefsDialog::JXLayout"), itsEncryptionType, JXWidget::kHElastic, JXWidget::kVElastic, 20,15, 100,20); assert( obj3_JXLayout != NULL ); JXTextRadioButton* obj4_JXLayout = new JXTextRadioButton(2, JGetString("obj4_JXLayout::GMailPrefsDialog::JXLayout"), itsEncryptionType, JXWidget::kHElastic, JXWidget::kVElastic, 20,35, 100,20); assert( obj4_JXLayout != NULL ); JXStaticText* obj5_JXLayout = new JXStaticText(JGetString("obj5_JXLayout::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 55,168, 120,20); assert( obj5_JXLayout != NULL ); obj5_JXLayout->SetToLabel(); JXStaticText* obj6_JXLayout = new JXStaticText(JGetString("obj6_JXLayout::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,480, 90,20); assert( obj6_JXLayout != NULL ); obj6_JXLayout->SetToLabel(); itsFilterButton = new JXTextButton(JGetString("itsFilterButton::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 290,480, 60,20); assert( itsFilterButton != NULL ); itsDefaultInbox = new JXFileInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 110,450, 180,20); assert( itsDefaultInbox != NULL ); itsInboxButton = new JXTextButton(JGetString("itsInboxButton::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kFixedTop, 290,450, 60,20); assert( itsInboxButton != NULL ); JXStaticText* obj7_JXLayout = new JXStaticText(JGetString("obj7_JXLayout::GMailPrefsDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 20,450, 90,20); assert( obj7_JXLayout != NULL ); obj7_JXLayout->SetToLabel(); itsFilterFileInput = new JXFileInput(window, JXWidget::kHElastic, JXWidget::kVElastic, 110,480, 180,20); assert( itsFilterFileInput != NULL ); itsCopySelectedCB = new JXTextCheckbox(JGetString("itsCopySelectedCB::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,110, 270,20); assert( itsCopySelectedCB != NULL ); itsHomeEndCB = new JXTextCheckbox(JGetString("itsHomeEndCB::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,135, 270,20); assert( itsHomeEndCB != NULL ); itsOpenMailTreeCB = new JXTextCheckbox(JGetString("itsOpenMailTreeCB::GMailPrefsDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 20,260, 250,20); assert( itsOpenMailTreeCB != NULL ); // end JXLayout window->SetTitle("Mail Preferences"); SetButtons(okButton, cancelButton); ListenTo(itsShowSenderString); ListenTo(itsHelpButton); ListenTo(itsAutoQuote); itsShowStateInTitle->SetState(showstate); itsAutoQuote->SetState(autoQuote); itsSenderStringInput->SetText(senderString); itsShowSenderString->SetState(showSender); itsFontMenu->SetFont(fontname, fontsize); itsMaxReplyInput->SetValue(maxQuotedReply); itsSpacesPerTabInput->SetValue(spacesPerTab); itsReportSCErrorsCB->SetState(reportSCErrors); itsBeepOnNewMailCB->SetState(beepOnNewMail); itsOpenMailTreeCB->SetState(openMailboxWindow); AdjustForSenderString(showSender); AdjustForQuotedReply(autoQuote); itsEncryptionType->SelectItem(encType); JString home; if (JGetHomeDirectory(&home)) { JAppendDirSeparator(&home); itsDefaultInbox->SetBasePath(home); itsFilterFileInput->SetBasePath(home); } itsDefaultInbox->SetText(defInbox); itsDefaultInbox->ShouldAllowInvalidFile(); ListenTo(itsInboxButton); itsFilterFileInput->SetText(filterFile); itsFilterFileInput->ShouldAllowInvalidFile(); ListenTo(itsFilterButton); itsCopySelectedCB->SetState(JTextEditor::WillCopyWhenSelect()); itsHomeEndCB->SetState(JXTEBase::WillUseWindowsHomeEnd()); }
void JXSaveFileDialog::BuildWindow ( const JCharacter* origName, const JCharacter* prompt, const JCharacter* message ) { // begin JXLayout JXWindow* window = new JXWindow(this, 310,340, ""); assert( window != NULL ); JXScrollbarSet* scrollbarSet = new JXScrollbarSet(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,140, 180,140); assert( scrollbarSet != NULL ); JXTextButton* saveButton = new JXTextButton(JGetString("saveButton::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,280, 70,20); assert( saveButton != NULL ); saveButton->SetShortcuts(JGetString("saveButton::JXSaveFileDialog::shortcuts::JXLayout")); JXTextButton* cancelButton = new JXTextButton(JGetString("cancelButton::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,310, 70,20); assert( cancelButton != NULL ); JXTextButton* homeButton = new JXTextButton(JGetString("homeButton::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 250,140, 40,20); assert( homeButton != NULL ); JXStaticText* pathLabel = new JXStaticText(JGetString("pathLabel::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 20,20, 40,20); assert( pathLabel != NULL ); pathLabel->SetToLabel(); JXSaveFileInput* fileNameInput = new JXSaveFileInput(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,310, 180,20); assert( fileNameInput != NULL ); JXPathInput* pathInput = new JXPathInput(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 60,20, 200,20); assert( pathInput != NULL ); JXTextCheckbox* showHiddenCB = new JXTextCheckbox(JGetString("showHiddenCB::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 60,80, 130,20); assert( showHiddenCB != NULL ); JXStaticText* promptLabel = new JXStaticText(JGetString("promptLabel::JXSaveFileDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,290, 180,20); assert( promptLabel != NULL ); promptLabel->SetToLabel(); JXStaticText* filterLabel = new JXStaticText(JGetString("filterLabel::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedBottom, 20,50, 40,20); assert( filterLabel != NULL ); filterLabel->SetToLabel(); JXInputField* filterInput = new JXInputField(window, JXWidget::kHElastic, JXWidget::kFixedBottom, 60,50, 200,20); assert( filterInput != NULL ); JXPathHistoryMenu* pathHistory = new JXPathHistoryMenu(1, "", window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 260,20, 30,20); assert( pathHistory != NULL ); JXStringHistoryMenu* filterHistory = new JXStringHistoryMenu(1, "", window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 260,50, 30,20); assert( filterHistory != NULL ); JXTextButton* upButton = new JXTextButton(JGetString("upButton::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,140, 30,20); assert( upButton != NULL ); JXNewDirButton* newDirButton = new JXNewDirButton(window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,190, 70,20); assert( newDirButton != NULL ); JXCurrentPathMenu* currPathMenu = new JXCurrentPathMenu("/", window, JXWidget::kHElastic, JXWidget::kFixedBottom, 20,110, 180,20); assert( currPathMenu != NULL ); JXTextButton* desktopButton = new JXTextButton(JGetString("desktopButton::JXSaveFileDialog::JXLayout"), window, JXWidget::kFixedRight, JXWidget::kFixedBottom, 220,160, 70,20); assert( desktopButton != NULL ); // end JXLayout SetObjects(scrollbarSet, promptLabel, prompt, fileNameInput, origName, pathLabel, pathInput, pathHistory, filterLabel, filterInput, filterHistory, saveButton, cancelButton, upButton, homeButton, desktopButton, newDirButton, showHiddenCB, currPathMenu, message); }
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 } }
JBoolean JTextUserNotification::AcceptLicense() { return AskUserNo(JGetString("LICENSE")); }