Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "BaseMain.h"
- #include "LineAction.h"
- #include "SettingsActions.h"
- #include "HeadersSettings.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- DataProgram = new TDataProgram();
- SaveName = "";
- TIniFile *ini = new TIniFile("Lib/Baseini.ini");
- Top = ini->ReadInteger("Form_Parameter", "Top", Width);
- Height = ini->ReadInteger("Form_Parameter", "Height", Height);
- Left = ini->ReadInteger("Form_Parameter", "Left", Left);
- Right = ini->ReadInteger("Form_Parameter", "Right", 100);
- Other = ini->ReadInteger("Form_Parameter", "Other", 100);
- Caption = ini->ReadString("Form_Parameter", "Name", "Base v2.0 - > Pro version");
- ini->ReadBool("Form_Parameter", "InitMax", false) ?
- WindowState = wsMaximized:
- WindowState = wsNormal;
- delete ini;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
- {
- TIniFile *ini = new TIniFile("Lib/Baseini.ini");
- ini->WriteInteger("Form_Parameter", "Top", Width);
- ini->WriteInteger("Form_Parameter", "Height", Height);
- ini->WriteInteger("Form_Parameter", "Left", Left);
- ini->WriteInteger("Form_Parameter", "Other", 100);
- ini->WriteString("Form_Parameter", "Name" , Caption);
- ini->WriteInteger("Form_Parameter", "Right", 100);
- ini->WriteBool("Form_Parameter", "InitMax", WindowState == wsMaximized);
- delete ini;
- if (Application->MessageBoxW(L"Close Program?", L"Confim", MB_YESNO|MB_ICONINFORMATION)== ID_NO)
- {
- Action = caNone;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::NewFile1Click(TObject *Sender)
- {
- DataProgram->RefreshDataProgram();
- Image1->Picture = NULL;
- for (int i = 0; i < StringGrid1->RowCount; i++)
- {
- for (int j = 0; j < StringGrid1->ColCount; j++)
- {
- StringGrid1->Cells[j][i] = "";
- }
- }
- StringGrid1->RowCount = 2;
- StringGrid1->ColCount = 2;
- SaveName = "";
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Open1Click(TObject *Sender)
- {
- if (OpenDialog1->Execute())
- {
- DataProgram->RefreshDataProgram();
- DataProgram->LoadFromFile(OpenDialog1->FileName, StringGrid1);
- SaveName = OpenDialog1->FileName;
- StringGrid1->Col = (StringGrid1->Col == 0) ? 1:0;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::StringGrid1SelectCell(TObject *Sender, int ACol, int ARow,
- bool &CanSelect)
- {
- Memo1->Clear();
- memo temp;
- temp = DataProgram->GetMemo(ARow);
- if(DataProgram->note)
- {
- for (int i = 0; i < DataProgram->MemoCount; i++)
- {
- if (!temp.A[DataProgram->MemoCount-i-1].IsEmpty())
- Memo1->Lines->Add(temp.A[DataProgram->MemoCount-i-1]);
- }
- }
- Image1->Picture = NULL;
- try{Image1->Picture->LoadFromFile(DataProgram->GetBitmap(ARow));}catch(...){;}
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::AddBitMap1Click(TObject *Sender)
- {
- if (OpenPictureDialog1->Execute())
- {
- DataProgram->SetBitmap(OpenPictureDialog1->FileName ,StringGrid1->Row);
- Image1->Picture->LoadFromFile(OpenPictureDialog1->FileName);
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::LineSection1Click(TObject *Sender)
- {
- Form3->ShowModal();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::HeadersSection1Click(TObject *Sender)
- {
- Form2->ShowModal();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::SettingsActions1Click(TObject *Sender)
- {
- Form4->ShowModal();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::SaveCtrlS1Click(TObject *Sender)
- {
- if (SaveName.IsEmpty())
- {
- if (SaveDialog1->Execute())
- DataProgram->SaveToFile(SaveDialog1->FileName, StringGrid1);
- }
- else
- DataProgram->SaveToFile(SaveName, StringGrid1);
- SaveName = SaveDialog1->FileName;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::SaveAs1Click(TObject *Sender)
- {
- if (SaveDialog1->Execute())
- DataProgram->SaveToFile(SaveDialog1->FileName, StringGrid1);
- SaveName = SaveDialog1->FileName;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Close1Click(TObject *Sender)
- {
- Application->Terminate();
- delete DataProgram;
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement