
Список використаних джерел
«Open Source» — электронное приложение к журналу «Системный администратор» [http://osa.samag.ru/]
Степанов Е.О., к.ф.-м.н. Ярцев Б.М. - Учебно-методическое пособие по дисциплине «Архитектуры и технологии разработки распределенного программного обеспечения»
Пол Эбрахамс, Майкл Болл и др. - Язык программирования C++. Вводный курс
Інтернет університет інформаційних технологій [http://www.intuit.ru/]
Універсальна інтернет-енциклопедія [ru.wikipedia.org]
Додаток 1. Текст програми
TApplication.cpp
#include "TApplication.h"
#include "TMainForm.h"
//---------------------------------------------------------------------
#define tr(s) String::fromUTF8(s)
//---------------------------------------------------------------------
TApplication::TApplication() : pMainWindow(0)
{
}
//---------------------------------------------------------------------
TApplication::~TApplication()
{
}
//---------------------------------------------------------------------
void TApplication::initialise(const String& sCommandLine)
{
pMainWindow = new TMainForm();
}
//---------------------------------------------------------------------
void TApplication::shutdown()
{
if(pMainWindow != 0) delete pMainWindow;
}
//---------------------------------------------------------------------
void TApplication::systemRequestedQuit()
{
quit();
}
//---------------------------------------------------------------------
const String TApplication::getApplicationName()
{
return tr("Gallery");
}
//---------------------------------------------------------------------
const String TApplication::getApplicationVersion()
{
return ProjectInfo::versionString;
}
//---------------------------------------------------------------------
bool TApplication::moreThanOneInstanceAllowed()
{
return false;
}
//---------------------------------------------------------------------
TCentralComponent.cpp
#include "TCentralComponent.h"
//[MiscUserDefs] You can add your own user definitions and misc code here...
#define tr(s) String::fromUTF8(s)
//[/MiscUserDefs]
//==============================================================================
TCentralComponent::TCentralComponent ()
: label (0),
addb1 (0),
b1 (0),
label2 (0),
ten1 (0),
te1 (0),
label3 (0),
tek1 (0),
label4 (0),
label6 (0),
b2 (0),
b3 (0),
b4 (0),
te2 (0),
te3 (0),
te4 (0),
ten2 (0),
ten3 (0),
ten4 (0),
tek2 (0),
tek3 (0),
tek4 (0),
addb2 (0),
addb3 (0),
addb4 (0)
{
addAndMakeVisible (label = new Label (L"new label",
L"\x41a\x430\x440\x442\x438\x43d\x43d\x430\x44f \x433\x430\x43b\x435\x440\x435\x44f"));
label->setFont (Font (47.7000f, Font::plain));
label->setJustificationType (Justification::centredLeft);
label->setEditable (false, false, false);
label->setColour (Label::textColourId, Colour (0xffa47e7e));
label->setColour (TextEditor::textColourId, Colours::black);
label->setColour (TextEditor::backgroundColourId, Colour (0x0));
addAndMakeVisible (addb1 = new TextButton (L"new button"));
addb1->setButtonText (L"\x414\x43e\x431\x430\x432\x438\x442\x44c \x43a\x43e\x43c\x43c\x435\x43d\x442\x430\x440\x438\x439");
addb1->addListener (this);
addAndMakeVisible (b1 = new ImageButton (L"new button"));
b1->addListener (this);
b1->setImages (false, true, true,
ImageCache::getFromMemory (_1_jpg, _1_jpgSize), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0));
addAndMakeVisible (label2 = new Label (L"new label",
L"\x414\x43e\x431\x430\x432\x44c\x442\x435 \x43e\x442\x437\x44b\x432"));
label2->setFont (Font (15.0000f, Font::plain));
label2->setJustificationType (Justification::centredLeft);
label2->setEditable (false, false, false);
label2->setColour (TextEditor::textColourId, Colours::black);
label2->setColour (TextEditor::backgroundColourId, Colour (0x0));
addAndMakeVisible (ten1 = new TextEditor (L"new text editor"));
ten1->setMultiLine (false);
ten1->setReturnKeyStartsNewLine (false);
ten1->setReadOnly (false);
ten1->setScrollbarsShown (true);
ten1->setCaretVisible (true);
ten1->setPopupMenuEnabled (true);
ten1->setText (String::empty);
addAndMakeVisible (te1 = new TextEditor (L"new text editor"));
te1->setMultiLine (true);
te1->setReturnKeyStartsNewLine (true);
te1->setReadOnly (true);
te1->setScrollbarsShown (true);
te1->setCaretVisible (true);
te1->setPopupMenuEnabled (true);
te1->setColour (TextEditor::backgroundColourId, Colour (0xffd6d6d6));
te1->setText (String::empty);
addAndMakeVisible (label3 = new Label (L"new label",
L"\x41a\x43e\x43c\x43c\x435\x43d\x442\x430\x440\x438\x438"));
label3->setFont (Font (15.0000f, Font::plain));
label3->setJustificationType (Justification::centredLeft);
label3->setEditable (false, false, false);
label3->setColour (TextEditor::textColourId, Colours::black);
label3->setColour (TextEditor::backgroundColourId, Colour (0x0));
addAndMakeVisible (tek1 = new TextEditor (L"new text editor"));
tek1->setMultiLine (true);
tek1->setReturnKeyStartsNewLine (true);
tek1->setReadOnly (false);
tek1->setScrollbarsShown (true);
tek1->setCaretVisible (true);
tek1->setPopupMenuEnabled (true);
tek1->setText (String::empty);
addAndMakeVisible (label4 = new Label (L"new label",
L"\x412\x430\x448\x435 \x438\x43c\x44f"));
label4->setFont (Font (15.0000f, Font::plain));
label4->setJustificationType (Justification::centredLeft);
label4->setEditable (false, false, false);
label4->setColour (TextEditor::textColourId, Colours::black);
label4->setColour (TextEditor::backgroundColourId, Colour (0x0));
addAndMakeVisible (label6 = new Label (L"new label",
L"\x41e\x442\x437\x44b\x432"));
label6->setFont (Font (15.0000f, Font::plain));
label6->setJustificationType (Justification::centredLeft);
label6->setEditable (false, false, false);
label6->setColour (TextEditor::textColourId, Colours::black);
label6->setColour (TextEditor::backgroundColourId, Colour (0x0));
addAndMakeVisible (b2 = new ImageButton (L"new button"));
b2->addListener (this);
b2->setImages (false, true, true,
ImageCache::getFromMemory (_2_jpg, _2_jpgSize), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0));
addAndMakeVisible (b3 = new ImageButton (L"new button"));
b2->setVisible(false);
b3->addListener (this);
b3->setImages (false, true, true,
ImageCache::getFromMemory (_3_jpg, _3_jpgSize), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0));
addAndMakeVisible (b4 = new ImageButton (L"new button"));
b3->setVisible(false);
b4->addListener (this);
b4->setImages (false, true, true,
ImageCache::getFromMemory (_4_jpg, _4_jpgSize), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0),
Image(), 1.0000f, Colour (0x0));
b4->setVisible(false);
addAndMakeVisible (te2 = new TextEditor (L"new text editor"));
te2->setMultiLine (true);
te2->setReturnKeyStartsNewLine (true);
te2->setReadOnly (true);
te2->setScrollbarsShown (true);
te2->setCaretVisible (false);
te2->setPopupMenuEnabled (true);
te2->setColour (TextEditor::backgroundColourId, Colour (0xffd6d6d6));
te2->setText (String::empty);
te2->setVisible(false);
addAndMakeVisible (te3 = new TextEditor (L"new text editor"));
te3->setMultiLine (true);
te3->setReturnKeyStartsNewLine (true);
te3->setReadOnly (true);
te3->setScrollbarsShown (true);
te3->setCaretVisible (false);
te3->setPopupMenuEnabled (true);
te3->setColour (TextEditor::backgroundColourId, Colour (0xffd6d6d6));
te3->setText (String::empty);
te3->setVisible(false);
addAndMakeVisible (te4 = new TextEditor (L"new text editor"));
te4->setMultiLine (true);
te4->setReturnKeyStartsNewLine (true);
te4->setReadOnly (true);
te4->setScrollbarsShown (true);
te4->setCaretVisible (false);
te4->setPopupMenuEnabled (true);
te4->setColour (TextEditor::backgroundColourId, Colour (0xffd6d6d6));
te4->setText (String::empty);
te4->setVisible(false);
addAndMakeVisible (ten2 = new TextEditor (L"new text editor"));
ten2->setMultiLine (false);
ten2->setReturnKeyStartsNewLine (false);
ten2->setReadOnly (false);
ten2->setScrollbarsShown (true);
ten2->setCaretVisible (true);
ten2->setPopupMenuEnabled (true);
ten2->setText (String::empty);
ten2->setVisible(false);
addAndMakeVisible (ten3 = new TextEditor (L"new text editor"));
ten3->setMultiLine (false);
ten3->setReturnKeyStartsNewLine (false);
ten3->setReadOnly (false);
ten3->setScrollbarsShown (true);
ten3->setCaretVisible (true);
ten3->setPopupMenuEnabled (true);
ten3->setText (String::empty);
ten3->setVisible(false);
addAndMakeVisible (ten4 = new TextEditor (L"new text editor"));
ten4->setMultiLine (false);
ten4->setReturnKeyStartsNewLine (false);
ten4->setReadOnly (false);
ten4->setScrollbarsShown (true);
ten4->setCaretVisible (true);
ten4->setPopupMenuEnabled (true);
ten4->setText (String::empty);
ten4->setVisible(false);
addAndMakeVisible (tek2 = new TextEditor (L"new text editor"));
tek2->setMultiLine (true);
tek2->setReturnKeyStartsNewLine (true);
tek2->setReadOnly (false);
tek2->setScrollbarsShown (true);
tek2->setCaretVisible (true);
tek2->setPopupMenuEnabled (true);
tek2->setText (String::empty);
tek2->setVisible(false);
addAndMakeVisible (tek3 = new TextEditor (L"new text editor"));
tek3->setMultiLine (true);
tek3->setReturnKeyStartsNewLine (true);
tek3->setReadOnly (false);
tek3->setScrollbarsShown (true);
tek3->setCaretVisible (true);
tek3->setPopupMenuEnabled (true);
tek3->setText (String::empty);
tek3->setVisible(false);
addAndMakeVisible (tek4 = new TextEditor (L"new text editor"));
tek4->setMultiLine (true);
tek4->setReturnKeyStartsNewLine (true);
tek4->setReadOnly (false);
tek4->setScrollbarsShown (true);
tek4->setCaretVisible (true);
tek4->setPopupMenuEnabled (true);
tek4->setText (String::empty);
tek4->setVisible(false);
addAndMakeVisible (addb2 = new TextButton (L"new button"));
addb2->setButtonText (L"\x414\x43e\x431\x430\x432\x438\x442\x44c \x43a\x43e\x43c\x43c\x435\x43d\x442\x430\x440\x438\x439");
addb2->addListener (this);
addb2->setVisible(false);
addAndMakeVisible (addb3 = new TextButton (L"new button"));
addb3->setButtonText (L"\x414\x43e\x431\x430\x432\x438\x442\x44c \x43a\x43e\x43c\x43c\x435\x43d\x442\x430\x440\x438\x439");
addb3->addListener (this);
addb3->setVisible(false);
addAndMakeVisible (addb4 = new TextButton (L"new button"));
addb4->setButtonText (L"\x414\x43e\x431\x430\x432\x438\x442\x44c \x43a\x43e\x43c\x43c\x435\x43d\x442\x430\x440\x438\x439");
addb4->addListener (this);
addb4->setVisible(false);
//[UserPreSize]
//[/UserPreSize]
setSize (500, 650);
//[Constructor] You can add your own custom stuff here..
//[/Constructor]
}
TCentralComponent::~TCentralComponent()
{
//[Destructor_pre]. You can add your own custom destruction code here..
//[/Destructor_pre]
deleteAndZero (label);
deleteAndZero (addb1);
deleteAndZero (b1);
deleteAndZero (label2);
deleteAndZero (ten1);
deleteAndZero (te1);
deleteAndZero (label3);
deleteAndZero (tek1);
deleteAndZero (label4);
deleteAndZero (label6);
deleteAndZero (b2);
deleteAndZero (b3);
deleteAndZero (b4);
deleteAndZero (te2);
deleteAndZero (te3);
deleteAndZero (te4);
deleteAndZero (ten2);
deleteAndZero (ten3);
deleteAndZero (ten4);
deleteAndZero (tek2);
deleteAndZero (tek3);
deleteAndZero (tek4);
deleteAndZero (addb2);
deleteAndZero (addb3);
deleteAndZero (addb4);
//[Destructor]. You can add your own custom destruction code here..
//[/Destructor]
}
//==============================================================================
void TCentralComponent::paint (Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
//[/UserPrePaint]
g.fillAll (Colour (0xffd6d6d6));
//[UserPaint] Add your own custom painting code here..
//[/UserPaint]
}
void TCentralComponent::resized()
{
label->setBounds (96, 16, 326, 40);
addb1->setBounds (168, 600, 128, 32);
b1->setBounds (40, 72, 432, 280);
label2->setBounds (200, 472, 150, 24);
ten1->setBounds (96, 504, 328, 24);
te1->setBounds (80, 392, 360, 72);
label3->setBounds (208, 368, 104, 24);
tek1->setBounds (96, 536, 328, 56);
label4->setBounds (16, 504, 80, 24);
label6->setBounds (40, 536, 56, 24);
b2->setBounds (16, 72, 488, 280);
b3->setBounds (48, 72, 424, 281);
b4->setBounds (64, 71, 392, 281);
te2->setBounds (80, 392, 360, 72);
te3->setBounds (80, 392, 360, 72);
te4->setBounds (80, 392, 360, 72);
ten2->setBounds (96, 504, 328, 24);
ten3->setBounds (96, 504, 328, 24);
ten4->setBounds (96, 504, 328, 24);
tek2->setBounds (96, 536, 328, 56);
tek3->setBounds (96, 536, 328, 56);
tek4->setBounds (96, 536, 328, 56);
addb2->setBounds (168, 600, 128, 32);
addb3->setBounds (168, 600, 128, 32);
addb4->setBounds (168, 600, 128, 32);
//[UserResized] Add your own custom resize handling here..
//[/UserResized]
}
void TCentralComponent::buttonClicked (Button* buttonThatWasClicked)
{
if (buttonThatWasClicked == addb1)
{
String str;
str = "\n By ";
str = str + ten1->getText();
str = str + ": ";
str = str + tek1->getText();
te1->insertTextAtCaret(str);
ten1->clear();
tek1->clear();
}
else if (buttonThatWasClicked == b1)
{
addb1->setVisible(false);
addb2->setVisible(true);
tek1->setVisible(false);
tek2->setVisible(true);
ten1->setVisible(false);
ten2->setVisible(true);
te1->setVisible(false);
te2->setVisible(true);
b1->setVisible(false);
b2->setVisible(true);
}
else if (buttonThatWasClicked == b2)
{
addb2->setVisible(false);
addb3->setVisible(true);
tek2->setVisible(false);
tek3->setVisible(true);
ten2->setVisible(false);
ten3->setVisible(true);
te2->setVisible(false);
te3->setVisible(true);
b2->setVisible(false);
b3->setVisible(true);
}
else if (buttonThatWasClicked == b3)
{
addb3->setVisible(false);
addb4->setVisible(true);
tek3->setVisible(false);
tek4->setVisible(true);
ten3->setVisible(false);
ten4->setVisible(true);
te3->setVisible(false);
te4->setVisible(true);
b3->setVisible(false);
b4->setVisible(true);
}
else if (buttonThatWasClicked == b4)
{
addb4->setVisible(false);
addb1->setVisible(true);
tek4->setVisible(false);
tek1->setVisible(true);
ten4->setVisible(false);
ten1->setVisible(true);
te4->setVisible(false);
te1->setVisible(true);
b4->setVisible(false);
b1->setVisible(true);
}
else if (buttonThatWasClicked == addb2)
{
String str;
str = "\n By ";
str = str + ten2->getText();
str = str + ": ";
str = str + tek2->getText();
te2->insertTextAtCaret(str);
ten2->clear();
tek2->clear();
}
else if (buttonThatWasClicked == addb3)
{
String str;
str = "\n By ";
str = str + ten3->getText();
str = str + ": ";
str = str + tek3->getText();
te3->insertTextAtCaret(str);
ten3->clear();
tek3->clear();
}
else if (buttonThatWasClicked == addb4)
{
String str;
str = "\n By ";
str = str + ten4->getText();
str = str + ": ";
str = str + tek4->getText();
te4->insertTextAtCaret(str);
ten4->clear();
tek4->clear();
}
//[UserbuttonClicked_Post]
//[/UserbuttonClicked_Post]
}
…
TThirdForm.cpp
#include "TMainForm.h"
#include "TCentralComponent.h"
//---------------------------------------------------------------------
TMainForm::TMainForm() : DocumentWindow(
JUCEApplication::getInstance()->getApplicationName(),
Colours::azure,
DocumentWindow::maximiseButton)
{
centreWithSize(450, 550);
setResizable(false, false);
setVisible(true);
setTitleBarButtonsRequired(7, false);
pCentralComponent = new TCentralComponent();
setContentOwned(pCentralComponent, true);
}
//---------------------------------------------------------------------
TMainForm::~TMainForm()
{
}
//---------------------------------------------------------------------
void TMainForm::closeButtonPressed()
{
JUCEApplication::getInstance()->systemRequestedQuit();
}
//---------------------------------------------------------------------