#include <acknex.h>
#include <default.c>
#include <windows.h>
//Array für Vokabeln fehlt
int rand;
var hDataHandle = file_open_read("VocabListGer.txt");
var hDataHandle2= file_open_read("VocabListEng.txt");
//nAllVocabs
int nAllVocabs= file_length(hDataHandle) %20;
STRING** strVokabularies;
STRING** strVokabulariesEng[30][2];
STRING* strInput;
int n;
int txtInitialize;
int nStringPanel=0;
TEXT** txtVocabs[30][2];
//Bitmaps
BMAP* bmapFieldOff = "EditFieldOff.bmp";
BMAP* bmapVocabularies = "bmapVocabularies.bmp";
BMAP* bmapOkOff = "OkOff.bmp";
BMAP* bmapOkOn = "OkOn.bmp";
BMAP* bmapCheckOff = "CheckOff.bmp";
BMAP* bmapCheckOn = "CheckOn.bmp";
BMAP* bmapNextOff = "NextOff.bmp";
BMAP* bmapNextOn = "NextOn.bmp";
BMAP* bmapNewOff = "NewOff.bmp";
BMAP* bmapNewOn = "NewOn.bmp";
//Definieren der Funktionsheader
function textInput(); //initialisiert
function check();
function new(); //initialisiert
function next();
function ok(); //initialisiert
for( n=0;n<30;n++){
rand= random(nAllVocabs-10)*20;
if(n<10){
file_seek(hDataHandle,20*n,2);
file_seek(hDataHandle2,20*n,2);
file_str_readto(hDataHandle,strVokabularies[n],NULL,20);
file_str_readto(hDataHandle2,strVokabularies[n],NULL,20);
}else{
file_seek(hDataHandle,rand,0);
file_str_readto(hDataHandle,strVokabularies[n],NULL,25);
file_seek(hDataHandle2,rand,0);
file_str_readto(hDataHandle2,strVokabulariesEng[n],NULL,25);
}
}
file_close(hDataHandle);
file_close(hDataHandle);
STRING* strWord;
STRING* strWord2;
int nLang = random(2);
int nLang2;
for(txtInitialize = 0;txtInitialize <30;txtInitialize++){
if(nLang ==0){
strWord= strVokabularies[n];
strWord2 = strVokabulariesEng[n];
}else{
strWord2= strVokabularies[n];
strWord = strVokabulariesEng[n];
}
txtVocabs[txtInitialize][0]=txt_create(1,2);
txtVocabs[txtInitialize][1]=txt_create(1,2);
txtVocabs[txtInitialize][0].pos_x = 20;
txtVocabs[txtInitialize][1].pos_y = 60 + txtInitialize*60;
set(txtVocabs[txtInitialize][0],SHOW);
txtVocabs[txtInitialize][0].pstring(strWord);
txtVocabs[txtInitialize][1].pstring(strWord2);
}
STRING* strQuestionedWord = txtVocabs[nStringPanel][0].pstring;
TEXT* txtQuestionedWord={
pos_x = 20;
pos_y = 0;
layer=3;
flags= SHOW;
string(strQuestionedWord);
}
while(1){
txtQuestionedWord.pstring(strQuestionedWord);
wait(1);
}
//Damit das aktuelle panel den String bekommt
function ok(){
if(str_cmpi(strInput, txtVocabs[nStringPanel][1].pstring)==1){
nStringPanel++;
}
}
function new(){
var hNewWord = file_open_append("VocabListGer.txt");
var hNewWord2 = file_open_append("VocabListEng.txt");
var hNumberOfWords = file_open_write("VocabCounter");
inkey(txtQuestionedWord.string);
if (inkey_active ==0){
inkey(txtInput.string);
}
file_seek(hNewWord,0,2);
file_str_write(hNewWord,txtQuestionedWord.string);
file_seek(hNewWord2,0,2);
file_str_write(hNewWord2,txtInput.string);
//file_close(hNewWord);
//file_close(hNewWord2);
}
//Die Arrays
TEXT* txtInput={
pos_x = 200;
pos_y = 0;
layer=3;
flags= SHOW;
while(1){
string(strInput);
wait(1);
}
}
STRING* strSpace =" ";//Hier muss eventuell eine while schleife hinzu
function textInput(){
var key = inkey(strInput);
if(key == 13){
process_entry(strInput);
}
if(inkey_active == 0){
while(str_len(strInput)<19){
str_cat(strInput, strSpace);
}
str_cat(strInput,",");
}
}
//Das Panel für die buttons
PANEL* Actions = {
layer = 4;
flags = SHOW;
button_toggle(50,10,bmapCheckOn, bmapCheckOff,NULL,NULL,check, NULL, NULL);
button_toggle(50,100, bmapNewOn, bmapNewOff, NULL, NULL, new, NULL, NULL);
button_toggle(50,190, bmapNextOn, bmapNextOff, NULL, NULL, next, NULL, NULL);
button_toggle(50,280, bmapOkOn, bmapOkOff, NULL, NULL,
ok, NULL, NULL);
}