|
Projects > GC Project > on_apply.h |
||||
|
compilation.h compilation_defs.h exp_info.h GCMainDialog.h on_apply.h setaxis.h Download gc.exe (1.63 MB) Download VC++ 8.0 Project (54.1 KB RAR Archive) GC Help
#ifndef ON_APPLY_H #define ON_APPLY_H
void MainDialog::OnApply(){
CString CBInput; //user input is stored here
GC_FormulaCB->GetWindowText(CBInput);CBInput.Trim();
//If user did not enter anything, but there are functions in the list: if(CBInput.IsEmpty() && !CC_L.is_empty()) {GC_FormulaCB->SetCurSel(GC_FormulaCB->GetCount()-1); do_result(); draw(); return;} //If user did not enter anything and there are no functions in the list: if(CBInput.IsEmpty() && CC_L.is_empty()) {er.error("enter a function");} //If user entered a new function: else //First check if there is an exact same function in the list already: if(GC_FormulaCB->FindStringExact(-1,CBInput)==CB_ERR) { //Create a new function tree from user input: compilation * temp_comp=new compilation(CBInput);
//If 'top' member of temp_comp is zero, that means entered function is invalid //and function tree cannot be built from user input; it should be discarded. //Aproppriate error message will be posted by function that found error. if(!temp_comp->top){delete temp_comp;}
//Otherwise, new function tree is added to the compilation. //Function is also added to drop-down list and made current: else{CC_L.atb(temp_comp);
GC_FormulaCB->InsertString(GC_FormulaCB->GetCount(),CBInput); GC_FormulaCB->SetCurSel(GC_FormulaCB->GetCount()-1);}
} //If there is an exact same function, make it current: else(GC_FormulaCB->SetCurSel(GC_FormulaCB->FindStringExact(-1,CBInput))); //---------------------------------------------------------------------------------------- //If error buffer is empty, draw graph, otherwise display errors on screen: if(er.err_buffer.is_empty()){do_result();draw();} else{ int pos=2; CFont error_font; error_font.CreateFont(14,0,0,0,FW_BOLD,0,0,0,0,0,0,0,0,_T("System Font"));
memGrid.SelectObject(&error_font); memGrid.SetTextColor(RGB(0,0,128)); memGrid.FillSolidRect(0,0,GridX,GridY,RGB(255,255,255));
while(!er.err_buffer.is_empty()) { memGrid.TextOut(3,pos,er.err_buffer.first->value); er.rfo();pos+=14; } }
SendMessage(WM_PAINT);
}
#endif
compilation.h compilation_defs.h exp_info.h GCMainDialog.h on_apply.h setaxis.h Download gc.exe (1.63 MB) Download VC++ 8.0 Project (54.1 KB RAR Archive) GC Help
Copyright © Yuri Bulankov 2002
|
||||
|
Bugs/Comments: code@compilerabuse.com Copyright (C) 2001-2006 Yuri Bulankov. All rights reserved. |
||||