Added GDE-Loop
Das Programm wird jetzt in einer while-Schleife ausgeführt, zwei Buttons sind zu Steuerung in der GDE vorhanden
This commit is contained in:
parent
ac7e6ff233
commit
d17de2a6a1
9 changed files with 195 additions and 130 deletions
|
@ -122,6 +122,7 @@
|
||||||
<ClCompile Include="..\Hazard\Hazard\KV_PiGroup.cpp" />
|
<ClCompile Include="..\Hazard\Hazard\KV_PiGroup.cpp" />
|
||||||
<ClCompile Include="..\Hazard\Hazard\PrimImplikant.cpp" />
|
<ClCompile Include="..\Hazard\Hazard\PrimImplikant.cpp" />
|
||||||
<ClCompile Include="..\Hazard\Hazard\PrimImplikantCollection.cpp" />
|
<ClCompile Include="..\Hazard\Hazard\PrimImplikantCollection.cpp" />
|
||||||
|
<ClCompile Include="..\Hazard\Hazard\Tools.cpp" />
|
||||||
<ClCompile Include="..\Hazard\Hazard\Wertetabelle.cpp" />
|
<ClCompile Include="..\Hazard\Hazard\Wertetabelle.cpp" />
|
||||||
<ClCompile Include="GDE_3.cpp" />
|
<ClCompile Include="GDE_3.cpp" />
|
||||||
<ClCompile Include="GDE_3Doc.cpp" />
|
<ClCompile Include="GDE_3Doc.cpp" />
|
||||||
|
@ -146,6 +147,7 @@
|
||||||
<ClInclude Include="..\Hazard\Hazard\KV_PiGroup.h" />
|
<ClInclude Include="..\Hazard\Hazard\KV_PiGroup.h" />
|
||||||
<ClInclude Include="..\Hazard\Hazard\PrimImplikant.h" />
|
<ClInclude Include="..\Hazard\Hazard\PrimImplikant.h" />
|
||||||
<ClInclude Include="..\Hazard\Hazard\PrimImplikantCollection.h" />
|
<ClInclude Include="..\Hazard\Hazard\PrimImplikantCollection.h" />
|
||||||
|
<ClInclude Include="..\Hazard\Hazard\Tools.h" />
|
||||||
<ClInclude Include="..\Hazard\Hazard\Wertetabelle.h" />
|
<ClInclude Include="..\Hazard\Hazard\Wertetabelle.h" />
|
||||||
<ClInclude Include="GDE_3.h" />
|
<ClInclude Include="GDE_3.h" />
|
||||||
<ClInclude Include="GDE_3Doc.h" />
|
<ClInclude Include="GDE_3Doc.h" />
|
||||||
|
@ -153,7 +155,6 @@
|
||||||
<ClInclude Include="MainFrm.h" />
|
<ClInclude Include="MainFrm.h" />
|
||||||
<ClInclude Include="Resource.h" />
|
<ClInclude Include="Resource.h" />
|
||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
<ClInclude Include="User.h" />
|
|
||||||
<ClInclude Include="Graphics\BaseException.h" />
|
<ClInclude Include="Graphics\BaseException.h" />
|
||||||
<ClInclude Include="Graphics\Dib.h" />
|
<ClInclude Include="Graphics\Dib.h" />
|
||||||
<ClInclude Include="Graphics\Graphicfunctions.h" />
|
<ClInclude Include="Graphics\Graphicfunctions.h" />
|
||||||
|
|
|
@ -78,6 +78,9 @@
|
||||||
<ClCompile Include="..\Hazard\Hazard\KV_PiGroup.cpp">
|
<ClCompile Include="..\Hazard\Hazard\KV_PiGroup.cpp">
|
||||||
<Filter>Quelldateien</Filter>
|
<Filter>Quelldateien</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\Hazard\Hazard\Tools.cpp">
|
||||||
|
<Filter>Quelldateien</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="GDE_3.h">
|
<ClInclude Include="GDE_3.h">
|
||||||
|
@ -98,9 +101,6 @@
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
<Filter>Headerdateien</Filter>
|
<Filter>Headerdateien</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="User.h">
|
|
||||||
<Filter>Headerdateien</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="Graphics\BaseException.h">
|
<ClInclude Include="Graphics\BaseException.h">
|
||||||
<Filter>Graphics</Filter>
|
<Filter>Graphics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -149,6 +149,9 @@
|
||||||
<ClInclude Include="..\Hazard\Hazard\KV_PiEleLoc.h">
|
<ClInclude Include="..\Hazard\Hazard\KV_PiEleLoc.h">
|
||||||
<Filter>Headerdateien</Filter>
|
<Filter>Headerdateien</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\Hazard\Hazard\Tools.h">
|
||||||
|
<Filter>Quelldateien</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="res\GDE_3.ico">
|
<None Include="res\GDE_3.ico">
|
||||||
|
|
|
@ -220,9 +220,9 @@ void CGDE_3View::OnButtonzoomfit()
|
||||||
void CGDE_3View::OnStartButton()
|
void CGDE_3View::OnStartButton()
|
||||||
{
|
{
|
||||||
theApp.m_stopflag=FALSE;
|
theApp.m_stopflag=FALSE;
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////if(theApp.vw->uthread==NULL)
|
if(theApp.vw->uthread==NULL)
|
||||||
theApp.vw->uthread = AfxBeginThread(StartGDE, &theApp, THREAD_PRIORITY_NORMAL);
|
theApp.vw->uthread = AfxBeginThread(StartGDE, &theApp, THREAD_PRIORITY_NORMAL);
|
||||||
//else AfxMessageBox("User_main is already running\n",MB_OK);
|
else AfxMessageBox("User_main is already running\n",MB_OK);
|
||||||
|
|
||||||
}
|
}
|
||||||
void CGDE_3View::OnStopButton()
|
void CGDE_3View::OnStopButton()
|
||||||
|
|
|
@ -208,7 +208,7 @@ int mouseclick(int *x, int *y) // Wartet auf einen Mausklick und gibt dann butto
|
||||||
while (theApp.vw->MouseClick == 0) // Warten bis eine Maustaste gedrueckt wird.
|
while (theApp.vw->MouseClick == 0) // Warten bis eine Maustaste gedrueckt wird.
|
||||||
{
|
{
|
||||||
DoEvents();
|
DoEvents();
|
||||||
if(StopProcess())break;
|
if(stopProcess())break;
|
||||||
Sleep(20); // 20ms warten
|
Sleep(20); // 20ms warten
|
||||||
}
|
}
|
||||||
*x = theApp.vw->MousePoint.x; // Zurueckgeben der x-Koordinate des Mauszeigers.
|
*x = theApp.vw->MousePoint.x; // Zurueckgeben der x-Koordinate des Mauszeigers.
|
||||||
|
@ -247,7 +247,7 @@ void updatescr() // Neuzeichnen des gesamten Zeichenbereiches.
|
||||||
{
|
{
|
||||||
theApp.vw->Invalidate(FALSE); // Zeichenbereich aktualisieren (GDEView::OnPaint() wird aufgerufen)
|
theApp.vw->Invalidate(FALSE); // Zeichenbereich aktualisieren (GDEView::OnPaint() wird aufgerufen)
|
||||||
}
|
}
|
||||||
BOOL StopProcess()
|
bool stopProcess()
|
||||||
{
|
{
|
||||||
return theApp.m_stopflag ;
|
return (bool)theApp.m_stopflag ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include "../stdafx.h"
|
||||||
|
|
||||||
// Graphicfunctions.h : interface of the GDE functions
|
// Graphicfunctions.h : interface of the GDE functions
|
||||||
//
|
//
|
||||||
// In diesem Header-File sind alle Grafikfunktionen, die der Benutzer
|
// In diesem Header-File sind alle Grafikfunktionen, die der Benutzer
|
||||||
|
@ -98,4 +100,4 @@ void wait(unsigned int msecs); // Wartet die vorgegebende Zeit in Millisekunden.
|
||||||
void clrscr(); // Loescht den gesamten Zeichenbereich.
|
void clrscr(); // Loescht den gesamten Zeichenbereich.
|
||||||
void updatescr(); // Neuzeichnen des gesamten Zeichenbereiches.
|
void updatescr(); // Neuzeichnen des gesamten Zeichenbereiches.
|
||||||
|
|
||||||
BOOL StopProcess(); // Gibt an ob ein Stopflagg gesetzt wurde
|
bool stopProcess(); // Gibt an ob ein Stopflagg gesetzt wurde
|
|
@ -44,7 +44,7 @@ void Zeichne_Ast(int x, int y, float n, float Tiefe, float Laenge)
|
||||||
{
|
{
|
||||||
int x_rel;
|
int x_rel;
|
||||||
int y_rel;
|
int y_rel;
|
||||||
if(StopProcess())return;
|
if(stopProcess())return;
|
||||||
if (Tiefe > 1) { // Stopbedingung fuer die Rekursion.
|
if (Tiefe > 1) { // Stopbedingung fuer die Rekursion.
|
||||||
// Zeichnen des linken Astes.
|
// Zeichnen des linken Astes.
|
||||||
x_rel = (int)(Laenge * _sinus(n + baum.Neigung_links)); // Berechnen der x-Koordinate.
|
x_rel = (int)(Laenge * _sinus(n + baum.Neigung_links)); // Berechnen der x-Koordinate.
|
||||||
|
@ -109,7 +109,7 @@ void Restart()
|
||||||
((y > h-40) && (y < h-5))
|
((y > h-40) && (y < h-5))
|
||||||
)) {
|
)) {
|
||||||
printf(".");
|
printf(".");
|
||||||
if(StopProcess())break;
|
if(stopProcess())break;
|
||||||
};
|
};
|
||||||
|
|
||||||
printf("######################################\n\n");
|
printf("######################################\n\n");
|
||||||
|
@ -147,7 +147,7 @@ void user_main2()
|
||||||
Zeichne_Baum(); // Den Baum zeichnen.
|
Zeichne_Baum(); // Den Baum zeichnen.
|
||||||
cout << "Baum gezeichnet\n";
|
cout << "Baum gezeichnet\n";
|
||||||
Restart(); // Den "Restart"-Button malen und auf eine Aktivierung warten.
|
Restart(); // Den "Restart"-Button malen und auf eine Aktivierung warten.
|
||||||
if(StopProcess())break;
|
if(stopProcess())break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,17 +18,38 @@ uint numElements = 0; // = 2 ^ dimension
|
||||||
bool KNF = false;
|
bool KNF = false;
|
||||||
bool fileChosen = false;
|
bool fileChosen = false;
|
||||||
char fnInput[256];
|
char fnInput[256];
|
||||||
char fnError[256];
|
|
||||||
char fnLists[256];
|
|
||||||
|
|
||||||
|
|
||||||
int open_files(FILE * &input, FILE * &error, FILE * &list)
|
int open_files(FILE * &input, FILE * &error, FILE * &list)
|
||||||
{
|
{
|
||||||
if (fileChosen == false)
|
if (fileChosen == true) // don't reopen files
|
||||||
{
|
return 9;
|
||||||
|
|
||||||
GetCurrentDirectory(sizeof(fnInput), fnInput);
|
GetCurrentDirectory(sizeof(fnInput), fnInput);
|
||||||
|
|
||||||
|
if (error == NULL)
|
||||||
|
{
|
||||||
|
char fnError[256];
|
||||||
strcpy_s(fnError, (string(fnInput) + "\\res\\errorParser.txt").c_str());
|
strcpy_s(fnError, (string(fnInput) + "\\res\\errorParser.txt").c_str());
|
||||||
|
fopen_s(&error, fnError, "a");
|
||||||
|
if (error == NULL)
|
||||||
|
{
|
||||||
|
perror("Fehler beim Öffnen der Fehlerdatei");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (list == NULL)
|
||||||
|
{
|
||||||
|
char fnLists[256];
|
||||||
strcpy_s(fnLists, (string(fnInput) + "\\res\\listParser.txt").c_str());
|
strcpy_s(fnLists, (string(fnInput) + "\\res\\listParser.txt").c_str());
|
||||||
|
fopen_s(&list, fnLists, "w");
|
||||||
|
if (list == NULL)
|
||||||
|
{
|
||||||
|
perror("Fehler beim Öffnen der Listdatei");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
strcpy_s(fnInput, (string(fnInput) + "\\res\\input.txt").c_str());
|
strcpy_s(fnInput, (string(fnInput) + "\\res\\input.txt").c_str());
|
||||||
|
|
||||||
OPENFILENAME ofn;
|
OPENFILENAME ofn;
|
||||||
|
@ -47,29 +68,18 @@ int open_files(FILE * &input, FILE * &error, FILE * &list)
|
||||||
if (GetOpenFileName(&ofn) != TRUE)
|
if (GetOpenFileName(&ofn) != TRUE)
|
||||||
{
|
{
|
||||||
cout << "Auswahl der Inputdatei abgebrochen!";
|
cout << "Auswahl der Inputdatei abgebrochen!";
|
||||||
return 1;
|
return 2;
|
||||||
}
|
}
|
||||||
fileChosen = true;
|
fileChosen = true;
|
||||||
}
|
|
||||||
|
|
||||||
|
if (input != NULL)
|
||||||
|
fclose(input);
|
||||||
fopen_s(&input, fnInput, "r");
|
fopen_s(&input, fnInput, "r");
|
||||||
if (input == NULL)
|
if (input == NULL)
|
||||||
{
|
{
|
||||||
perror("Fehler beim Lesen der Inputdatei");
|
perror("Fehler beim Lesen der Inputdatei");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
fopen_s(&error, fnError, "a");
|
|
||||||
if (error == NULL)
|
|
||||||
{
|
|
||||||
perror("Fehler beim Öffnen der Fehlerdatei");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
fopen_s(&list, fnLists, "w");
|
|
||||||
if (list == NULL)
|
|
||||||
{
|
|
||||||
perror("Fehler beim Öffnen der Listdatei");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,28 +92,43 @@ void pause()
|
||||||
|
|
||||||
void user_main(void)
|
void user_main(void)
|
||||||
{
|
{
|
||||||
FILE * input, * error, * list;
|
FILE * input = NULL, * error = NULL, * list = NULL;
|
||||||
if (open_files(input, error, list) != 0)
|
KV* kv;
|
||||||
|
while(1)
|
||||||
{
|
{
|
||||||
pause();
|
switch(open_files(input, error, list))
|
||||||
return;
|
{
|
||||||
}
|
case 1: // some error
|
||||||
|
fileChosen = false;
|
||||||
|
perror("Error while opening a file (1)");
|
||||||
|
continue;
|
||||||
|
case 2: // user aborted
|
||||||
|
ExitProcess(2);
|
||||||
|
break;
|
||||||
|
case 9: // same input as before
|
||||||
|
// We could skip recalculation, but then the GDE is not redrawn (updatescr doesn't help) :/
|
||||||
|
case 0: // new file opened
|
||||||
|
{
|
||||||
|
cout << endl << endl << endl << endl;
|
||||||
|
|
||||||
PrimImplikantCollection* globalPIC = new PrimImplikantCollection();
|
PrimImplikantCollection* globalPIC = new PrimImplikantCollection();
|
||||||
vector<string>* variables = new vector<string>();
|
vector<string>* variables = new vector<string>();
|
||||||
|
|
||||||
|
rewind(input);
|
||||||
CParser* parser = new CParser(input, error, list);
|
CParser* parser = new CParser(input, error, list);
|
||||||
bool parseFailure = parser->yyparse(globalPIC, variables) != 0;
|
int parseFailure = parser->yyparse(globalPIC, variables);
|
||||||
|
|
||||||
fclose(input);
|
|
||||||
fclose(error);
|
|
||||||
fclose(list);
|
|
||||||
delete parser;
|
delete parser;
|
||||||
|
|
||||||
if (parseFailure)
|
if (parseFailure != 0)
|
||||||
{
|
{
|
||||||
pause();
|
fileChosen = false;
|
||||||
return;
|
string error = "Error while parsing the input (";
|
||||||
|
char buf[5];
|
||||||
|
_itoa_s(parseFailure, buf, 10);
|
||||||
|
error += buf;
|
||||||
|
error += ")";
|
||||||
|
perror(error.c_str());
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize Cells
|
// initialize Cells
|
||||||
|
@ -114,7 +139,7 @@ void user_main(void)
|
||||||
Wertetabelle* wt = new Wertetabelle(allCells, variables);
|
Wertetabelle* wt = new Wertetabelle(allCells, variables);
|
||||||
wt->Print();
|
wt->Print();
|
||||||
|
|
||||||
KV* kv = new KV(globalPIC, allCells, 30,variables);
|
kv = new KV(globalPIC, allCells, 30,variables);
|
||||||
kv->Print(30);
|
kv->Print(30);
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,16 +149,34 @@ void user_main(void)
|
||||||
|
|
||||||
// print Wertetabelle and KV of corrected data
|
// print Wertetabelle and KV of corrected data
|
||||||
wt->Print();
|
wt->Print();
|
||||||
delete wt;
|
|
||||||
|
|
||||||
kv->Print(30 + kv->width() + 30, 30); // Diagramm neben dem vorherigen
|
kv->Print(30 + kv->width() + 30, 30); // Diagramm neben dem vorherigen
|
||||||
delete kv;
|
|
||||||
|
kv->Buttons();
|
||||||
|
|
||||||
|
delete wt;
|
||||||
|
wt = NULL;
|
||||||
|
|
||||||
globalPIC->Dispose();
|
globalPIC->Dispose();
|
||||||
allCells->Dispose();
|
|
||||||
delete globalPIC;
|
delete globalPIC;
|
||||||
|
globalPIC = NULL;
|
||||||
|
|
||||||
|
allCells->Dispose();
|
||||||
delete allCells;
|
delete allCells;
|
||||||
|
allCells = NULL;
|
||||||
delete variables;
|
delete variables;
|
||||||
cout << endl << endl << endl << endl;
|
variables = NULL;
|
||||||
return;
|
break;}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (kv->StopProcess())
|
||||||
|
{
|
||||||
|
if (kv != NULL)
|
||||||
|
delete kv;
|
||||||
|
kv = NULL;
|
||||||
|
_fcloseall();
|
||||||
|
fileChosen = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -3,11 +3,13 @@
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
#include "PrimImplikantCollection.h"
|
#include "PrimImplikantCollection.h"
|
||||||
#include "..\..\GDE_3_2008\graphics\graphicfunctions.h"
|
#include "..\..\GDE_3_2008\graphics\graphicfunctions.h"
|
||||||
|
#include "Tools.h"
|
||||||
#include "KV.h"
|
#include "KV.h"
|
||||||
|
|
||||||
extern uint dimension;
|
extern uint dimension;
|
||||||
extern uint numElements;
|
extern uint numElements;
|
||||||
extern bool KNF;
|
extern bool KNF;
|
||||||
|
extern bool fileChosen;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -26,6 +28,9 @@ void KV::Print(uint offset)
|
||||||
}
|
}
|
||||||
void KV::Print(uint offsetX, uint offsetY)
|
void KV::Print(uint offsetX, uint offsetY)
|
||||||
{
|
{
|
||||||
|
if (this->numVarX == 0 || this->numVarY == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
this->offsetX = offsetX;
|
this->offsetX = offsetX;
|
||||||
this->offsetY = offsetY;
|
this->offsetY = offsetY;
|
||||||
|
|
||||||
|
@ -112,7 +117,7 @@ void KV::PrintVariables() // Erstellt die Werte der Variablen in der ersten X- u
|
||||||
{
|
{
|
||||||
uint XL = w * (this->edgeLength + 1) + this->VarY_Length;
|
uint XL = w * (this->edgeLength + 1) + this->VarY_Length;
|
||||||
uint XR = XL + this->edgeLength;
|
uint XR = XL + this->edgeLength;
|
||||||
char* value = this->Binary(w ^ (w / 2), this->numVarX); // in Gray und String umwandeln
|
char* value = Tools::BinaryToChars(w ^ (w / 2), this->numVarX); // in Gray und String umwandeln
|
||||||
this->TextBoxBold(XL, 0, XR, this->VarX_Length, 10, BLACK, TRANS, TRANS, SINGLE_LINE|CENTER_ALIGN|BOTTOM_ALIGN, value);
|
this->TextBoxBold(XL, 0, XR, this->VarX_Length, 10, BLACK, TRANS, TRANS, SINGLE_LINE|CENTER_ALIGN|BOTTOM_ALIGN, value);
|
||||||
delete value;
|
delete value;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +127,7 @@ void KV::PrintVariables() // Erstellt die Werte der Variablen in der ersten X- u
|
||||||
{
|
{
|
||||||
uint YT = h * (this->edgeLength + 1) + this->VarX_Length + 1;
|
uint YT = h * (this->edgeLength + 1) + this->VarX_Length + 1;
|
||||||
uint YB = YT + this->edgeLength;
|
uint YB = YT + this->edgeLength;
|
||||||
char* value = this->Binary(h ^ (h / 2), this->numVarY); // in Gray und String umwandeln
|
char* value = Tools::BinaryToChars(h ^ (h / 2), this->numVarY); // in Gray und String umwandeln
|
||||||
this->TextBoxBold(0, YT, this->VarY_Length-5, YB, 10, BLACK, TRANS, TRANS, SINGLE_LINE|RIGHT_ALIGN|VCENTER_ALIGN, value);
|
this->TextBoxBold(0, YT, this->VarY_Length-5, YB, 10, BLACK, TRANS, TRANS, SINGLE_LINE|RIGHT_ALIGN|VCENTER_ALIGN, value);
|
||||||
delete value;
|
delete value;
|
||||||
}
|
}
|
||||||
|
@ -148,21 +153,23 @@ void KV::PrintCellValues() // Erstellt die Werte der jeweiligen Zellen: ▯▯
|
||||||
/*
|
/*
|
||||||
char* I = new char[(int)(ceil(log10((float)numElements)))+1];
|
char* I = new char[(int)(ceil(log10((float)numElements)))+1];
|
||||||
itoa(i, I, 10);
|
itoa(i, I, 10);
|
||||||
this->TextBox(XL, YT, XR, YB, 10, BLACK, TRANSPARENT, TRANSPARENT, CENTER, I);
|
this->TextBox(XL, YT, XR, YB, 10, BLACK, TRANS, TRANS, CENTER, I);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Dies sind die Zellwerte:
|
// Dies sind die Zellwerte:
|
||||||
|
///*
|
||||||
char* I = new char[2];
|
char* I = new char[2];
|
||||||
_itoa_s(this->allCells->at(i)->value, I, 2, 10);
|
_itoa_s(this->allCells->at(i)->value, I, 2, 10);
|
||||||
this->TextBox(XL, YT, XR, YB, 10, BLACK, TRANS, TRANS, CENTER, I);
|
this->TextBox(XL, YT, XR, YB, 10, BLACK, TRANS, TRANS, CENTER, I);
|
||||||
delete I;
|
delete I;
|
||||||
|
//*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KV::PrintPrimImplikanten()
|
void KV::PrintPrimImplikanten()
|
||||||
{
|
{
|
||||||
srand(time(NULL) ^ rand());
|
srand((uint)time(NULL) ^ rand());
|
||||||
vector<KV_PiGroup*> piGroups;
|
vector<KV_PiGroup*> piGroups;
|
||||||
|
|
||||||
for (uint i = 0; i < this->globalPic->size(); i++) // for each PrimImplikant
|
for (uint i = 0; i < this->globalPic->size(); i++) // for each PrimImplikant
|
||||||
|
@ -268,7 +275,34 @@ void KV::PrintPrimImplikantenGroup(KV_PiGroup* &group, char random, uint &color)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void KV::Buttons()
|
||||||
|
{
|
||||||
|
int b, h, x, y;
|
||||||
|
|
||||||
|
get_drawarea(&b, &h);
|
||||||
|
|
||||||
|
textbox(b-120, h-40, b-5, h-5, 12, BLACK, GREY, RGB(50,50,50), SINGLE_LINE|VCENTER_ALIGN|CENTER_ALIGN, "Restart");
|
||||||
|
textbox(b-240, h-40, b-125, h-5, 12, BLACK, GREY, RGB(50,50,50), SINGLE_LINE|VCENTER_ALIGN|CENTER_ALIGN, "Other file");
|
||||||
|
updatescr();
|
||||||
|
|
||||||
|
while (
|
||||||
|
!(mouseclick(&x,&y) == 1 && (y > h-40 && y < h-5) && (
|
||||||
|
(x > b-120 && x < b-5) ||
|
||||||
|
(x > b-240 && x < b-125)
|
||||||
|
)))
|
||||||
|
{
|
||||||
|
printf(".");
|
||||||
|
if(stopProcess())break;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ((x > b-240 && x < b-125) && (y > h-40 && y < h-5))
|
||||||
|
fileChosen = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KV::StopProcess()
|
||||||
|
{
|
||||||
|
return (bool)stopProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,22 +331,3 @@ void KV::Rechteck(uint x1, uint y1, uint x2, uint y2, int cframe, int cfill)
|
||||||
{
|
{
|
||||||
rectangle(x1 + this->offsetX + 1, y1 + this->offsetY + 1, x2 + this->offsetX + 1, y2 + this->offsetY + 1, cframe, cfill);
|
rectangle(x1 + this->offsetX + 1, y1 + this->offsetY + 1, x2 + this->offsetX + 1, y2 + this->offsetY + 1, cframe, cfill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// convert the binary representation of x to a string with the specified length
|
|
||||||
char* KV::Binary(uint x, char length)
|
|
||||||
{
|
|
||||||
// warning: this breaks for numbers with more than 64 bits (= variables)
|
|
||||||
char* c = new char[length+1];
|
|
||||||
c += length; // last char
|
|
||||||
|
|
||||||
*c = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
*--c = '0' + (x & 1); // 0 or 1 at the specified position
|
|
||||||
x >>= 1;
|
|
||||||
} while (--length);
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -10,10 +12,6 @@ extern uint dimension;
|
||||||
extern uint numElements;
|
extern uint numElements;
|
||||||
extern bool KNF;
|
extern bool KNF;
|
||||||
|
|
||||||
|
|
||||||
#ifndef _KV_H
|
|
||||||
#define _KV_H
|
|
||||||
|
|
||||||
class KV
|
class KV
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -22,6 +20,9 @@ public:
|
||||||
uint width(); // Gibt die Breite eines KV-Diagramms zurück (widthPx)
|
uint width(); // Gibt die Breite eines KV-Diagramms zurück (widthPx)
|
||||||
uint height(); // Gibt die Höhe eines KV-Diagramms zurück (heightPx)
|
uint height(); // Gibt die Höhe eines KV-Diagramms zurück (heightPx)
|
||||||
|
|
||||||
|
void Buttons();
|
||||||
|
bool StopProcess();
|
||||||
|
|
||||||
// Konstruktor
|
// Konstruktor
|
||||||
KV(PrimImplikantCollection* globalPic, CellCollection* allCells, uint size, vector<string>* &variables)
|
KV(PrimImplikantCollection* globalPic, CellCollection* allCells, uint size, vector<string>* &variables)
|
||||||
: edgeLength(size),
|
: edgeLength(size),
|
||||||
|
@ -71,6 +72,7 @@ private:
|
||||||
|
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
void Line(uint x1, uint y1, uint x2, uint y2, int color); // Zeichnet eine Linie mit Offset
|
void Line(uint x1, uint y1, uint x2, uint y2, int color); // Zeichnet eine Linie mit Offset
|
||||||
void Text(uint x, uint y, uint size, int color, int bkcolor, int angle, int align, char* theText); // Zeichnet einen Text mit Offset
|
void Text(uint x, uint y, uint size, int color, int bkcolor, int angle, int align, char* theText); // Zeichnet einen Text mit Offset
|
||||||
void KV::TextBox(uint x1, uint y1, uint x2, uint y2, uint size, int ctext, int cframe, int cfill, int flags, char* theText); // Zeichnet eine TextBox mit Offset
|
void KV::TextBox(uint x1, uint y1, uint x2, uint y2, uint size, int ctext, int cframe, int cfill, int flags, char* theText); // Zeichnet eine TextBox mit Offset
|
||||||
|
@ -82,4 +84,3 @@ private:
|
||||||
|
|
||||||
|
|
||||||
#define CENTER SINGLE_LINE|CENTER_ALIGN|VCENTER_ALIGN
|
#define CENTER SINGLE_LINE|CENTER_ALIGN|VCENTER_ALIGN
|
||||||
#endif
|
|
Loading…
Reference in a new issue