//------------------------------------------------------------------------------
void PreferencesDialog::textEditorEscapeKeyPressed(TextEditor &editor)
{
	if(editor.getName() == "oscPortEditor")
		editor.setText(currentPort, false);
	else if(editor.getName() == "oscMulticastEditor")
		editor.setText(currentMulticast, false);
}
Example #2
0
    //TODOODOT : implement correct version
    void updateFromTransactionsQueryForRow(QueryEntry *qe, Array<int> numTransactions, int row, bool dView, bool edit)
    {
        setDetailedView(dView);
        setEdit(edit);
        resized();
        this->row = row;
        if(qe) {
            // summary
			const int numFields = 3;
            for (int i=0; i<getNumChildComponents(); i++) {
                TextEditor *te = dynamic_cast<TextEditor*>(getChildComponent(i));
				if (te && te->getName().startsWith("#")) {
					const int ord = te->getName().substring(1).getIntValue();
					const int row = ord/numFields;
					const int field = ord%numFields;

					if (row < numTransactions.size()) {
						te->setText(qe->getFieldFromRow(row, field));
						te->setEnabled(edit);
						te->setVisible(true);
					}
					else {
						te->setVisible(false);
					}
				}
            }
        }
    }
Example #3
0
 //TODO : implement correct version
 void updateFromTransactionsMapForRow(QueryEntry *qe, std::map<String, String> rowUpdates, int row, bool dView, bool edit)
 {
     setDetailedView(dView);
     resized();
     this->row = row;
     
     for (int i=0; i<getNumChildComponents(); i++) {
         TextEditor *te = dynamic_cast<TextEditor*>(getChildComponent(i));
         if (te) {
             const StringArray key = (qe != nullptr) ? qe->getFieldFromRow(row, owner.getKeyField()) : StringArray();
             if (key.size() && (rowUpdates.find(te->getName()) != rowUpdates.end())) {
                 te->setText(rowUpdates[te->getName()]);
             }
             else {
                 te->setText(qe->getFieldFromRow(row, owner.fieldNames.indexOf(te->getName())));
             }
             te->setEnabled(edit);
         }
     }
 }
Example #4
0
    void changeListenerCallback (ChangeBroadcaster* source) override
    {
        if (source == &testsListModel)
        {
            const int index = testsListBox.getSelectedRow();

            renderComponent.currentTest = createTest (index);
            instructions.setText (getInstructions (index));

            repaint();
        }
    }
//==============================================================================
void AlertWindow::addTextEditor (const String& name,
                                 const String& initialContents,
                                 const String& onScreenLabel,
                                 const bool isPasswordBox)
{
    TextEditor* ed = new TextEditor (name, isPasswordBox ? getDefaultPasswordChar() : 0);
    ed->setSelectAllWhenFocused (true);
    ed->setEscapeAndReturnKeysConsumed (false);
    textBoxes.add (ed);
    allComps.add (ed);

    ed->setColour (TextEditor::outlineColourId, findColour (ComboBox::outlineColourId));
    ed->setFont (getLookAndFeel().getAlertWindowMessageFont());
    ed->setText (initialContents);
    ed->setCaretPosition (initialContents.length());
    addAndMakeVisible (ed);
    textboxNames.add (onScreenLabel);

    updateLayout (false);
}
void MiosTerminal::textEditorEscapeKeyPressed(TextEditor &editor)
{
    editor.setText(String::empty);
}
Example #7
0
    //==============================================================================
    FontsAndTextDemo()
    {
        setName (T("Fonts"));

        Font::findFonts (fonts);

        addAndMakeVisible (listBox = new ListBox (T("fonts"), this));
        listBox->setRowHeight (28);

        addAndMakeVisible (textBox = new TextEditor());

        textBox->setColour (TextEditor::backgroundColourId, Colours::white);
        textBox->setColour (TextEditor::outlineColourId, Colours::black.withAlpha (0.5f));

        textBox->setMultiLine (true, true);
        textBox->setReturnKeyStartsNewLine (true);
        textBox->setText (T("The Quick Brown Fox Jumps Over The Lazy Dog\n\nAa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789"));

        addAndMakeVisible (boldButton = new ToggleButton (T("bold")));
        boldButton->addButtonListener (this);

        addAndMakeVisible (italicButton = new ToggleButton (T("italic")));
        italicButton->addButtonListener (this);

        addAndMakeVisible (sizeSlider = new Slider ("Size"));
        sizeSlider->setRange (3.0, 150.0, 0.1);
        sizeSlider->setValue (20.0);
        sizeSlider->addListener (this);
        (new Label (String::empty, sizeSlider->getName()))->attachToComponent (sizeSlider, true);

        addAndMakeVisible (kerningSlider = new Slider ("Kerning"));
        kerningSlider->setRange (-1.0, 1.0, 0.01);
        kerningSlider->setValue (0.0);
        kerningSlider->addListener (this);
        (new Label (String::empty, kerningSlider->getName()))->attachToComponent (kerningSlider, true);

        addAndMakeVisible (horizontalScaleSlider = new Slider ("Stretch"));
        horizontalScaleSlider->setRange (0.1, 4.0, 0.01);
        horizontalScaleSlider->setValue (1.0);
        horizontalScaleSlider->addListener (this);
        (new Label (String::empty, horizontalScaleSlider->getName()))->attachToComponent (horizontalScaleSlider, true);

        for (int i = 0; i < fonts.size(); ++i)
        {
            if (fonts[i]->getTypefaceName().startsWithIgnoreCase (T("Arial")))
            {
                listBox->selectRow (i);
                break;
            }
        }

        listBox->setColour (ListBox::outlineColourId, Colours::black.withAlpha (0.5f));
        listBox->setOutlineThickness (1);

        // set up the layout and resizer bars..

        verticalLayout.setItemLayout (0, -0.2, -0.8, -0.5);  // width of the font list must be
        // between 20% and 80%, preferably 50%
        verticalLayout.setItemLayout (1, 8, 8, 8);           // the vertical divider drag-bar thing is always 8 pixels wide
        verticalLayout.setItemLayout (2, 150, -1.0, -0.5);   // the components on the right must be
        // at least 150 pixels wide, preferably 50% of the total width

        verticalDividerBar = new StretchableLayoutResizerBar (&verticalLayout, 1, true);
        addAndMakeVisible (verticalDividerBar);

        horizontalLayout.setItemLayout (0, -0.2, -1.0, -0.4);  // height of the font text box must be
        // between 20% and 100%, preferably 40%
        horizontalLayout.setItemLayout (1, 8, 8, 8);           // the horizontal divider drag-bar thing is always 8 pixels high
        horizontalLayout.setItemLayout (2, 2, 5, 5);           // a gap between the controls
        horizontalLayout.setItemLayout (3, 15, 20, 20);        // the italic button would like to be 20 pixels high
        horizontalLayout.setItemLayout (4, 2, 5, 5);           // a gap between the controls
        horizontalLayout.setItemLayout (5, 15, 20, 20);        // the bold button would like to be 20 pixels high
        horizontalLayout.setItemLayout (6, 2, 5, 5);           // a gap between the controls
        horizontalLayout.setItemLayout (7, 15, 20, 20);        // the italic button would like to be 20 pixels high
        horizontalLayout.setItemLayout (8, 2, 5, 5);           // a gap between the controls
        horizontalLayout.setItemLayout (9, 15, 20, 20);        // the copy code button would like to be 20 pixels high
        horizontalLayout.setItemLayout (10, 5, -1.0, 5);        // add a gap at the bottom that will fill up any
        // space left over - this will stop the
        // sliders from always sticking to the
        // bottom of the window
    }