Разработка текстового редактора для русскоязычного интерпретатора языка программирования
Аналоги текстовых редакторов с русскоязычным интерфейсом. Разработка и тестирование программного продукта, позволяющего работать с текстом и файлами в редакторе на языке программирования, основанным на русском языке. Алгоритм функционала программы.
Рубрика | Программирование, компьютеры и кибернетика |
Вид | дипломная работа |
Язык | русский |
Дата добавления | 21.07.2013 |
Размер файла | 2,8 M |
Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже
Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.
Unit1.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <inifiles.hpp>
#include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
#include "Unit4.h"
#include "Unit5.h"
#include "Unit6.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SynEdit"
#pragma link "SynEditHighlighter"
#pragma link "SynHighlighterPas"
#pragma link "SynEditPrint"
#pragma link "SynEditMiscClasses"
#pragma link "SynEditSearch"
#pragma resource "*.dfm"
TForm1 *Form1;
bool TForm1::isIniFile()
{
return (FileExists(ExtractFileDir(Application->ExeName) + "\\settings.ini"));
}
//---------------------------------------------------------------------------
void TForm1::createFile()
{
MemoNewIni->Lines->SaveToFile("settings.ini");
}
TColor TForm1::getColor(int nr)
{
TColor color;
switch(nr)
{
case 0 : return clNone;
case 1 : return clBlack;
case 2 : return clMaroon;
case 3 : return clGreen;
case 4 : return clOlive;
case 5 : return clNavy;
case 6 : return clPurple;
case 7 : return clTeal;
case 8 : return clGray;
case 9 : return clSilver;
case 10: return clRed;
case 11: return clLime;
case 12: return clYellow;
case 13: return clBlue;
case 14: return clFuchsia;
case 15: return clAqua;
case 16: return clWhite;
case 17: return clMoneyGreen;
case 18: return clSkyBlue;
case 19: return clCream;
case 20: return clMedGray;
default: return clNone;
};
}
//---------------------------------------------------------------------------
int TForm1::getNumber(TColor col)
{
if(col == clNone) return 0;
if(col == clBlack) return 1;
if(col == clMaroon) return 2;
if(col == clGreen) return 3;
if(col == clOlive) return 4;
if(col == clNavy) return 5;
if(col == clPurple) return 6;
if(col == clTeal) return 7;
if(col == clGray) return 8;
if(col == clSilver) return 9;
if(col == clRed) return 10;
if(col == clLime) return 11;
if(col == clYellow) return 12;
if(col == clBlue) return 13;
if(col == clFuchsia) return 14;
if(col == clAqua) return 15;
if(col == clWhite) return 16;
if(col == clMoneyGreen) return 17;
if(col == clSkyBlue) return 18;
if(col == clCream) return 19;
if(col == clMedGray) return 20;
return 0;
}
//---------------------------------------------------------------------------
void TForm1::readFile()
{
int vInt;
bool vBool;
AnsiString vString;
TIniFile *ini = new TIniFile(ExtractFileDir(Application->ExeName) + "\\settings.ini");
vString = ini->ReadString("Application", "Title", "Текстовый редактор РУСИЧ-Редактор");
title = vString;
vString = ini->ReadString("Application", "Version", "версия 1.1");
title = title + " " + vString;
vBool = ini->ReadBool("Display", "Errors", false);
PanelBlad->Visible = vBool;
ShowErrors1->Checked = vBool;
vBool = ini->ReadBool("Display", "Number", true);
SE->Gutter->Visible = vBool;
ShowLineNumers1->Checked = vBool;
vInt = ini->ReadInteger("Display","CommBack",0);
SynPasSyn->CommentAttri->Background = getColor(vInt);
vInt = ini->ReadInteger("Display","CommFore",5);
SynPasSyn->CommentAttri->Foreground = getColor(vInt);
vBool = ini->ReadBool("Display","CommBold",false);
if(vBool) SynPasSyn->CommentAttri->Style << fsBold;
else SynPasSyn->CommentAttri->Style >> fsBold;
vBool = ini->ReadBool("Display","CommItal",true);
if(vBool) SynPasSyn->CommentAttri->Style << fsItalic;
else SynPasSyn->CommentAttri->Style >> fsItalic;
vBool = ini->ReadBool("Display","CommUnder",false);
if(vBool) SynPasSyn->CommentAttri->Style << fsUnderline;
else SynPasSyn->CommentAttri->Style >> fsUnderline;
vInt = ini->ReadInteger("Display","FloatBack",0);
SynPasSyn->FloatAttri->Background = getColor(vInt);
vInt = ini->ReadInteger("Display","FloatFore",3);
SynPasSyn->FloatAttri->Foreground = getColor(vInt);
vBool = ini->ReadBool("Display","FloatBold",false);
if(vBool) SynPasSyn->FloatAttri->Style << fsBold;
else SynPasSyn->FloatAttri->Style >> fsBold;
vBool = ini->ReadBool("Display","FloatItal",false);
if(vBool) SynPasSyn->FloatAttri->Style << fsItalic;
else SynPasSyn->FloatAttri->Style >> fsItalic;
vBool = ini->ReadBool("Display","FloatUnder",false);
if(vBool) SynPasSyn->FloatAttri->Style << fsUnderline;
else SynPasSyn->FloatAttri->Style >> fsUnderline;
vInt = ini->ReadInteger("Display","NumbBack",0);
SynPasSyn->NumberAttri->Background = getColor(vInt);
vInt = ini->ReadInteger("Display","NumbFore",3);
SynPasSyn->NumberAttri->Foreground = getColor(vInt);
vBool = ini->ReadBool("Display","NumbBold",false);
if(vBool) SynPasSyn->NumberAttri->Style << fsBold;
else SynPasSyn->NumberAttri->Style >> fsBold;
vBool = ini->ReadBool("Display","NumbItal",false);
if(vBool) SynPasSyn->NumberAttri->Style << fsItalic;
else SynPasSyn->NumberAttri->Style >> fsItalic;
vBool = ini->ReadBool("Display","NumbUnder",false);
if(vBool) SynPasSyn->NumberAttri->Style << fsUnderline;
else SynPasSyn->NumberAttri->Style >> fsUnderline;
vInt = ini->ReadInteger("Display","SpaceBack",0);
SynPasSyn->SpaceAttri->Background = getColor(vInt);
vInt = ini->ReadInteger("Display","SpaceFore",0);
SynPasSyn->SpaceAttri->Foreground = getColor(vInt);
vBool = ini->ReadBool("Display","SpaceBold",false);
if(vBool) SynPasSyn->SpaceAttri->Style << fsBold;
else SynPasSyn->SpaceAttri->Style >> fsBold;
vBool = ini->ReadBool("Display","SpaceItal",false);
if(vBool) SynPasSyn->SpaceAttri->Style << fsItalic;
else SynPasSyn->SpaceAttri->Style >> fsItalic;
vBool = ini->ReadBool("Display","SpaceUnder",false);
if(vBool) SynPasSyn->SpaceAttri->Style << fsUnderline;
else SynPasSyn->SpaceAttri->Style >> fsUnderline;
vInt = ini->ReadInteger("Display","StringBack",0);
SynPasSyn->StringAttri->Background = getColor(vInt);
vInt = ini->ReadInteger("Display","StringFore",10);
SynPasSyn->StringAttri->Foreground = getColor(vInt);
vBool = ini->ReadBool("Display","StringBold",false);
if(vBool) SynPasSyn->StringAttri->Style << fsBold;
else SynPasSyn->StringAttri->Style >> fsBold;
vBool = ini->ReadBool("Display","StringItal",false);
if(vBool) SynPasSyn->StringAttri->Style << fsItalic;
else SynPasSyn->StringAttri->Style >> fsItalic;
vBool = ini->ReadBool("Display","StringUnder",false);
if(vBool) SynPasSyn->StringAttri->Style << fsUnderline;
else SynPasSyn->StringAttri->Style >> fsUnderline;
vInt = ini->ReadInteger("Display","SymbolBack",0);
SynPasSyn->SymbolAttri->Background = getColor(vInt);
vInt = ini->ReadInteger("Display","SymbolFore",0);
SynPasSyn->SymbolAttri->Foreground = getColor(vInt);
vBool = ini->ReadBool("Display","SymbolBold",false);
if(vBool) SynPasSyn->SymbolAttri->Style << fsBold;
else SynPasSyn->SymbolAttri->Style >> fsBold;
vBool = ini->ReadBool("Display","SymbolItal",false);
if(vBool) SynPasSyn->SymbolAttri->Style << fsItalic;
else SynPasSyn->SymbolAttri->Style >> fsItalic;
vBool = ini->ReadBool("Display","SymbolUnder",false);
if(vBool) SynPasSyn->SymbolAttri->Style << fsUnderline;
else SynPasSyn->SymbolAttri->Style >> fsUnderline;
delete ini;
}
//---------------------------------------------------------------------------
void TForm1::writeFile()
{
TIniFile *ini = new TIniFile(ExtractFileDir(Application->ExeName) + "\\settings.ini");
ini->WriteString("Application","Title","Текстовый редактор РУСИЧ-Редактор");
ini->WriteString("Application","Version","версия 1.1");
ini->WriteBool("Display","Errors",PanelBlad->Visible);
ini->WriteBool("Display","Number",SE->Gutter->Visible);
ini->WriteInteger("Display","CommBack",getNumber(SynPasSyn->CommentAttri->Background));
ini->WriteInteger("Display","CommFore",getNumber(SynPasSyn->CommentAttri->Foreground));
ini->WriteBool("Display","CommBold",SynPasSyn->CommentAttri->Style.Contains(fsBold));
ini->WriteBool("Display","CommItal",SynPasSyn->CommentAttri->Style.Contains(fsItalic));
ini->WriteBool("Display","CommUnder",SynPasSyn->CommentAttri->Style.Contains(fsUnderline));
ini->WriteInteger("Display","FloatBack",getNumber(SynPasSyn->FloatAttri->Background));
ini->WriteInteger("Display","FloatFore",getNumber(SynPasSyn->FloatAttri->Foreground));
ini->WriteBool("Display","FloatBold",SynPasSyn->FloatAttri->Style.Contains(fsBold));
ini->WriteBool("Display","FloatItal",SynPasSyn->FloatAttri->Style.Contains(fsItalic));
ini->WriteBool("Display","FloatUnder",SynPasSyn->FloatAttri->Style.Contains(fsUnderline));
ini->WriteInteger("Display","NumbBack",getNumber(SynPasSyn->NumberAttri->Background));
ini->WriteInteger("Display","NumbFore",getNumber(SynPasSyn->NumberAttri->Foreground));
ini->WriteBool("Display","NumbBold",SynPasSyn->NumberAttri->Style.Contains(fsBold));
ini->WriteBool("Display","NumbItal",SynPasSyn->NumberAttri->Style.Contains(fsItalic));
ini->WriteBool("Display","NumbUnder",SynPasSyn->NumberAttri->Style.Contains(fsUnderline));
ini->WriteInteger("Display","SpaceBack",getNumber(SynPasSyn->SpaceAttri->Background));
ini->WriteInteger("Display","SpaceFore",getNumber(SynPasSyn->SpaceAttri->Foreground));
ini->WriteBool("Display","SpaceBold",SynPasSyn->SpaceAttri->Style.Contains(fsBold));
ini->WriteBool("Display","SpaceItal",SynPasSyn->SpaceAttri->Style.Contains(fsItalic));
ini->WriteBool("Display","SpaceUnder",SynPasSyn->SpaceAttri->Style.Contains(fsUnderline));
ini->WriteInteger("Display","StringBack",getNumber(SynPasSyn->StringAttri->Background));
ini->WriteInteger("Display","StringFore",getNumber(SynPasSyn->StringAttri->Foreground));
ini->WriteBool("Display","StringBold",SynPasSyn->StringAttri->Style.Contains(fsBold));
ini->WriteBool("Display","StringItal",SynPasSyn->StringAttri->Style.Contains(fsItalic));
ini->WriteBool("Display","StringUnder",SynPasSyn->StringAttri->Style.Contains(fsUnderline));
ini->WriteInteger("Display","SymbolBack",getNumber(SynPasSyn->SymbolAttri->Background));
ini->WriteInteger("Display","SymbolFore",getNumber(SynPasSyn->SymbolAttri->Foreground));
ini->WriteBool("Display","SymbolBold",SynPasSyn->SymbolAttri->Style.Contains(fsBold));
ini->WriteBool("Display","SymbolItal",SynPasSyn->SymbolAttri->Style.Contains(fsItalic));
ini->WriteBool("Display","SymbolUnder",SynPasSyn->SymbolAttri->Style.Contains(fsUnderline));
delete ini;
}
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
Form1->Left = (Screen->Width / 2) - (Form1->Width / 2);
Form1->Top = (Screen->Height / 2) - (Form1->Height / 2);
title = "Текстовый редактор РУСИЧ-Редактор версия 1.1";
if(isIniFile())
readFile();
else
createFile();
Caption = title;
tb = NULL;
comp = NULL;
}
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete tb;
delete comp;
}
void __fastcall TForm1::FormResize(TObject *Sender)
{
SE->Width = Width - 8;
}
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
writeFile();
}
void __fastcall TForm1::SButtonBladClick(TObject *Sender)
{
PanelBlad->Visible = false;
ShowErrors1->Checked=false;
}
void __fastcall TForm1::DisplayOptions1Click(TObject *Sender)
{
Form3->ShowModal();
}
void __fastcall TForm1::Close2Click(TObject *Sender)
{
Close();
}
void __fastcall TForm1::ShowLineNumers1Click(TObject *Sender)
{
SE->Gutter->Visible = !SE->Gutter->Visible;
ShowLineNumers1->Checked = !ShowLineNumers1->Checked;
}
void __fastcall TForm1::ShowErrors1Click(TObject *Sender)
{
if (PanelBlad->Visible==true)
{
ShowErrors1->Checked=false;
PanelBlad->Visible=false;
}
else
{
ShowErrors1->Checked=true;
PanelBlad->Visible=true;
}
}
void __fastcall TForm1::TBOpenClick(TObject *Sender)
{
if(SE->Modified)
{
int wyn = Application -> MessageBox("Сохранить изменения?\n", "Есть несохраненные данные",MB_YESNOCANCEL|MB_ICONQUESTION);
if(wyn == 6)
{
TBSave->Click();
sciezka = "";
}
else if(wyn == 2)
return;
// SE->Lines->Clear();
if(OD->Execute())
{
sciezka = OD->FileName;
if (FileExists(sciezka))
SE->Lines->LoadFromFile(sciezka);
}
}
else
{
if(OD->Execute())
{
sciezka = OD->FileName;
if (FileExists(sciezka))
SE->Lines->LoadFromFile(sciezka);
}
}
}
void __fastcall TForm1::TBSaveClick(TObject *Sender)
{
if (FileExists(sciezka))
{
SE->Lines->SaveToFile(sciezka);
MessageDlg("Файл "+AnsiString("\"")+ExtractFileName(sciezka)+AnsiString("\"")+" успешно сохранен!",mtInformation,TMsgDlgButtons()<<mbOK,0);
}
else
SaveAs1->Click();
}
void __fastcall TForm1::SaveAs1Click(TObject *Sender)
{
if(SD->Execute())
{
AnsiString sciga = SD->FileName;
sciezka = sciga;
SE->Lines->SaveToFile(sciga);
MessageDlg("Файл "+AnsiString("\"")+ExtractFileName(sciga)+AnsiString("\"")+" успешно сохранен!",mtInformation,TMsgDlgButtons()<<mbOK,0);
}
}
void __fastcall TForm1::Close1Click(TObject *Sender)
{
SynEditPrint->SynEdit = SE;
SynEditPrint->Print();
}
void __fastcall TForm1::TBUndoClick(TObject *Sender)
{
if(SE->CanUndo)
SE->Undo();
}
void __fastcall TForm1::TBRedoClick(TObject *Sender)
{
if(SE->CanRedo)
SE->Redo();
}
void __fastcall TForm1::TBCutClick(TObject *Sender)
{
SE->CutToClipboard();
}
void __fastcall TForm1::TBCopyClick(TObject *Sender)
{
SE->CopyToClipboard();
}
void __fastcall TForm1::TBPasteClick(TObject *Sender)
{
SE->PasteFromClipboard();
}
void __fastcall TForm1::TBDeleteClick(TObject *Sender)
{
SE->ClearSelection();
}
void __fastcall TForm1::SelectAll1Click(TObject *Sender)
{
SE->SelectAll();
}
void __fastcall TForm1::TBNewClick(TObject *Sender)
{
if(SE->Modified)
{
int wyn = Application -> MessageBox("Сохранить изменения?\n", "Есть несохраненные данные",MB_YESNOCANCEL|MB_ICONQUESTION);
if(wyn == 6)
{
TBSave->Click();
sciezka = "";
}
else if(wyn == 2)
return;
SE->Lines->Clear();
}
else
{
sciezka = "";
SE->Lines->Clear();
}
}
void __fastcall TForm1::TBCompileClick(TObject *Sender)
{
delete tb;
tb = new TabProg();
float Start, Stop;
Start = GetTickCount();
for(int i = 0; i < SE->Lines->Count; i++)
{
tb->addLine(SE->Lines->Strings[i]);
}
LBBlad->Clear();
delete comp;
comp = new Compiler(tb->getLine(0), LBBlad);
bool tt = comp->check();
if(!tt)
{
LBBlad->Items->Add("Есть ошибки.");
compile = false;
}
else
{
LBBlad->Items->Add("Нет ошибок.");
compile = true;
}
Stop = GetTickCount();
Start = (Stop - Start) / 1000;
AnsiString asTmp;// = "Время выполнения: ";
asTmp = Start;
asTmp = asTmp.SubString(0, 6);
asTmp = "Время выполнения: " + asTmp;
asTmp = asTmp + " с.";
LBBlad->Items->Add(asTmp);
PanelBlad->Visible = true;
}
void __fastcall TForm1::TBRunClick(TObject *Sender)
{
TBCompile->Click();
if(!compile) return;
Form2->Show();
term=false;
Form2->start();
}
void __fastcall TForm1::TBTerminateClick(TObject *Sender)
{
term=true;
}
void __fastcall TForm1::LBBladDblClick(TObject *Sender)
{
AnsiString as = LBBlad->Items->Strings[0];
NewString ns(as);
if(ns.indexOf("[Строка: ") != -1)
{
ns = ns.substring(ns.indexOf("[Строка: ") + 7, ns.indexOf("]") - 1);
int linia = StrToInt(ns.toString());
SE->CaretY = linia;
SE->SetFocus();
}
}
void __fastcall TForm1::About1Click(TObject *Sender)
{
Form4->ShowModal();
}
void __fastcall TForm1::Help2Click(TObject *Sender)
{
Application->HelpJump("ID_MainMenu");
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Terminate1Click(TObject *Sender)
{
term=true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N13Click(TObject *Sender)
{
Form5->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TBCommandClick(TObject *Sender)
{
Application->HelpJump("ID_CommandList");
}
char* str_replace(char* source,char* from,char* to)
{
int size=strlen(source)+strlen(from)+strlen(to);
char* str=new char[size];
char left[10000];
char right[10000];
int n=0;
memset(str,0,size);
while(str=strstr(source+n,from))
{
lstrcpyn(left,source,str-source+1);
lstrcpy(right,str+lstrlen(from));
lstrcpy(source,left);
lstrcat(source,to);
lstrcat(source,right);
n=(DWORD)(str)-(DWORD)(source)+lstrlen(to);
}
return source;
}
void __fastcall TForm1::pascal1Click(TObject *Sender)
{
PasExport->Clear();
PasExport->Text=SE->Text;
PasExport->Lines->Add("");
PasExport->Text=AnsiLowerCase(PasExport->Text);
PasExport->Text=str_replace(PasExport->Lines->GetText(),"программа", "program");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"начало", "begin");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"конец", "end");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"переменные", "var");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"константы", "const");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"тип", "type");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"целое", "integer");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"дробное", "real");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"булева", "boolean");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"строка", "string");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"символ", "char");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"истина", "true");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ложь", "false");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"если", "if");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"тогда", "then");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"иначе", "else");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"цикл", "for");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"до", "to");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"делать", "do");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"не", "not");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"и", "and");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"или", "or");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"выводстр", "writeln");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"вывод", "write");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"вводстр", "readln");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ввод", "read");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"а", "a");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"б", "b");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"в", "v");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"г", "g");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"д", "d");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"е", "e");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ж", "zh");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"з", "z");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"и", "i");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"й", "j");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"к", "k");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"л", "l");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"м", "m");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"н", "n");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"о", "o");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"п", "p");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"р", "r");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"с", "s");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"т", "t");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"у", "u");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ф", "f");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"х", "h");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ц", "c");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ч", "ch");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ш", "sh");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"щ", "shh");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ъ", "tz");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ы", "bl");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ь", "mz");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"э", "e");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"ю", "yu");
PasExport->Text=str_replace(PasExport->Lines->GetText(),"я", "ya");
if (ExportDialog->Execute())
{
AnsiString expasname=ExportDialog->FileName;
PasExport->Lines->SaveToFile(expasname);
MessageDlg("Файл "+AnsiString("\"")+ExtractFileName(expasname)+AnsiString("\"")+" успешно сохранен!",mtInformation,TMsgDlgButtons()<<mbOK,0);
}
}
void __fastcall TForm1::N19Click(TObject *Sender)
{
Form6->Caption="Поиск";
Form6->Label2->Visible=false;
Form6->ComboBox2->Visible=false;
Form6->Button1->Caption="Найти";
Form6->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N20Click(TObject *Sender)
{
Form6->Caption="Поиск и замена";
Form6->Label2->Visible=true;
Form6->ComboBox2->Visible=true;
Form6->Button1->Caption="Заменить";
Form6->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SEReplaceText(TObject *Sender,
const AnsiString ASearch, const AnsiString AReplace, int Line,
int Column, TSynReplaceAction &Action)
{
switch (MessageDlg("Заменить текст '"+ASearch+"' текстом '"+AReplace+"'?",mtInformation,TMsgDlgButtons() <<mbYes <<mbNo <<mbAll <<mbCancel,0))
{
case mrYes: Action = raReplace;
break;
case mrNo: Action = raSkip;
break;
case mrAll: Action = raReplaceAll;
break;
case mrCancel: Action = raCancel;
};
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N21Click(TObject *Sender)
{
Form6->Button1Click(Sender);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
Application->HelpFile = "Русич.hlp";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCloseQuery(TObject *Sender, bool &CanClose)
{
if(SE->Modified)
{
int wyn = Application -> MessageBox("Сохранить изменения?\n", "Есть несохраненные данные",MB_YESNOCANCEL|MB_ICONQUESTION);
if(wyn == 6)
{
TBSave->Click();
sciezka = "";
}
else if(wyn == 2)
CanClose=false;
}
else
CanClose=true;
}
//---------------------------------------------------------------------------
Unit3.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit3.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "SynEdit"
#pragma link "SynEditHighlighter"
#pragma link "SynHighlighterPas"
#pragma resource "*.dfm"
TForm3 *Form3;
//---------------------------------------------------------------------------
__fastcall TForm3::TForm3(TComponent* Owner)
: TForm(Owner)
{
Form3->Left = (Screen->Width / 2) - (Form3->Width / 2);
Form3->Top = (Screen->Height / 2) - (Form3->Height / 2);
}
void __fastcall TForm3::CBForeDrawItem(TWinControl *Control, int Index,
TRect &Rect, TOwnerDrawState State)
{
switch (Index)
{
case 0 : CBFore->Canvas->Font->Color = clBlack; break;
case 1 : CBFore->Canvas->Font->Color = clBlack; break;
case 2 : CBFore->Canvas->Font->Color = clMaroon; break;
case 3 : CBFore->Canvas->Font->Color = clGreen; break;
case 4 : CBFore->Canvas->Font->Color = clOlive; break;
case 5 : CBFore->Canvas->Font->Color = clNavy; break;
case 6 : CBFore->Canvas->Font->Color = clPurple; break;
case 7 : CBFore->Canvas->Font->Color = clTeal; break;
case 8 : CBFore->Canvas->Font->Color = clGray; break;
case 9 : CBFore->Canvas->Font->Color = clSilver; break;
case 10: CBFore->Canvas->Font->Color = clRed; break;
case 11: CBFore->Canvas->Font->Color = clLime; break;
case 12: CBFore->Canvas->Font->Color = clYellow; break;
case 13: CBFore->Canvas->Font->Color = clBlue; break;
case 14: CBFore->Canvas->Font->Color = clFuchsia; break;
case 15: CBFore->Canvas->Font->Color = clAqua; break;
case 16: CBFore->Canvas->Font->Color = clWhite; break;
case 17: CBFore->Canvas->Font->Color = clMoneyGreen; break;
case 18: CBFore->Canvas->Font->Color = clSkyBlue; break;
case 19: CBFore->Canvas->Font->Color = clCream; break;
case 20: CBFore->Canvas->Font->Color = clMedGray; break;
}
CBFore->Canvas->FillRect(Rect);
CBFore->Canvas->TextOut(Rect.Left, Rect.Top,
CBFore->Items->Strings[Index]);
}
void __fastcall TForm3::CBBackDrawItem(TWinControl *Control, int Index,
TRect &Rect, TOwnerDrawState State)
{
switch (Index)
{
case 0 : CBBack->Canvas->Font->Color = clBlack; break;
case 1 : CBBack->Canvas->Font->Color = clBlack; break;
case 2 : CBBack->Canvas->Font->Color = clMaroon; break;
case 3 : CBBack->Canvas->Font->Color = clGreen; break;
case 4 : CBBack->Canvas->Font->Color = clOlive; break;
case 5 : CBBack->Canvas->Font->Color = clNavy; break;
case 6 : CBBack->Canvas->Font->Color = clPurple; break;
case 7 : CBBack->Canvas->Font->Color = clTeal; break;
case 8 : CBBack->Canvas->Font->Color = clGray; break;
case 9 : CBBack->Canvas->Font->Color = clSilver; break;
case 10: CBBack->Canvas->Font->Color = clRed; break;
case 11: CBBack->Canvas->Font->Color = clLime; break;
case 12: CBBack->Canvas->Font->Color = clYellow; break;
case 13: CBBack->Canvas->Font->Color = clBlue; break;
case 14: CBBack->Canvas->Font->Color = clFuchsia; break;
case 15: CBBack->Canvas->Font->Color = clAqua; break;
case 16: CBBack->Canvas->Font->Color = clWhite; break;
case 17: CBBack->Canvas->Font->Color = clMoneyGreen; break;
case 18: CBBack->Canvas->Font->Color = clSkyBlue; break;
case 19: CBBack->Canvas->Font->Color = clCream; break;
case 20: CBBack->Canvas->Font->Color = clMedGray; break;
}
CBBack->Canvas->FillRect(Rect);
CBBack->Canvas->TextOut(Rect.Left, Rect.Top,
CBBack->Items->Strings[Index]);
}
//---------------------------------------------------------------------------
void __fastcall TForm3::LBElemClick(TObject *Sender)
{
switch(LBElem->ItemIndex)
{
case 0 :
CBFore->ItemIndex = Form1->getNumber(SynPasSyn1->CommentAttri->Foreground);
CBBack->ItemIndex = Form1->getNumber(SynPasSyn1->CommentAttri->Background);
ChBBold->Checked = SynPasSyn1->CommentAttri->Style.Contains(fsBold);
ChBItal->Checked = SynPasSyn1->CommentAttri->Style.Contains(fsItalic);
ChBUnder->Checked = SynPasSyn1->CommentAttri->Style.Contains(fsUnderline);
break;
case 1 :
CBFore->ItemIndex = Form1->getNumber(SynPasSyn1->FloatAttri->Foreground);
CBBack->ItemIndex = Form1->getNumber(SynPasSyn1->FloatAttri->Background);
ChBBold->Checked = SynPasSyn1->FloatAttri->Style.Contains(fsBold);
ChBItal->Checked = SynPasSyn1->FloatAttri->Style.Contains(fsItalic);
ChBUnder->Checked = SynPasSyn1->FloatAttri->Style.Contains(fsUnderline);
break;
case 2 :
CBFore->ItemIndex = Form1->getNumber(SynPasSyn1->NumberAttri->Foreground);
CBBack->ItemIndex = Form1->getNumber(SynPasSyn1->NumberAttri->Background);
ChBBold->Checked = SynPasSyn1->NumberAttri->Style.Contains(fsBold);
ChBItal->Checked = SynPasSyn1->NumberAttri->Style.Contains(fsItalic);
ChBUnder->Checked = SynPasSyn1->NumberAttri->Style.Contains(fsUnderline);
break;
case 3 :
CBFore->ItemIndex = Form1->getNumber(SynPasSyn1->SpaceAttri->Foreground);
CBBack->ItemIndex = Form1->getNumber(SynPasSyn1->SpaceAttri->Background);
ChBBold->Checked = SynPasSyn1->SpaceAttri->Style.Contains(fsBold);
ChBItal->Checked = SynPasSyn1->SpaceAttri->Style.Contains(fsItalic);
ChBUnder->Checked = SynPasSyn1->SpaceAttri->Style.Contains(fsUnderline);
break;
case 4:
CBFore->ItemIndex = Form1->getNumber(SynPasSyn1->StringAttri->Foreground);
CBBack->ItemIndex = Form1->getNumber(SynPasSyn1->StringAttri->Background);
ChBBold->Checked = SynPasSyn1->StringAttri->Style.Contains(fsBold);
ChBItal->Checked = SynPasSyn1->StringAttri->Style.Contains(fsItalic);
ChBUnder->Checked = SynPasSyn1->StringAttri->Style.Contains(fsUnderline);
break;
case 5:
CBFore->ItemIndex = Form1->getNumber(SynPasSyn1->SymbolAttri->Foreground);
CBBack->ItemIndex = Form1->getNumber(SynPasSyn1->SymbolAttri->Background);
ChBBold->Checked = SynPasSyn1->SymbolAttri->Style.Contains(fsBold);
ChBItal->Checked = SynPasSyn1->SymbolAttri->Style.Contains(fsItalic);
ChBUnder->Checked = SynPasSyn1->SymbolAttri->Style.Contains(fsUnderline);
break;
};
}
void __fastcall TForm3::FormShow(TObject *Sender)
{
CBFore->ItemIndex = 0;
CBBack->ItemIndex = 0;
LBElem->ItemIndex = -1;
ChBBold->Checked = false;
ChBItal->Checked = false;
ChBUnder->Checked = false;
SynPasSyn1->AsmAttri->Foreground = Form1->SynPasSyn->AsmAttri->Foreground;
SynPasSyn1->AsmAttri->Background = Form1->SynPasSyn->AsmAttri->Background;
SynPasSyn1->CommentAttri->Foreground = Form1->SynPasSyn->CommentAttri->Foreground;
SynPasSyn1->CommentAttri->Background = Form1->SynPasSyn->CommentAttri->Background;
if(Form1->SynPasSyn->CommentAttri->Style.Contains(fsBold))
SynPasSyn1->CommentAttri->Style << fsBold;
else
SynPasSyn1->CommentAttri->Style >> fsBold;
if(Form1->SynPasSyn->CommentAttri->Style.Contains(fsItalic))
SynPasSyn1->CommentAttri->Style << fsItalic;
else
SynPasSyn1->CommentAttri->Style >> fsItalic;
if(Form1->SynPasSyn->CommentAttri->Style.Contains(fsUnderline))
SynPasSyn1->CommentAttri->Style << fsUnderline;
else
SynPasSyn1->CommentAttri->Style >> fsUnderline;
SynPasSyn1->FloatAttri->Foreground = Form1->SynPasSyn->FloatAttri->Foreground;
SynPasSyn1->FloatAttri->Background = Form1->SynPasSyn->FloatAttri->Background;
if(Form1->SynPasSyn->FloatAttri->Style.Contains(fsBold))
SynPasSyn1->FloatAttri->Style << fsBold;
else
SynPasSyn1->FloatAttri->Style >> fsBold;
if(Form1->SynPasSyn->FloatAttri->Style.Contains(fsItalic))
SynPasSyn1->FloatAttri->Style << fsItalic;
else
SynPasSyn1->FloatAttri->Style >> fsItalic;
if(Form1->SynPasSyn->FloatAttri->Style.Contains(fsUnderline))
SynPasSyn1->FloatAttri->Style << fsUnderline;
else
SynPasSyn1->FloatAttri->Style >> fsUnderline;
SynPasSyn1->NumberAttri->Foreground = Form1->SynPasSyn->NumberAttri->Foreground;
SynPasSyn1->NumberAttri->Background = Form1->SynPasSyn->NumberAttri->Background;
if(Form1->SynPasSyn->NumberAttri->Style.Contains(fsBold))
SynPasSyn1->NumberAttri->Style << fsBold;
else
SynPasSyn1->NumberAttri->Style >> fsBold;
if(Form1->SynPasSyn->NumberAttri->Style.Contains(fsItalic))
SynPasSyn1->NumberAttri->Style << fsItalic;
else
SynPasSyn1->NumberAttri->Style >> fsItalic;
if(Form1->SynPasSyn->NumberAttri->Style.Contains(fsUnderline))
SynPasSyn1->NumberAttri->Style << fsUnderline;
else
SynPasSyn1->NumberAttri->Style >> fsUnderline;
SynPasSyn1->SpaceAttri->Foreground = Form1->SynPasSyn->SpaceAttri->Foreground;
SynPasSyn1->SpaceAttri->Background = Form1->SynPasSyn->SpaceAttri->Background;
if(Form1->SynPasSyn->SpaceAttri->Style.Contains(fsBold))
SynPasSyn1->SpaceAttri->Style << fsBold;
else
SynPasSyn1->SpaceAttri->Style >> fsBold;
if(Form1->SynPasSyn->SpaceAttri->Style.Contains(fsItalic))
SynPasSyn1->SpaceAttri->Style << fsItalic;
else
SynPasSyn1->SpaceAttri->Style >> fsItalic;
if(Form1->SynPasSyn->SpaceAttri->Style.Contains(fsUnderline))
SynPasSyn1->SpaceAttri->Style << fsUnderline;
else
SynPasSyn1->SpaceAttri->Style >> fsUnderline;
SynPasSyn1->StringAttri->Foreground = Form1->SynPasSyn->StringAttri->Foreground;
SynPasSyn1->StringAttri->Background = Form1->SynPasSyn->StringAttri->Background;
if(Form1->SynPasSyn->StringAttri->Style.Contains(fsBold))
SynPasSyn1->StringAttri->Style << fsBold;
else
SynPasSyn1->StringAttri->Style >> fsBold;
if(Form1->SynPasSyn->StringAttri->Style.Contains(fsItalic))
SynPasSyn1->StringAttri->Style << fsItalic;
else
SynPasSyn1->StringAttri->Style >> fsItalic;
if(Form1->SynPasSyn->StringAttri->Style.Contains(fsUnderline))
SynPasSyn1->StringAttri->Style << fsUnderline;
else
SynPasSyn1->StringAttri->Style >> fsUnderline;
SynPasSyn1->SymbolAttri->Foreground = Form1->SynPasSyn->SymbolAttri->Foreground;
SynPasSyn1->SymbolAttri->Background = Form1->SynPasSyn->SymbolAttri->Background;
if(Form1->SynPasSyn->SymbolAttri->Style.Contains(fsBold))
SynPasSyn1->SymbolAttri->Style << fsBold;
else
SynPasSyn1->SymbolAttri->Style >> fsBold;
if(Form1->SynPasSyn->SymbolAttri->Style.Contains(fsItalic))
SynPasSyn1->SymbolAttri->Style << fsItalic;
else
SynPasSyn1->SymbolAttri->Style >> fsItalic;
if(Form1->SynPasSyn->SymbolAttri->Style.Contains(fsUnderline))
SynPasSyn1->SymbolAttri->Style << fsUnderline;
else
SynPasSyn1->SymbolAttri->Style >> fsUnderline;
}
void __fastcall TForm3::Button2Click(TObject *Sender)
{
Close();
}
void __fastcall TForm3::Button1Click(TObject *Sender)
{
Form1->SynPasSyn->CommentAttri->Foreground = SynPasSyn1->CommentAttri->Foreground;
Form1->SynPasSyn->CommentAttri->Background = SynPasSyn1->CommentAttri->Background;
if(SynPasSyn1->CommentAttri->Style.Contains(fsBold))
Form1->SynPasSyn->CommentAttri->Style << fsBold;
else
Form1->SynPasSyn->CommentAttri->Style >> fsBold;
if(SynPasSyn1->CommentAttri->Style.Contains(fsItalic))
Form1->SynPasSyn->CommentAttri->Style << fsItalic;
else
Form1->SynPasSyn->CommentAttri->Style >> fsItalic;
if(SynPasSyn1->CommentAttri->Style.Contains(fsUnderline))
Form1->SynPasSyn->CommentAttri->Style << fsUnderline;
else
Form1->SynPasSyn->CommentAttri->Style >> fsUnderline;
Form1->SynPasSyn->FloatAttri->Foreground = SynPasSyn1->FloatAttri->Foreground;
Form1->SynPasSyn->FloatAttri->Background = SynPasSyn1->FloatAttri->Background;
if(SynPasSyn1->FloatAttri->Style.Contains(fsBold))
Form1->SynPasSyn->FloatAttri->Style << fsBold;
else
Form1->SynPasSyn->FloatAttri->Style >> fsBold;
if(SynPasSyn1->FloatAttri->Style.Contains(fsItalic))
Form1->SynPasSyn->FloatAttri->Style << fsItalic;
else
Form1->SynPasSyn->FloatAttri->Style >> fsItalic;
if(SynPasSyn1->FloatAttri->Style.Contains(fsUnderline))
Form1->SynPasSyn->FloatAttri->Style << fsUnderline;
else
Form1->SynPasSyn->FloatAttri->Style >> fsUnderline;
Form1->SynPasSyn->NumberAttri->Foreground = SynPasSyn1->NumberAttri->Foreground;
Form1->SynPasSyn->NumberAttri->Background = SynPasSyn1->NumberAttri->Background;
if(SynPasSyn1->NumberAttri->Style.Contains(fsBold))
Form1->SynPasSyn->NumberAttri->Style << fsBold;
else
Form1->SynPasSyn->NumberAttri->Style >> fsBold;
if(SynPasSyn1->NumberAttri->Style.Contains(fsItalic))
Form1->SynPasSyn->NumberAttri->Style << fsItalic;
else
Form1->SynPasSyn->NumberAttri->Style >> fsItalic;
if(SynPasSyn1->NumberAttri->Style.Contains(fsUnderline))
Form1->SynPasSyn->NumberAttri->Style << fsUnderline;
else
Form1->SynPasSyn->NumberAttri->Style >> fsUnderline;
Form1->SynPasSyn->SpaceAttri->Foreground = SynPasSyn1->SpaceAttri->Foreground;
Form1->SynPasSyn->SpaceAttri->Background = SynPasSyn1->SpaceAttri->Background;
if(SynPasSyn1->SpaceAttri->Style.Contains(fsBold))
Form1->SynPasSyn->SpaceAttri->Style << fsBold;
else
Form1->SynPasSyn->SpaceAttri->Style >> fsBold;
if(SynPasSyn1->SpaceAttri->Style.Contains(fsItalic))
Form1->SynPasSyn->SpaceAttri->Style << fsItalic;
else
Form1->SynPasSyn->SpaceAttri->Style >> fsItalic;
if(SynPasSyn1->SpaceAttri->Style.Contains(fsUnderline))
Form1->SynPasSyn->SpaceAttri->Style << fsUnderline;
else
Form1->SynPasSyn->SpaceAttri->Style >> fsUnderline;
Form1->SynPasSyn->StringAttri->Foreground = SynPasSyn1->StringAttri->Foreground;
Form1->SynPasSyn->StringAttri->Background = SynPasSyn1->StringAttri->Background;
if(SynPasSyn1->StringAttri->Style.Contains(fsBold))
Form1->SynPasSyn->StringAttri->Style << fsBold;
else
Form1->SynPasSyn->StringAttri->Style >> fsBold;
if(SynPasSyn1->StringAttri->Style.Contains(fsItalic))
Form1->SynPasSyn->StringAttri->Style << fsItalic;
else
Form1->SynPasSyn->StringAttri->Style >> fsItalic;
if(SynPasSyn1->StringAttri->Style.Contains(fsUnderline))
Form1->SynPasSyn->StringAttri->Style << fsUnderline;
else
Form1->SynPasSyn->StringAttri->Style >> fsUnderline;
Form1->SynPasSyn->SymbolAttri->Foreground = SynPasSyn1->SymbolAttri->Foreground;
Form1->SynPasSyn->SymbolAttri->Background = SynPasSyn1->SymbolAttri->Background;
if(SynPasSyn1->SymbolAttri->Style.Contains(fsBold))
Form1->SynPasSyn->SymbolAttri->Style << fsBold;
else
Form1->SynPasSyn->SymbolAttri->Style >> fsBold;
if(SynPasSyn1->SymbolAttri->Style.Contains(fsItalic))
Form1->SynPasSyn->SymbolAttri->Style << fsItalic;
else
Form1->SynPasSyn->SymbolAttri->Style >> fsItalic;
if(SynPasSyn1->SymbolAttri->Style.Contains(fsUnderline))
Form1->SynPasSyn->SymbolAttri->Style << fsUnderline;
else
Form1->SynPasSyn->SymbolAttri->Style >> fsUnderline;
Form1->SE->Refresh();
Close();
}
void __fastcall TForm3::CBForeSelect(TObject *Sender)
{
if(CBFore->ItemIndex == -1) return;
if(LBElem->ItemIndex == -1) return;
switch(LBElem->ItemIndex)
{
case 0 : SynPasSyn1->CommentAttri->Foreground = Form1->getColor(CBFore->ItemIndex); break;
case 1 : SynPasSyn1->FloatAttri->Foreground = Form1->getColor(CBFore->ItemIndex); break;
case 2 : SynPasSyn1->NumberAttri->Foreground = Form1->getColor(CBFore->ItemIndex); break;
case 3 : SynPasSyn1->SpaceAttri->Foreground = Form1->getColor(CBFore->ItemIndex); break;
case 4: SynPasSyn1->StringAttri->Foreground = Form1->getColor(CBFore->ItemIndex); break;
case 5: SynPasSyn1->SymbolAttri->Foreground = Form1->getColor(CBFore->ItemIndex); break;
}
}
void __fastcall TForm3::CBBackSelect(TObject *Sender)
{
if(CBBack->ItemIndex == -1) return;
if(LBElem->ItemIndex == -1) return;
switch(LBElem->ItemIndex)
{
case 0 : SynPasSyn1->CommentAttri->Background = Form1->getColor(CBBack->ItemIndex); break;
case 1 : SynPasSyn1->FloatAttri->Background = Form1->getColor(CBBack->ItemIndex); break;
case 2 : SynPasSyn1->NumberAttri->Background = Form1->getColor(CBBack->ItemIndex); break;
case 3 : SynPasSyn1->SpaceAttri->Background = Form1->getColor(CBBack->ItemIndex); break;
case 4: SynPasSyn1->StringAttri->Background = Form1->getColor(CBBack->ItemIndex); break;
case 5: SynPasSyn1->SymbolAttri->Background = Form1->getColor(CBBack->ItemIndex); break;
}
}
void __fastcall TForm3::ChBBoldClick(TObject *Sender)
{
if(LBElem->ItemIndex == -1) return;
switch(LBElem->ItemIndex)
{
case 0 : if(ChBBold->Checked)
SynPasSyn1->CommentAttri->Style << fsBold;
else
SynPasSyn1->CommentAttri->Style >> fsBold;
break;
case 1 : if(ChBBold->Checked)
SynPasSyn1->FloatAttri->Style << fsBold;
else
SynPasSyn1->FloatAttri->Style >> fsBold;
break;
case 2 : if(ChBBold->Checked)
SynPasSyn1->NumberAttri->Style << fsBold;
else
SynPasSyn1->NumberAttri->Style >> fsBold;
break;
case 3 : if(ChBBold->Checked)
SynPasSyn1->SpaceAttri->Style << fsBold;
else
SynPasSyn1->SpaceAttri->Style >> fsBold;
break;
case 4: if(ChBBold->Checked)
SynPasSyn1->StringAttri->Style << fsBold;
else
SynPasSyn1->StringAttri->Style >> fsBold;
break;
case 5: if(ChBBold->Checked)
SynPasSyn1->SymbolAttri->Style << fsBold;
else
SynPasSyn1->SymbolAttri->Style >> fsBold;
break;
}
SEOption->Refresh();
}
void __fastcall TForm3::ChBItalClick(TObject *Sender)
{
if(LBElem->ItemIndex == -1) return;
switch(LBElem->ItemIndex)
{
case 0 : if(ChBItal->Checked)
SynPasSyn1->CommentAttri->Style << fsItalic;
else
SynPasSyn1->CommentAttri->Style >> fsItalic;
break;
case 1 : if(ChBItal->Checked)
SynPasSyn1->FloatAttri->Style << fsItalic;
else
SynPasSyn1->FloatAttri->Style >> fsItalic;
break;
case 2 : if(ChBItal->Checked)
SynPasSyn1->NumberAttri->Style << fsItalic;
else
SynPasSyn1->NumberAttri->Style >> fsItalic;
break;
case 3 : if(ChBItal->Checked)
SynPasSyn1->SpaceAttri->Style << fsItalic;
else
SynPasSyn1->SpaceAttri->Style >> fsItalic;
break;
case 4: if(ChBItal->Checked)
SynPasSyn1->StringAttri->Style << fsItalic;
else
SynPasSyn1->StringAttri->Style >> fsItalic;
break;
case 5: if(ChBItal->Checked)
SynPasSyn1->SymbolAttri->Style << fsItalic;
else
SynPasSyn1->SymbolAttri->Style >> fsItalic;
break;
}
SEOption->Refresh();
}
void __fastcall TForm3::ChBUnderClick(TObject *Sender)
{
if(LBElem->ItemIndex == -1) return;
switch(LBElem->ItemIndex)
{
case 0 : if(ChBUnder->Checked)
SynPasSyn1->CommentAttri->Style << fsUnderline;
else
SynPasSyn1->CommentAttri->Style >> fsUnderline;
break;
case 1 : if(ChBUnder->Checked)
SynPasSyn1->FloatAttri->Style << fsUnderline;
else
SynPasSyn1->FloatAttri->Style >> fsUnderline;
break;
case 2 : if(ChBUnder->Checked)
SynPasSyn1->NumberAttri->Style << fsUnderline;
else
SynPasSyn1->NumberAttri->Style >> fsUnderline;
break;
case 3 : if(ChBUnder->Checked)
SynPasSyn1->SpaceAttri->Style << fsUnderline;
else
SynPasSyn1->SpaceAttri->Style >> fsUnderline;
break;
case 4: if(ChBUnder->Checked)
SynPasSyn1->StringAttri->Style << fsUnderline;
else
SynPasSyn1->StringAttri->Style >> fsUnderline;
break;
case 5: if(ChBUnder->Checked)
SynPasSyn1->SymbolAttri->Style << fsUnderline;
else
SynPasSyn1->SymbolAttri->Style >> fsUnderline;
break;
}
SEOption->Refresh();
}
Unit6.cpp
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit6.h"
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm6 *Form6;
//---------------------------------------------------------------------------
__fastcall TForm6::TForm6(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm6::Button2Click(TObject *Sender)
{
Form6->Close();
}
//---------------------------------------------------------------------------
void __fastcall TForm6::Button1Click(TObject *Sender)
{
Form6->Close();
TSynSearchOptions OptionRep;
if (Form6->Caption=="Поиск")
if (RadioGroup1->ItemIndex==0)
OptionRep = OptionRep;
else
OptionRep = OptionRep <<ssoBackwards;
else
if (RadioGroup1->ItemIndex==0)
OptionRep = OptionRep <<ssoPrompt <<ssoReplace << ssoReplaceAll;
else
OptionRep = OptionRep <<ssoBackwards <<ssoPrompt <<ssoReplace << ssoReplaceAll;
if (Form1->SE->SearchReplace(Form6->ComboBox1->Text,Form6->ComboBox2->Text,OptionRep) == 0)
MessageBox(0,"Искомый текст не найден",0,MB_ICONINFORMATION);
else
Form6->Close();
}
//---------------------------------------------------------------------------
Размещено на Allbest.ru
Подобные документы
Требования к создаваемому программному модулю. Разработка необходимых алгоритмов и интерфейсов. Описание протокола SPA-BUS. Выбор языка программирования. Тестирование и документирование программного продукта. Оценка экономической эффективности программы.
дипломная работа [722,4 K], добавлен 06.07.2012Необходимые компоненты и порядок составления текстового редактора. Текст программы решения задачи на языке программирования C++. Контрольный пример работы текстового редактора. Создание и произведение операции форматирования простого документа.
курсовая работа [1,6 M], добавлен 03.09.2011Методы работы с файлами на языке Си. Принципы модульного программирования. Реализация программы с дружелюбным интерфейсом для комфорта пользователя и организацией высокоэффективной работы по изучению лексики английского языка. Подпрограммы, их функции.
курсовая работа [1,6 M], добавлен 27.02.2015Обоснование выбора языка программирования. Анализ входных и выходных документов. Логическая структура базы данных. Разработка алгоритма работы программы. Написание программного кода. Тестирование программного продукта. Стоимость программного продукта.
дипломная работа [1008,9 K], добавлен 13.10.2013Разработка и реализация программы расчета заданных функций на языке программирования VBA. Математическая модель, параметры и характеристики задачи, критерии оценки эффективности созданного модуля. Разработка алгоритма и тестирование программного модуля.
курсовая работа [488,7 K], добавлен 08.09.2010Разработка программы проверки знаний для тестирования студентов по программированию с кодом на языке Delphi. Проектирование визуального интерфейса и словесный алгоритм работы программы. Алгоритмы разработанных процедур и функций, инструкция пользователя.
курсовая работа [506,5 K], добавлен 21.02.2011Ознакомление с возможностями языка Си как средой программирования высокого уровня. Циклы программирования параметрического оператора for и функции форматированного ввода. Разработка программы средствами Си: блок-схема, текст и тестирование программы.
контрольная работа [204,4 K], добавлен 26.01.2013Анализ затрат и прибыли. Создание программного проекта для решения задачи о прибыли и убытках на языке программирования C#. Использование функций и переменных, компиляция программы. Алгоритмы и структуры данных. Тестирование программного обеспечения.
курсовая работа [1,2 M], добавлен 03.01.2015Исследование принципов объектно-ориентированного программирования на базе языка программирования С++. Разработка программного комплекса для ведения учёта памятников города. Описание процессов сортировки, поиска, формирования статистики по памятникам.
курсовая работа [782,4 K], добавлен 26.05.2014Возможности среды программирования delphi при разработке приложения с визуальным интерфейсом. Разработка спецификации программного обеспечения и на ее основе кода программного продукта. Отладка программы "трассировкой", ее тестирование и оптимизация.
курсовая работа [501,4 K], добавлен 07.12.2016