Prześlij pliki do ''

This commit is contained in:
Aleksander Misztal 2019-02-09 02:44:36 +00:00
parent 43b39f5ba2
commit c4f944b58c
4 changed files with 320 additions and 0 deletions

BIN
Project1.obj Normal file

Binary file not shown.

BIN
Project1.res Normal file

Binary file not shown.

181
Unit1.~cpp Normal file
View File

@ -0,0 +1,181 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
#include "Unit3.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
AnsiString nazwapliku="";
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Otwrz2Click(TObject *Sender)
{
if (OpenDialog1->Execute()){
try{
tresc->Lines->LoadFromFile(OpenDialog1->FileName);
nazwapliku = OpenDialog1->FileName;
}
catch (...){
ShowMessage("B³¹d otwarcia pliku. Upewnij siê, ¿e plik istnieje na dysku");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Zapisz1Click(TObject *Sender)
{
if (nazwapliku!=""){
tresc->Lines->SaveToFile(nazwapliku);
}
else{
Form1->Zapiszjako1Click(MainMenu1);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Zapiszjako1Click(TObject *Sender)
{
if (SaveDialog1->Execute()){
try{
tresc->Lines->SaveToFile(SaveDialog1->FileName);
nazwapliku = SaveDialog1->FileName;
}
catch (...){
ShowMessage("Zapis zakoñczy³ siê niepowodzeniem.");
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Nowy1Click(TObject *Sender)
{
if(Application->MessageBox("Czy na pewno utworzyæ nowy plik ?","PotwierdŸ",
MB_YESNOCANCEL | MB_ICONQUESTION) == IDYES ){
tresc->Lines->Clear();
nazwapliku="";
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::trescKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Shift.Contains(ssCtrl))
{
if((Key == 's') || (Key =='S')){
Form1->Zapisz1Click(MainMenu1);
}
}
if (Shift.Contains(ssCtrl))
{
if((Key == 'n') || (Key =='N')){
Form1->Otwrz2Click(MainMenu1);
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Zakocz1Click(TObject *Sender)
{
if(Application->MessageBox("Czy na pewno zakoñczyæ program ?","PotwierdŸ",
MB_YESNO | MB_ICONQUESTION) == IDYES ){
Application->Terminate();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
if(Application->MessageBox("Czy na pewno zakoñczyæ program ?","PotwierdŸ",
MB_YESNO | MB_ICONQUESTION) == IDNO ){
Action=caNone;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Wytnijcrtx1Click(TObject *Sender)
{
tresc->CutToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Kopiiuj1Click(TObject *Sender)
{
tresc->CopyToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WklejCtrlV1Click(TObject *Sender)
{
tresc->PasteFromClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Zawijaniewierszy1Click(TObject *Sender)
{
if(Zawijaniewierszy1->Checked==true)
{
Zawijaniewierszy1->Checked=false;
tresc->WordWrap=false;
tresc->ScrollBars = ssBoth;
}
else
{
Zawijaniewierszy1->Checked=true;
tresc->WordWrap=true;
tresc->ScrollBars = ssVertical;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Ccionka1Click(TObject *Sender)
{
if(FontDialog1->Execute())
{
tresc->Font->Name = FontDialog1->Font->Name;
tresc->Font->Color = FontDialog1->Font->Color;
tresc->Font->Size = FontDialog1->Font->Size;
tresc->Font->Style = FontDialog1->Font->Style;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Oprogramie1Click(TObject *Sender)
{
Form2->ShowModal();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::WujekGoogle1Click(TObject *Sender)
{
ShellExecute(NULL,"open","https://www.google.pl", NULL, NULL, SW_SHOWNORMAL);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Kalkulator1Click(TObject *Sender)
{
Form3->ShowModal();
}
//---------------------------------------------------------------------------

139
Unit1.~dfm Normal file
View File

@ -0,0 +1,139 @@
object Form1: TForm1
Left = 1320
Top = 282
Width = 1305
Height = 675
Caption = 'M'#243'j notatnik'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
OnClose = FormClose
PixelsPerInch = 120
TextHeight = 16
object tresc: TMemo
Left = 0
Top = 0
Width = 1287
Height = 605
Align = alClient
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -23
Font.Name = 'MS Sans Serif'
Font.Style = []
Lines.Strings = (
'')
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
OnKeyDown = trescKeyDown
end
object MainMenu1: TMainMenu
Left = 424
Top = 104
object Plik1: TMenuItem
Caption = '&Plik'
object Nowy1: TMenuItem
Caption = '&Nowy Ctrl+N'
OnClick = Nowy1Click
end
object Otwrz1: TMenuItem
Caption = '-'
end
object Otwrz2: TMenuItem
Caption = '&Otw'#243'rz Ctrl+O'
OnClick = Otwrz2Click
end
object Zapisz1: TMenuItem
Caption = 'Za&pisz Ctrl+S'
OnClick = Zapisz1Click
end
object Zapiszjako1: TMenuItem
Caption = 'Zapi&sz jako'
OnClick = Zapiszjako1Click
end
object N1: TMenuItem
Caption = '-'
end
object Zakocz1: TMenuItem
Caption = 'Zako&'#324'cz'
OnClick = Zakocz1Click
end
end
object Edycja1: TMenuItem
Caption = '&Edycja'
object Wytnijcrtx1: TMenuItem
Caption = 'W&ytnij Ctrt+X'
OnClick = Wytnijcrtx1Click
end
object Kopiiuj1: TMenuItem
Caption = 'Kop&iuj Ctrl+C '
OnClick = Kopiiuj1Click
end
object WklejCtrlV1: TMenuItem
Caption = 'Wkl&ej Ctrl+V'
OnClick = WklejCtrlV1Click
end
end
object Format1: TMenuItem
Caption = '&Format'
object Zawijaniewierszy1: TMenuItem
Caption = 'Z&awijanie wierszy'
Checked = True
OnClick = Zawijaniewierszy1Click
end
object Ccionka1: TMenuItem
Caption = 'C&zcionka'
OnClick = Ccionka1Click
end
end
object Pomoc1: TMenuItem
Caption = '&Pomoc'
object Informacje1: TMenuItem
Caption = 'In&formacje'
object Oprogramie1: TMenuItem
Caption = 'O &programie'
OnClick = Oprogramie1Click
end
end
object WujekGoogle1: TMenuItem
Caption = 'W&ujek Google'
OnClick = WujekGoogle1Click
end
end
object Kalkulator1: TMenuItem
Caption = '&Kalkulator'
OnClick = Kalkulator1Click
end
object Zegar1: TMenuItem
Caption = ' '
end
end
object OpenDialog1: TOpenDialog
Filter = 'Pliki tekstowe (txt)|*.txt|Wszystkie pliki|*.*'
Left = 368
Top = 112
end
object SaveDialog1: TSaveDialog
Filter = 'Plik tekstowy (txt)|*txt|Wszystkie pliki|*.*'
Options = [ofOverwritePrompt, ofHideReadOnly, ofEnableSizing]
Left = 320
Top = 120
end
object FontDialog1: TFontDialog
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = []
MinFontSize = 0
MaxFontSize = 0
Left = 264
Top = 120
end
end