/*=== OnOK() ========================================================= Description: If in view mode, just dismisses the window. Otherwise, saves data from screen to PREPAYMENT table Arguments: none Returns: nothing Modifies: nothing Calls: galInsertPrepayment() galUpdatePrepayment() Called By: Event Handler History: 5/13/99 SRH Initial implementation ===================================================================*/ void CPrepaymentAdd::OnOK() { GAL_ERROR Error; GAL_PREPAYMENT lpObject; int RetVal = ABP_SUCCESS; if (m_Mode != View) { if (UpdateData()) { lpObject = galNewPrepayment(); galUnsetPrepayment(lpObject, &Error); if ((RetVal = SetDatabaseFields(lpObject)) == ABP_SUCCESS) { if (m_Mode == Add) { if (galInsertPrepayment(m_hAPI, lpObject, &Error) == GAL_FAILURE) { GuiError(__FILE__, __LINE__, "galInsertPrepayment failed."); RetVal = ABP_FAILURE; return; } } else if (m_Mode == Modify) { if (galUpdatePrepayment(m_hAPI, lpObject, &Error) == GAL_FAILURE) { GuiError(__FILE__, __LINE__, "galUpdatePrepayment failed."); RetVal = ABP_FAILURE; return; } } if (RetVal != ABP_FAILURE) { SetModify(FALSE); } } galDeleteObjects(lpObject); } else //DENqa04506 { SetModify(TRUE); return; } } if (RetVal != ABP_FAILURE) { CDialog::OnOK(); } }
void CArborEdit::DDV_Date( void ) { if( EditStyleIs( EDIT_DATE ) ) { CString ControlText; // Extract the text from the exit control and then GetWindowText(ControlText); if( !ControlText.IsEmpty()) // the text is not empty { //we have to re-format Date on case if Date = "x/x/xx" //otherwise ValidateDate() function return FALSE COleDateTime oleDate; //TCHAR year[5]; if( !ParseDate( ControlText, oleDate )) { //Tuning this up in CAMqa77746 CGuiMsg::GuiMessage( GUIMSG_DATE_INVALID , MB_ICONEXCLAMATION ); SetSel( 0, -1 ); SetFocus(); AfxThrowUserException(); } if ( oleDate.GetStatus() == COleDateTime::invalid ) // invalid date { CGuiMsg::GuiMessage( GUIMSG_DATE_INVALID , MB_ICONEXCLAMATION ); SetSel( 0, -1 ); SetFocus( ); AfxThrowUserException(); } char strdate[GAL_DATE_LEN]; Arb_date CDate; CDate.year = oleDate.GetYear(); CDate.month = oleDate.GetMonth(); CDate.day = oleDate.GetDay(); strcpy(strdate,Arbdate_to_string(&CDate,ArbI18N::GetSysDateFmt())); CString Text = CString(strdate); SetWindowText(Text); SetModify( TRUE ); //SetWindowText(ControlText); SetModify( TRUE ); } } }
void __fastcall TMDIChild::actNewVersionExecute(TObject *Sender) { m_WorkSpace->GetFileManager()->CreateNew(); lvWorkSpace->ItemIndex = lvWorkSpace->Items->Count - 1; LoadCurWork(); SetModify(); }
void COXMaskedEdit::SetPromptSymbol(TCHAR chNewPromptSymbol) { // The prompt symbol must be a valid edit box symbol. ASSERT( (chNewPromptSymbol != chNULL) && (chNewPromptSymbol != chCR) && (chNewPromptSymbol != chLF) && (chNewPromptSymbol != 127)); if((chNewPromptSymbol != chNULL) && (chNewPromptSymbol != chCR) && (chNewPromptSymbol != chLF) && (chNewPromptSymbol != 127)) { // Just for the heck of it, if the prompt symbol changes, // go through and replace the existing prompts with the new prompt. CMaskData* pobjData=NULL; for(POSITION pos=m_listData.GetHeadPosition(); pos;) { pobjData=m_listData.GetNext(pos); if(pobjData->IsInputData()) { if(pobjData->m_chValue==m_chPromptSymbol) pobjData->m_chValue=chNewPromptSymbol; } } m_chPromptSymbol=chNewPromptSymbol; } // Don't update the insertion point if just setting the prompt symbol. Update(-1); if(::IsWindow(GetSafeHwnd())) SetModify(FALSE); }
void XMLProc::createNew(){ xmlItem i; xml.setContent(QString("<?xml version = '1.0' encoding = 'UTF-8'?>\n")); //setModified( true ); xml.appendChild( xml.implementation().createDocumentType("Конфигурация",QString::null,"")); rootnode = xml.createElement( md_root ); xml.appendChild( rootnode ); rootnode = xml.documentElement(); cfginfo = insert( rootnode, md_info, QString::null, -1 ); iface = insert( rootnode, md_interface, QString::null, -1 ); md = insert( rootnode, md_metadata, QString::null, -1 ); actions = insert( rootnode, md_actions, QString::null, -1 ); init(); setInfo( md_info_name, "Новая конфигурация" ); setInfo( md_info_lastid, "0" ); setInfo( md_info_author, "NetWorm" ); setInfo( md_info_date, QDateTime::currentDateTime().date().toString(Qt::ISODate) ); //setInfo( md_info_dir, "newConfig" ); insert( md, md_globals, QString::null, -1 ); insert( md, md_spravochniki, QString::null, -1 ); insert( md, md_documents, QString::null, -1 ); insert( md, md_journals, QString::null, -1 ); i = insert( md, md_registers, QString::null, -1 ); insert( i, md_iregisters, QString::null, -1 ); insert( i, md_aregisters, QString::null, -1 ); SetModify(true); }
void TMDIChild::DeleteCurClass() { int index = GetCurParseClassIndex(); m_WorkSpace->GetClassManager()->DeleteClass(index); RefreshAllClassView(); m_ParseTree->BindClass(NULL); SetModify(); }
void CNumEdit::AddSpin(float Delta) { GetText(); // freshen value before incrementing it m_Val += Delta; SetText(); NotifyParent(); SetModify(); // otherwise kill focus cancels edit }
void __fastcall TMDIChild::actChangeCommentExecute(TObject *Sender) { if(tvParseTree->Selected == NULL) return; ParseTreeNode * curParseTree = (ParseTreeNode *)tvParseTree->Selected->Data; ChangeNodeName(curParseTree, true, 1); SetModify(); RefreshAllClassView(); }
void __fastcall TMDIChild::actEditSourceExecute(TObject *Sender) { if(SourceEditFrm->EditSource(GetWorkSpace(), m_WorkSpace->GetClassManager(), gBasicSrc, false)) { m_SourceLoader.LoadFromStringList(SourceEditFrm->memSrcFile->Lines, m_WorkSpace->GetClassManager()); m_ParseTree->BindClass(NULL); RefreshAllClassView(); SetModify(); } }
void TMDIChild::InitFrm(WorkSpace * workSpace, IParseEngine * engine) { m_ParseEngine = engine; m_WorkSpace = workSpace; m_WorkSpace->GetFileManager()->BindView(lvWorkSpace); m_bTreeModify = false; m_WorkSpace->Open(); SetModify(); //初始化 m_ParseTree = new ParseTree(m_ParseEngine, m_WorkSpace->GetClassManager()); if(lvWorkSpace->Items->Count == 0) { actNewVersionExecute(NULL); } else { lvWorkSpace->ItemIndex = 0; LoadCurWork(); } //绑定树控件 m_ParseTree->BindView(tvParseTree->Items); m_bFastParseMode = false; m_FastParsePos = 0; String structName = workSpace->GetStructName(); if(structName != "") { bool needAddStruct = true; for(int i=0; i<workSpace->GetClassManager()->GetClassCount(); i++) { if(workSpace->GetClassManager()->GetClassDataByIndex(i)->GetName() == structName) { needAddStruct = false; break; } } if(needAddStruct) { ClassData *curClass = m_WorkSpace->GetClassManager()->AddClass(); curClass->Init(structName, workSpace->GetComment()); int index = m_WorkSpace->GetClassManager()->GetClassIndexByClassData(curClass); RefreshAllClassView(); lvAllClasses->ItemIndex = index; lvAllClassesClick(NULL); } } }
void XMLProc::setInfo(const QString &name, const QString &value) { xmlItem i; i = cfginfo.namedItem( name ).toElement(); if (i.isNull()) { i = xml.createElement( name ); cfginfo.appendChild( i ); } setText(i, value); SetModify(true); }
void XMLProc::setAttr(xmlItem context, const QString &name, const QString &value) { QString v = value; if ( objClass( context ) == md_field && name == mda_type ) { if ( v.section(" ", 1).isEmpty() ) v.append(" 0 0 *"); if ( v.section(" ", 2).isEmpty() ) v.append(" 0 *"); if ( v.section(" ", 3).isEmpty() ) v.append(" *"); } context.setAttribute( name, v ); SetModify(true); }
void XMLProc::setText(xmlItem context, const QString &value) { QDomText t; if (context.isNull()) return; while (!context.firstChild().isNull()) { context.removeChild( context.firstChild() ); } t = xml.createTextNode( value ); context.appendChild( t ); SetModify(true); }
//--------------------------------------------------------------------------- void __fastcall TMDIChild::actChangeFileDescribeExecute(TObject *Sender) { FileStruct * curFileStruct = m_WorkSpace->GetFileManager()->GetFileData(lvWorkSpace->ItemIndex); if(curFileStruct) { EditFileDescribeFrm->EditFileStructDescribe(curFileStruct); SetFileDescribe(curFileStruct); m_WorkSpace->GetFileManager()->RefreshView(); SetModify(); } }
xmlItem XMLProc::insert(xmlItem context, const QString &otype, const QString &name, long id) { xmlItem i; if ( id==0 ) id = nextID(); i = xml.createElement( otype ); if ( id >= 100 ) setAttr(i, mda_id, id ); if ( !name.isNull()) setAttr(i, mda_name, name ); context.appendChild(i); if ( id > 0 ) idcache.insert(id, new ItemContaner(id,i) ); SetModify(true); return i; }
void __fastcall TMDIChild::actOpenListFromTxtExecute(TObject *Sender) { //从txt格式导入列表 if(OpenDialog1->Execute()) { if(OpenFileCheck(OpenDialog1->FileName)) { TxtToListLoader txtToListLoader; txtToListLoader.LoadTxtFile(OpenDialog1->FileName, "\t", GetCurParseClass()); m_HexEditor->LoadFromStream(txtToListLoader.GetOutPutStream()); } SetModify(); } }
void RichEdit::Styles() { NextUndo(); StyleManager s; s.Setup(ffs, unit); s.Set(text); if(s.Execute() != IDOK || !s.IsChanged()) return; SaveStylesUndo(); SetModify(); s.Get(text); ReadStyles(); Finish(); }
void XMLProc::remove(xmlItem context) { long id; xmlItem child; QDomNode own = context.parentNode(); if (!own.isNull()) { id = attr( context, mda_id ).toLong(); child = firstChild(context); remove(child); idcache.remove( id ); own.removeChild(context); SetModify(true); } }
LRESULT CScriptEditView::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& ) { LRESULT lRet = DefWindowProc( uMsg, wParam, lParam ); if( lRet != -1 ) { m_font = AtlGetDefaultGuiFont(); SetFont( m_font ); SetOptions( ECOOP_OR, ECO_SELECTIONBAR ); SetTabStopWidth(); SetEventMask( GetEventMask() | ENM_CHANGE ); SetModify( FALSE ); } return lRet; }
void __fastcall TMDIChild::actDelVersionExecute(TObject *Sender) { if(lvWorkSpace->ItemIndex < 0) return; if(lvWorkSpace->Items->Count == 1) { m_ActiveFileStruct->SetDateTime(SPGetCurrentTime()); m_ActiveFileStruct->GetMemory()->Clear(); m_HexEditor->LoadFromStream(m_ActiveFileStruct->GetMemory()); m_WorkSpace->GetFileManager()->RefreshView(); SetModify(); return; } int curIndex = lvWorkSpace->ItemIndex - 1; m_WorkSpace->GetFileManager()->DeleteVersion(lvWorkSpace->ItemIndex); if(curIndex < 0) curIndex = 0; lvWorkSpace->ItemIndex = curIndex; m_ActiveFileStruct = NULL; LoadCurWork(); SetModify(); }
void COXMaskedEdit::Update(int nSelectionStart/*=0*/) { // Update the edit control if it exists. if(::IsWindow(m_hWnd)) { m_nSetTextSemaphor++; CString sText=ShowMask(); SetWindowText(sText); m_nSetTextSemaphor--; SetModify(TRUE); // We usually need to update the insertion point. if(nSelectionStart>=0) UpdateInsertionPointForward(nSelectionStart); } }
int XMLProc::ReadXML(const QString &fname){ QFile file( fname ); QByteArray buf; QString err; int errLine = 0, errColumn = 0; if ( !file.open( QIODevice::ReadOnly ) ) return RC_ERROR; buf = file.readAll(); file.close(); xml.setContent( QString("") ); if ( !xml.setContent( buf, false, &err, &errLine, &errColumn ) ) { return RC_ERROR; } init(); //CHECK_POINT SetModify(false); //CHECK_POINT return RC_OK; }
void SCH_SCREEN::DeleteItem( SCH_ITEM* aItem ) { wxCHECK_RET( aItem, wxT( "Cannot delete invalid item from screen." ) ); SetModify(); if( aItem->Type() == SCH_SHEET_PIN_T ) { // This structure is attached to a sheet, get the parent sheet object. SCH_SHEET_PIN* sheetPin = (SCH_SHEET_PIN*) aItem; SCH_SHEET* sheet = sheetPin->GetParent(); wxCHECK_RET( sheet, wxT( "Sheet label parent not properly set, bad programmer!" ) ); sheet->RemovePin( sheetPin ); return; } else { delete m_drawList.Remove( aItem ); } }
LRESULT CFilterEdit::OnPaste(WPARAM, LPARAM) { if (OpenClipboard()) { HANDLE hData = GetClipboardData (CF_TEXT); CString toInsert((const char*)GlobalLock(hData)); GlobalUnlock(hData); CloseClipboard(); // elimate control chars, especially newlines toInsert.Replace(_T('\t'), _T(' ')); // only insert first line toInsert.Replace(_T('\r'), _T('\n')); int pos = 0; toInsert = toInsert.Tokenize(_T("\n"), pos); toInsert.Trim(); // get the current text CString text; GetWindowText(text); // construct the new text int from, to; GetSel(from, to); text.Delete(from, to - from); text.Insert(from, toInsert); from += toInsert.GetLength(); // update & notify controls SetWindowText(text); SetSel(from, from, FALSE); SetModify(TRUE); GetParent()->SendMessage(WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(), EN_CHANGE), (LPARAM)GetSafeHwnd()); } return 0; }
void __fastcall TMDIChild::actDelCurNodeExecute(TObject *Sender) { if(tvParseTree->Selected == NULL) return; ParseTreeNode * curParseTree = (ParseTreeNode *)tvParseTree->Selected->Data; ClassData * curClass = GetCurParseClass(); if(curClass == NULL) return; if(curParseTree == NULL) { //选择的是结构体 DeleteCurClass(); curClass = NULL; DeleteCurClass(); } else { //选择的是变量 if(curParseTree->GetParent() == NULL) { //只能够删除成员变量 curClass->DeleteMember(curParseTree->GetClassMember()); if(curClass->GetMemberDataCount() == 0) { DeleteCurClass(); } else { m_ParseTree->BindClass(curClass); ExpandFirstNode(); ParseData(); } } } SetModify(); }
bool CScriptEditView::DoFileSave() { ATLASSERT( m_szFilePath[0] != 0 ); if( !GetModify() ) return true; bool bRet = SaveFile( m_szFilePath ); if( bRet ) { SetModify( FALSE ); } else { AtlMessageBox( WtlGetMainWnd(), IDS_WRITE_FILE_FAILED, IDR_MAINFRAME, MB_OK|MB_ICONERROR ); } return bRet; }
//--------------------------------------------------------------------------- void TMDIChild::LoadFromFile(String fileName) { m_HexEditor->LoadFromFile(fileName); SetModify(); }
void COXMaskedEdit::SetMask(LPCTSTR pszMask) { if(pszMask==NULL) { pszMask=_T(""); } DeleteContents(); CMaskData* pobjData=NULL; for(LPCTSTR pszInsertionPoint=pszMask; *pszInsertionPoint; pszInsertionPoint++) { TCHAR chNew=*pszInsertionPoint; pobjData=new CMaskData(); m_listData.AddTail(pobjData); switch(chNew) { case chMaskPlaceholderDECIMALSEPARATOR : pobjData->m_eType =MaskDataTypeDECIMALSEPARATOR ; pobjData->m_chValue=m_chIntlDecimal ; break; case chMaskPlaceholderTHOUSANDSSEPARATOR: pobjData->m_eType =MaskDataTypeTHOUSANDSSEPARATOR; pobjData->m_chValue=m_chIntlThousands ; break; case chMaskPlaceholderTIMESEPARATOR : pobjData->m_eType =MaskDataTypeTIMESEPARATOR ; pobjData->m_chValue=m_chIntlTime ; break; case chMaskPlaceholderDATESEPARATOR : pobjData->m_eType =MaskDataTypeDATESEPARATOR ; pobjData->m_chValue=m_chIntlDate ; break; case chMaskPlaceholderDIGIT : pobjData->m_eType =MaskDataTypeDIGIT ; pobjData->m_chValue=m_chPromptSymbol ; break; case chMaskPlaceholderALPHANUMERIC : pobjData->m_eType =MaskDataTypeALPHANUMERIC ; pobjData->m_chValue=m_chPromptSymbol ; break; case chMaskPlaceholderALPHABETIC : pobjData->m_eType =MaskDataTypeALPHABETIC ; pobjData->m_chValue=m_chPromptSymbol ; break; case chMaskPlaceholderALPHABETICUPPER : pobjData->m_eType =MaskDataTypeALPHAETICUPPER ; pobjData->m_chValue=m_chPromptSymbol ; break; case chMaskPlaceholderALPHABETICLOWER : pobjData->m_eType =MaskDataTypeALPHAETICLOWER ; pobjData->m_chValue=m_chPromptSymbol ; break; case chMaskPlaceholderCHARACTER : pobjData->m_eType =MaskDataTypeCHARACTER ; pobjData->m_chValue=m_chPromptSymbol ; break; case chMaskPlaceholderLITERALESCAPE : // It is the next character that is inserted. pszInsertionPoint++; chNew=*pszInsertionPoint; if(chNew) { pobjData->m_eType =MaskDataTypeLITERALESCAPE ; pobjData->m_chValue=chNew ; break; } // If there is no character following the escape, // just treat the escape as a literal so that the user // will see the problem. default: // Everything else is just a literal. pobjData->m_eType =MaskDataTypeLITERAL ; pobjData->m_chValue=chNew ; break; } } ASSERT(GetMask()==pszMask); Update(); if(::IsWindow(GetSafeHwnd())) SetModify(FALSE); }
BOOL CArborEdit::OnKillfocus() { // check to see if the control was modified at all....if so continue if( GetModify() ) { // check to see if any value has been entered into the control.... if( GetWindowTextLength() ) { //CAMqa72199 Wasabi - check for non-JIS chars in text field //Note that this code disallows extended Japanese characters //which are used in some proper names CString ControlText; if (ArbI18N::IsJapanese() || ArbI18N::IsBidi() ) { GetWindowText(ControlText); int ctl = ControlText.GetLength(); int cursor = 0; bool ok = true; while ((cursor < ctl) && ok) { TCHAR c = ControlText[cursor]; if (IsDBCSLeadByteEx(932, c)) { cursor++; //skip trail byte if in a double byte char //CAMqa77746 applying CAMqa70838 - delete the non-JIS character check } cursor++; } if (!ok) { AfxMessageBox(GetIntlString(IDS_GUI_MSG_INVALID_INPUT_CHAR), MB_ICONERROR); SetSel( 0, -1 ); SetFocus(); AfxThrowUserException(); } } //CAMqa72199 End Japanese-only processing if( EditStyleIs(EDIT_CURRENCY) || EditStyleIs(EDIT_FLOAT) ) { double dTemp = GetDoubleValue(); LPTSTR buff = new char[80]; FloatToString( buff, dTemp) ; SetWindowText(buff); SetModify( TRUE ); delete buff; } else if( EditStyleIs( EDIT_DATE ) ) { CString ControlText; // Extract the text from the exit control and then GetWindowText(ControlText); //we have to re-format Date on case if Date = "x/x/xx" //otherwise ValidateDate() function return FALSE COleDateTime oleDate; //TCHAR year[5]; if( !ParseDate( ControlText, oleDate ) || ( oleDate.GetStatus() == COleDateTime::invalid )) // invalid date { return FALSE; // no message Boxes } Arb_date CDate; char strdate[GAL_DATE_LEN]; CDate.year = oleDate.GetYear(); CDate.month = oleDate.GetMonth(); CDate.day = oleDate.GetDay(); strcpy(strdate,(CString)Arbdate_to_string(&CDate,ArbI18N::GetSysDateFmt())); CString Text = CString(strdate); SetWindowText(Text); SetModify( TRUE ); //SetWindowText(ControlText); SetModify( TRUE ); } } } return FALSE; }
static void SetRateCB(Widget w, XtPointer closure,XtPointer call_data) { char *text,*tag; float rateVal; Boolean UpdateRequired; text = XmTextFieldGetString(rate_tag); puts(text); if(ParseRateParTag(text,&tag,rate_tag,rate_dlg,cur_rpar)) { XtFree(text); return ; } tag=strdup(tag); XtFree(text); text = XmTextFieldGetString(rate_rate); if(ParseRate(text,&rateVal)) { free(tag); XtFree(text); ShowErrorDialog("Rate must be a positive number !",rate_dlg); XmProcessTraversal(rate_rate,XmTRAVERSE_CURRENT); return ; } XtFree(text); if(cur_rpar == NULL) { struct rpar_object * l_rpar; cur_rpar = (struct rpar_object *) emalloc(RPAOBJ_SIZE); cur_rpar->tag = NULL; cur_rpar->center.x = fix_x; cur_rpar->center.y = fix_y; cur_rpar->next = NULL; cur_rpar->layer = NewLayerList(CURRENTVIEWANDWHOLE,NULL); if (netobj->rpars == NULL) l_rpar = NULL; else for (l_rpar = netobj->rpars;l_rpar->next != NULL; l_rpar = l_rpar->next); if (l_rpar != NULL) l_rpar->next = cur_rpar; else netobj->rpars = cur_rpar; UpdateRequired=FALSE; } else ShowRpar(cur_rpar, CLEAR); XFlush(XtDisplay(rate_dlg)); if(UpdateRequired) { ShowRate(FALSE); } if(cur_rpar->tag != NULL) free(cur_rpar->tag); cur_rpar->tag=tag; cur_rpar->value=rateVal; if(UpdateRequired) { if (rate_visible) ShowRate(TRUE); } ShowRpar(cur_rpar, OR); ClearRes(); menu_action(); SetModify(); HideRateChangeDialog(); }