//---------------------------------------------------------------------------
/*
Remote Train Control Program for Windows

© Copyright 2015 by Mark DiVecchio

    This file is part of Remote Train Control.

    Remote Train Control is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Remote Train Control is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

*/
// added panel and correct clClient Align 3 Mar 24 result of V5.0.0 Beta tester Don Lambert
// updated wording to include WiFi 4 Mar 24 result of V5.0.0 Beta tester Don Lambert
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <tchar.h>

#include "Train_Control.h"
#include "Debug_Controls.h"
#include "Clipbrd.hpp"

#include "RTC_Help.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TRTCHelp *RTCHelp;
//---------------------------------------------------------------------------
__fastcall TRTCHelp::TRTCHelp(TComponent* Owner)
	: TForm(Owner)
{
//
// Fill the Help Text Memo
//
const String HelpFile = String(MainForm->cStartDir) + "\\Help.txt";
// if the file exists, overwrite the internal data
if (FileExists(HelpFile)) {
	HelpInfo->Clear();
    HelpInfo->Lines->LoadFromFile(HelpFile);
    if (DEBUGGING) DB->Debug_Print("Help Text Read from " + HelpFile);
	}
}
//---------------------------------------------------------------------------
void __fastcall TRTCHelp::HideButtonClick(TObject *Sender)
{
Hide();	
}
//---------------------------------------------------------------------------



void __fastcall TRTCHelp::CopyrightClick(TObject *Sender)
{
// Copy the Form to the clipboard.
// In BCB4.0, there is no SetSize method associated with TBitmap
// so we have to use Width and Height separately.
//
// see:
// https://stackoverflow.com/questions/3190777/how-do-i-copy-a-form-as-an-image-to-the-clipboard
//
Graphics::TBitmap * bm;
bm = new Graphics::TBitmap;
try
	{
    #if __BORLANDC__ >= 0x720
	// Defined for CB10.1 C++ programs that use the VCL.
	bm->SetSize(ClientWidth, ClientHeight);
    #else
    bm->Width = ClientWidth;
    bm->Height = ClientHeight;
    #endif
	BitBlt(bm->Canvas->Handle, 0, 0, ClientWidth, ClientHeight, Canvas->Handle, 0, 0, SRCCOPY);
    Clipboard()->Assign(bm);
    }
__finally
	{
	delete bm;
    }    
}
//---------------------------------------------------------------------------

