Initial commit
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
#include <vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "GameUnit.h"
|
||||
#include "ChartFormUnit.h"
|
||||
#include "ContentPanel.h"
|
||||
#include "GlobalUnit.h"
|
||||
#include "UtilityUnit.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
#pragma resource "*.dfm"
|
||||
TChartForm *ChartForm = NULL;
|
||||
|
||||
//char * u_sTimeUnit[] = {"5秒", "10秒", "20秒", "30秒", "1分",
|
||||
// "2分", "5分", "10分", "30分", "1小时"};
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TChartForm::TChartForm(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
// m_lblTimeUnit->Caption = String(u_sTimeUnit[0]);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::FormClose(TObject *Sender, TCloseAction &Action)
|
||||
{
|
||||
ChartForm->Hide();
|
||||
delete ChartForm;
|
||||
ChartForm = NULL;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::FormCreate(TObject *Sender)
|
||||
{
|
||||
/////////////////////////////////////
|
||||
//test
|
||||
// TDot dot;
|
||||
// for(int i=0; i<4; i++){
|
||||
// g_aDots[i].clear();
|
||||
// g_aDots[i].push_back(dot);
|
||||
// }
|
||||
//
|
||||
// int counts[2] = {0};
|
||||
// int profile = 0;
|
||||
// int tm = time(NULL);
|
||||
// for(int i=0; i<2000; i++){
|
||||
// profile += Random(2000) - 1000;
|
||||
// dot.val = profile;
|
||||
// dot.ts = tm++;
|
||||
// g_aDots[0].push_back(dot);
|
||||
//
|
||||
// counts[Random(2)]++;
|
||||
// dot.val = counts[0] - counts[1];
|
||||
// dot.ts = tm++;
|
||||
// g_aDots[3].push_back(dot);
|
||||
// }
|
||||
//
|
||||
///////////////////////////////////////
|
||||
|
||||
m_panChart = new TContentPanel(this);
|
||||
m_panChart->Parent = this;
|
||||
m_panChart->Align = alClient;
|
||||
m_panChart->Show();
|
||||
|
||||
ShowRunTime();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::UMChartUpdate(TMessage &msg)
|
||||
{
|
||||
int mod = msg.WParam,
|
||||
op = msg.LParam;
|
||||
((TContentPanel*)m_panChart)->UpdateView(mod, op);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::UMRunTime(TMessage &msg)
|
||||
{
|
||||
ShowRunTime();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::ShowRunTime()
|
||||
{
|
||||
int d = g_aGames.runTime / 86400,
|
||||
r = g_aGames.runTime - d * 86400,
|
||||
h, m, s;
|
||||
h = r / 3600, r -= h * 3600;
|
||||
m = r / 60, r -= m * 60;
|
||||
s = r;
|
||||
|
||||
m_lblRunTime->Caption = Format(String("%d天 %.2d:%.2d:%.2d"), ARRAYOFCONST((d, h, m, s)));
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::TopDrawTab(TObject *Sender, TCanvas *TabCanvas, TRect &R, int Index, bool Selected)
|
||||
{
|
||||
TTabSet* pTS = (TTabSet*)Sender;
|
||||
|
||||
int w = TabCanvas->TextWidth((*pTS->Tabs)[Index]),
|
||||
l = ( R.Width() - w ) / 2,
|
||||
h = TabCanvas->TextHeight((*pTS->Tabs)[Index]),
|
||||
t = ( R.Height() - h ) /2;
|
||||
|
||||
if( Index==0 )
|
||||
TabCanvas->Font->Color = clBlue;
|
||||
else if( Index==1 )
|
||||
TabCanvas->Font->Color = clGreen;
|
||||
else if( Index==2 )
|
||||
TabCanvas->Font->Color = clRed;
|
||||
else
|
||||
TabCanvas->Font->Color = clWebRoyalBlue;
|
||||
|
||||
TabCanvas->TextOut(R.Left + l, R.Top + t, (*pTS->Tabs)[Index]);
|
||||
|
||||
TabCanvas->Font->Color = clBlack;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::TopMeasureTab(TObject *Sender, int Index, int &TabWidth)
|
||||
{
|
||||
TabWidth = DPIX(80);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::FormResize(TObject *Sender)
|
||||
{
|
||||
int l = DPIX(150) + (ClientWidth - m_panTU->Width) / 2;
|
||||
int lB = DPIX(420);
|
||||
if(l<lB) l = lB;
|
||||
m_panTU->Left = l;
|
||||
|
||||
// if(WindowState==wsMaximized)
|
||||
// FormStyle = fsNormal;
|
||||
// else if(Application->MainForm->WindowState==wsMaximized)
|
||||
// FormStyle = fsStayOnTop;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
void __fastcall TChartForm::TopChange(TObject *Sender, int NewTab, bool &AllowChange)
|
||||
{
|
||||
((TContentPanel*)m_panChart)->SetView(NewTab);
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void __fastcall TChartForm::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
|
||||
{
|
||||
ResetIdle();
|
||||
|
||||
if(Key==37 || Key==39){
|
||||
((TContentPanel*)m_panChart)->PanKeyDown(Key);
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user