Prześlij pliki do ''

This commit is contained in:
Aleksander Misztal 2019-02-09 02:46:54 +00:00
parent cdfbe7d671
commit eba6a1bf0a
5 changed files with 452 additions and 0 deletions

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 = 313
Top = 224
Width = 833
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 = 815
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

66
Unit1.h Normal file
View File

@ -0,0 +1,66 @@
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Menus.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *Plik1;
TMenuItem *Nowy1;
TMenuItem *Otwrz1;
TMenuItem *Otwrz2;
TMenuItem *Zapisz1;
TMenuItem *Zapiszjako1;
TMenuItem *N1;
TMenuItem *Zakocz1;
TMenuItem *Edycja1;
TMenuItem *Wytnijcrtx1;
TMenuItem *Kopiiuj1;
TMenuItem *WklejCtrlV1;
TMenuItem *Format1;
TMenuItem *Zawijaniewierszy1;
TMenuItem *Ccionka1;
TMenuItem *Pomoc1;
TMenuItem *Informacje1;
TMenuItem *Oprogramie1;
TMenuItem *Kalkulator1;
TMemo *tresc;
TMenuItem *Zegar1;
TOpenDialog *OpenDialog1;
TSaveDialog *SaveDialog1;
TFontDialog *FontDialog1;
TMenuItem *WujekGoogle1;
void __fastcall Otwrz2Click(TObject *Sender);
void __fastcall Zapisz1Click(TObject *Sender);
void __fastcall Zapiszjako1Click(TObject *Sender);
void __fastcall Nowy1Click(TObject *Sender);
void __fastcall trescKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift);
void __fastcall Zakocz1Click(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall Wytnijcrtx1Click(TObject *Sender);
void __fastcall Kopiiuj1Click(TObject *Sender);
void __fastcall WklejCtrlV1Click(TObject *Sender);
void __fastcall Zawijaniewierszy1Click(TObject *Sender);
void __fastcall Ccionka1Click(TObject *Sender);
void __fastcall Oprogramie1Click(TObject *Sender);
void __fastcall WujekGoogle1Click(TObject *Sender);
void __fastcall Kalkulator1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

BIN
Unit1.obj Normal file

Binary file not shown.

66
Unit1.~h Normal file
View File

@ -0,0 +1,66 @@
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Menus.hpp>
#include <Dialogs.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *Plik1;
TMenuItem *Nowy1;
TMenuItem *Otwrz1;
TMenuItem *Otwrz2;
TMenuItem *Zapisz1;
TMenuItem *Zapiszjako1;
TMenuItem *N1;
TMenuItem *Zakocz1;
TMenuItem *Edycja1;
TMenuItem *Wytnijcrtx1;
TMenuItem *Kopiiuj1;
TMenuItem *WklejCtrlV1;
TMenuItem *Format1;
TMenuItem *Zawijaniewierszy1;
TMenuItem *Ccionka1;
TMenuItem *Pomoc1;
TMenuItem *Informacje1;
TMenuItem *Oprogramie1;
TMenuItem *Kalkulator1;
TMemo *tresc;
TMenuItem *Zegar1;
TOpenDialog *OpenDialog1;
TSaveDialog *SaveDialog1;
TFontDialog *FontDialog1;
TMenuItem *WujekGoogle1;
void __fastcall Otwrz2Click(TObject *Sender);
void __fastcall Zapisz1Click(TObject *Sender);
void __fastcall Zapiszjako1Click(TObject *Sender);
void __fastcall Nowy1Click(TObject *Sender);
void __fastcall trescKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift);
void __fastcall Zakocz1Click(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall Wytnijcrtx1Click(TObject *Sender);
void __fastcall Kopiiuj1Click(TObject *Sender);
void __fastcall WklejCtrlV1Click(TObject *Sender);
void __fastcall Zawijaniewierszy1Click(TObject *Sender);
void __fastcall Ccionka1Click(TObject *Sender);
void __fastcall Oprogramie1Click(TObject *Sender);
void __fastcall WujekGoogle1Click(TObject *Sender);
void __fastcall Kalkulator1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif