void CBExtEditorDialog::BuildWindow ( const JBoolean editTextLocally, const JCharacter* editTextFileCmd, const JCharacter* editTextFileLineCmd, const JBoolean editBinaryLocally, const JCharacter* editBinaryFileCmd ) { // begin JXLayout JXWindow* window = jnew JXWindow(this, 450,220, ""); assert( window != NULL ); itsEditTextFileCmdInput = jnew JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 200,40, 230,20); assert( itsEditTextFileCmdInput != NULL ); itsEditTextFileLineCmdInput = jnew JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 200,60, 230,20); assert( itsEditTextFileLineCmdInput != NULL ); JXTextButton* cancelButton = jnew JXTextButton(JGetString("cancelButton::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 100,190, 70,20); assert( cancelButton != NULL ); JXTextButton* okButton = jnew 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* editTextHint = jnew JXStaticText(JGetString("editTextHint::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 160,80, 270,20); assert( editTextHint != NULL ); editTextHint->SetFontSize(JGetDefaultFontSize()-2); editTextHint->SetToLabel(); JXStaticText* editTextLabel = jnew JXStaticText(JGetString("editTextLabel::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,40, 170,20); assert( editTextLabel != NULL ); editTextLabel->SetToLabel(); JXStaticText* editLineLabel = jnew JXStaticText(JGetString("editLineLabel::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,60, 170,20); assert( editLineLabel != NULL ); editLineLabel->SetToLabel(); itsExtTextEditorCB = jnew JXTextCheckbox(JGetString("itsExtTextEditorCB::CBExtEditorDialog::JXLayout"), window, JXWidget::kFixedLeft, JXWidget::kFixedTop, 10,20, 160,20); assert( itsExtTextEditorCB != NULL ); itsEditBinaryFileCmdInput = jnew JXInputField(window, JXWidget::kHElastic, JXWidget::kVElastic, 200,130, 230,20); assert( itsEditBinaryFileCmdInput != NULL ); JXStaticText* editBinaryHint = jnew JXStaticText(JGetString("editBinaryHint::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 200,150, 230,20); assert( editBinaryHint != NULL ); editBinaryHint->SetFontSize(JGetDefaultFontSize()-2); editBinaryHint->SetToLabel(); JXStaticText* editBinaryLabel = jnew JXStaticText(JGetString("editBinaryLabel::CBExtEditorDialog::JXLayout"), window, JXWidget::kHElastic, JXWidget::kVElastic, 30,130, 170,20); assert( editBinaryLabel != NULL ); editBinaryLabel->SetToLabel(); itsExtBinaryEditorCB = jnew 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 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(); }