1 |
|
5 |
//------------------------------------------------------------
|
2 |
|
|
//------------------------------------------------------------
|
3 |
|
|
// MAGiC
|
4 |
|
|
// Jean Christophe Cuillière et Vincent FRANCOIS
|
5 |
|
|
// Département de Génie Mécanique - UQTR
|
6 |
|
|
//------------------------------------------------------------
|
7 |
|
|
// Le projet MAGIC est un projet de recherche du département
|
8 |
|
|
// de génie mécanique de l'Université du Québec à
|
9 |
|
|
// Trois Rivières
|
10 |
|
|
// Les librairies ne peuvent être utilisées sans l'accord
|
11 |
|
|
// des auteurs (contact : francois@uqtr.ca)
|
12 |
|
|
//------------------------------------------------------------
|
13 |
|
|
//------------------------------------------------------------
|
14 |
|
|
//
|
15 |
|
|
// visugraph.cpp
|
16 |
|
|
//
|
17 |
|
|
//------------------------------------------------------------
|
18 |
|
|
//------------------------------------------------------------
|
19 |
|
|
// COPYRIGHT 2000
|
20 |
|
|
// Version du 02/03/2006 à 11H26
|
21 |
|
|
//------------------------------------------------------------
|
22 |
|
|
//------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
#include "gestionversion.h"
|
26 |
|
|
|
27 |
|
|
#include <vcl.h>
|
28 |
|
|
#pragma hdrstop
|
29 |
|
|
|
30 |
|
|
#include "visugraph.h"
|
31 |
|
|
#include <stdio.h>
|
32 |
|
|
//---------------------------------------------------------------------------
|
33 |
|
|
#pragma package(smart_init)
|
34 |
|
|
#pragma resource "*.dfm"
|
35 |
|
|
Tgraph *graph;
|
36 |
|
|
//---------------------------------------------------------------------------
|
37 |
|
|
__fastcall Tgraph::Tgraph(TComponent* Owner)
|
38 |
|
|
: TForm(Owner)
|
39 |
|
|
{
|
40 |
|
|
}
|
41 |
|
|
//---------------------------------------------------------------------------
|
42 |
|
|
void __fastcall Tgraph::FormClose(TObject *Sender, TCloseAction &Action)
|
43 |
|
|
{
|
44 |
|
|
Action=caFree;
|
45 |
|
|
}
|
46 |
|
|
//---------------------------------------------------------------------------
|
47 |
|
|
void __fastcall Tgraph::Imprimer1Click(TObject *Sender)
|
48 |
|
|
{
|
49 |
|
|
Chart1->PrintLandscape();
|
50 |
|
|
}
|
51 |
|
|
//---------------------------------------------------------------------------
|
52 |
|
|
|
53 |
|
|
void __fastcall Tgraph::Haut1Click(TObject *Sender)
|
54 |
|
|
{
|
55 |
|
|
if (ColorDialog1->Execute())
|
56 |
|
|
{
|
57 |
|
|
Chart1->Gradient->EndColor=ColorDialog1->Color;
|
58 |
|
|
char temp[50];
|
59 |
|
|
sprintf(temp,"%X",Chart1->Gradient->EndColor);
|
60 |
|
|
HKEY clef;
|
61 |
|
|
DWORD type,taille,typeclef;
|
62 |
|
|
RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\UQTR\\VMM\\Graphique",0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&clef,&typeclef);
|
63 |
|
|
RegSetValueEx(clef,"Haut",0,REG_SZ, temp,sizeof(char)*(strlen(temp)+1));
|
64 |
|
|
RegCloseKey(clef);
|
65 |
|
|
}
|
66 |
|
|
}
|
67 |
|
|
//---------------------------------------------------------------------------
|
68 |
|
|
|
69 |
|
|
void __fastcall Tgraph::Bas1Click(TObject *Sender)
|
70 |
|
|
{
|
71 |
|
|
if (ColorDialog1->Execute())
|
72 |
|
|
{
|
73 |
|
|
Chart1->Gradient->StartColor=ColorDialog1->Color;
|
74 |
|
|
char temp[50];
|
75 |
|
|
sprintf(temp,"%X",Chart1->Gradient->StartColor);
|
76 |
|
|
HKEY clef;
|
77 |
|
|
DWORD type,taille,typeclef;
|
78 |
|
|
RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\UQTR\\VMM\\Graphique",0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&clef,&typeclef);
|
79 |
|
|
RegSetValueEx(clef,"Bas",0,REG_SZ, temp,sizeof(char)*(strlen(temp)+1));
|
80 |
|
|
RegCloseKey(clef);
|
81 |
|
|
}
|
82 |
|
|
}
|
83 |
|
|
//---------------------------------------------------------------------------
|
84 |
|
|
|
85 |
|
|
void __fastcall Tgraph::Courbe1Click(TObject *Sender)
|
86 |
|
|
{
|
87 |
|
|
if (ColorDialog1->Execute())
|
88 |
|
|
{
|
89 |
|
|
Series1->LinePen->Color=ColorDialog1->Color;
|
90 |
|
|
char temp[50];
|
91 |
|
|
sprintf(temp,"%X",Series1->LinePen->Color);
|
92 |
|
|
HKEY clef;
|
93 |
|
|
DWORD type,taille,typeclef;
|
94 |
|
|
RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\UQTR\\VMM\\Graphique",0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&clef,&typeclef);
|
95 |
|
|
RegSetValueEx(clef,"Courbe",0,REG_SZ, temp,sizeof(char)*(strlen(temp)+1));
|
96 |
|
|
RegCloseKey(clef);
|
97 |
|
|
}
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
}
|
101 |
|
|
//---------------------------------------------------------------------------
|
102 |
|
|
|
103 |
|
|
void __fastcall Tgraph::FormCreate(TObject *Sender)
|
104 |
|
|
{
|
105 |
|
|
char buf[500];
|
106 |
|
|
TColor col;
|
107 |
|
|
HKEY clef;
|
108 |
|
|
DWORD type,taille,typeclef;
|
109 |
|
|
RegCreateKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\UQTR\\VMM\\Graphique",0,0,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&clef,&typeclef);
|
110 |
|
|
int nb;
|
111 |
|
|
int res=RegQueryValueEx(clef,"Haut",0,&type,0,&taille);
|
112 |
|
|
if (res==ERROR_SUCCESS)
|
113 |
|
|
{
|
114 |
|
|
RegQueryValueEx(clef,"Haut",0,&type,buf,&taille);
|
115 |
|
|
nb=sscanf(buf,"%X",&col);
|
116 |
|
|
}
|
117 |
|
|
else nb=0;
|
118 |
|
|
if (nb==1) Chart1->Gradient->EndColor=col;
|
119 |
|
|
res=RegQueryValueEx(clef,"bas",0,&type,0,&taille);
|
120 |
|
|
if (res==ERROR_SUCCESS)
|
121 |
|
|
{
|
122 |
|
|
RegQueryValueEx(clef,"bas",0,&type,buf,&taille);
|
123 |
|
|
nb=sscanf(buf,"%X",&col);
|
124 |
|
|
}
|
125 |
|
|
else nb=0;
|
126 |
|
|
if (nb==1) Chart1->Gradient->StartColor=col;
|
127 |
|
|
res=RegQueryValueEx(clef,"courbe",0,&type,0,&taille);
|
128 |
|
|
if (res==ERROR_SUCCESS)
|
129 |
|
|
{
|
130 |
|
|
RegQueryValueEx(clef,"courbe",0,&type,buf,&taille);
|
131 |
|
|
nb=sscanf(buf,"%X",&col);
|
132 |
|
|
}
|
133 |
|
|
else nb=0;
|
134 |
|
|
if (nb==1) Series1->LinePen->Color=col;
|
135 |
|
|
RegCloseKey(clef);
|
136 |
|
|
}
|
137 |
|
|
//---------------------------------------------------------------------------
|
138 |
|
|
|
139 |
|
|
void __fastcall Tgraph::Haut2Click(TObject *Sender)
|
140 |
|
|
{
|
141 |
|
|
if (ColorDialog1->Execute())
|
142 |
|
|
Chart1->Gradient->EndColor=ColorDialog1->Color;
|
143 |
|
|
|
144 |
|
|
}
|
145 |
|
|
//---------------------------------------------------------------------------
|
146 |
|
|
|
147 |
|
|
void __fastcall Tgraph::Bas2Click(TObject *Sender)
|
148 |
|
|
{
|
149 |
|
|
if (ColorDialog1->Execute())
|
150 |
|
|
Chart1->Gradient->StartColor=ColorDialog1->Color;
|
151 |
|
|
|
152 |
|
|
}
|
153 |
|
|
//---------------------------------------------------------------------------
|
154 |
|
|
|
155 |
|
|
void __fastcall Tgraph::Courbe2Click(TObject *Sender)
|
156 |
|
|
{
|
157 |
|
|
if (ColorDialog1->Execute())
|
158 |
|
|
Series1->LinePen->Color=ColorDialog1->Color;
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
}
|
163 |
|
|
//---------------------------------------------------------------------------
|
164 |
|
|
|