//========================================================================== bool LoggerContestLog::minosSaveFile( bool newfile ) { MinosTestExport mt( this ); stanzaCount += mt.exportAllDetails( minosContestFile, newfile ); clearDirty(); return true; }
void update() { // qDebug() << "DirtySupport::update"; if (dirtyFlags) { // qDebug() << "DirtySupport::update - updating..."; self->update(); } clearDirty(); }
void OSGNode::componentComplete() { // qDebug() << "OSGNode::componentComplete" << this; updateNode(); clearDirty(); h->complete = true; if (!h->node.valid()) { qWarning() << "OSGNode::componentComplete - node is not valid!" << this; } }
void AP_UnixDialog_Lists::runModal( XAP_Frame * pFrame) { FL_ListType savedListType; setModal(); GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); clearDirty(); // Populate the dialog m_bDontUpdate = false; loadXPDataIntoLocal(); // Need this to stop this being stomped during the contruction of preview widget savedListType = getNewListType(); // *** this is how we add the gc for Lists Preview *** // attach a new graphics context to the drawing area XAP_UnixApp * unixapp = static_cast<XAP_UnixApp *> (m_pApp); UT_ASSERT(unixapp); // Now Display the dialog, so m_wPreviewArea->window exists gtk_widget_show(m_wMainWindow); UT_ASSERT(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_wPreviewArea); m_pPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); // Restore our value setNewListType(savedListType); gint response; do { response = abiRunModalDialog (GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false); } while (response == BUTTON_RESET); AP_Dialog_Lists::tAnswer res = getAnswer(); m_glFonts.clear(); abiDestroyWidget ( mainWindow ) ; setAnswer(res); DELETEP (m_pPreviewWidget); }
bool acceptNode(osg::Node *aNode) { if (node == aNode) { return false; } int flags = dirty(); if (flags) { clearDirty(); } node = aNode; if (node) { if (flags) { setDirty(flags); } } return true; }
void AP_UnixDialog_Lists::runModeless (XAP_Frame * pFrame) { static std::pointer_to_unary_function<int, gboolean> s_update_fun = std::ptr_fun(s_update); _constructWindow (); UT_ASSERT (m_wMainWindow); clearDirty(); abiSetupModelessDialog(GTK_DIALOG(m_wMainWindow), pFrame, this, BUTTON_APPLY); connectFocusModelessOther (GTK_WIDGET (m_wMainWindow), m_pApp, &s_update_fun); // Populate the dialog updateDialog(); m_bDontUpdate = false; // Now Display the dialog gtk_widget_show(m_wMainWindow); // *** this is how we add the gc for Lists Preview *** // attach a new graphics context to the drawing area XAP_UnixApp * unixapp = static_cast<XAP_UnixApp *> (m_pApp); UT_ASSERT(unixapp); UT_ASSERT(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_wPreviewArea->window); m_pPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); // Next construct a timer for auto-updating the dialog m_pAutoUpdateLists = UT_Timer::static_constructor(autoupdateLists,this); m_bDestroy_says_stopupdating = false; // OK fire up the auto-updater for 0.5 secs m_pAutoUpdateLists->set(500); }
//========================================================================== DisplayContestContact::DisplayContestContact( BaseContestLog * ct, bool time_now ) : BaseContact( ct, time_now ), logSequence( 0 ), modificationCount( 0 ) { BaseContestLog * clp = ct; int ms = clp->maxSerial + 1; serialr.setInitialValue( std::string( SERIALLENGTH, ' ' ) ); repr.setInitialValue( "5 " ); reps.setInitialValue( "5 " ); clearDirty(); char temp[ 10 ]; sprintf( temp, "%03.3d", ms ); serials.setValue( temp ); mode.setValue( clp->mode.getValue() ); }
bool LoggerContestLog::export_contest( HANDLE expfd, ExportType exptype ) { bool ret = false; commonSave( false ); setDirty(); // We always need to export everything switch ( exptype ) { //enum ExportType {EREG1TEST, EADIF, EG0GJV, EMINOS, ESUMMARY }; case ESUMMARY: ret = exportSummary( expfd ); break; case EG0GJV: ret = exportGJV( expfd ); break; case EMINOS: ret = exportMinos( expfd ); break; case EADIF: ret = exportADIF( expfd ); break; case EKML: ret = exportKML( expfd ); break; case EREG1TEST: ret = exportREG1TEST( expfd ); break; default: return false; } clearDirty(); // BUT don't leave it dirty!! return ret; }
/*! * This method Does the stuff requested on the "action" button, "Apply" in the * Modeless dialog and "OK" in the Modal dialog. * Read comments with for all the stuff that can happen. */ void AP_Dialog_Lists::Apply(void) { gchar szStart[20]; if(!isModal() && (!isPageLists() || m_bFoldingLevelChanged)) { // // OK fold up the text according the level specified. // m_bFoldingLevelChanged = false; fl_AutoNum * pAuto = getBlock()->getAutoNum(); const gchar * props[5] = {"text-folded",NULL,"text-folded-id",NULL,NULL}; UT_UTF8String sStr = UT_UTF8String_sprintf("%d",getCurrentFold()); props[1] = sStr.utf8_str(); UT_uint32 ID = 0; if(!pAuto) { ID = getView()->getDocument()->getUID(UT_UniqueId::List); } else { ID = pAuto->getID(); } UT_UTF8String sID = UT_UTF8String_sprintf("%d",ID); props[3] = sID.utf8_str(); PT_DocPosition posLow = 0; PT_DocPosition posHigh = 0; if(getView()->isSelectionEmpty() && pAuto) { PL_StruxDocHandle sdhLow = pAuto->getFirstItem(); PL_StruxDocHandle sdhHigh = pAuto->getLastItemInHeiracy(); posLow = getView()->getDocument()->getStruxPosition(sdhLow)+1; posHigh = getView()->getDocument()->getStruxPosition(sdhHigh)+1; } else { posLow = getView()->getPoint(); posHigh = getView()->getSelectionAnchor(); if(posLow > posHigh) { PT_DocPosition posTemp = posLow; posLow = posHigh; posHigh = posTemp; } } getView()->setCollapsedRange(posLow,posHigh,props); return; } /*! * * OK this is failsafe code incase the user has changed the font but wants a * bullet list anyway. We don't let then! */ if(m_NewListType == BULLETED_LIST || m_NewListType == IMPLIES_LIST) { m_pszFont = "Symbol"; } else if(m_NewListType > DASHED_LIST && m_NewListType < OTHER_NUMBERED_LISTS) { m_pszFont = _getDingbatsFontName(); } /*! * Just to make things even more confusing this method is also used in a Modal * mannor by the styles dialog. This method is called when the users clicks "OK" * on the modal dialog. When that happens we fill an output vector with all the * properties currently defined. */ if(isModal()) { // // Fill out output vector with gchar * strings to be accessed via the calling // function. // if(m_OutProps.getItemCount() > 0) m_OutProps.clear(); sprintf(szStart,"%d",m_iStartValue); m_OutProps.addItem((void *) "start-value"); m_Output[0] = (gchar *) szStart; m_OutProps.addItem((void *) m_Output[0].c_str()); m_OutProps.addItem((void *) "list-style"); m_Output[1] = getBlock()->getListStyleString(m_NewListType); m_OutProps.addItem((void *) m_Output[1].c_str()); m_OutProps.addItem((void *) "list-delim"); m_OutProps.addItem((void *) m_pszDelim.c_str()); m_OutProps.addItem((void *) "list-decimal"); m_OutProps.addItem((void *) m_pszDecimal.c_str()); m_OutProps.addItem((void *) "field-font"); m_OutProps.addItem((void *) m_pszFont.c_str()); m_OutProps.addItem((void *) "margin-left"); m_Output[2] = UT_convertInchesToDimensionString(DIM_IN, m_fAlign, 0); m_OutProps.addItem((void *) m_Output[2].c_str()); m_OutProps.addItem((void *) "text-indent"); m_Output[3] = UT_convertInchesToDimensionString(DIM_IN, m_fIndent, 0); m_OutProps.addItem((void *) m_Output[3].c_str()); m_Answer = a_OK; return; } /*! * If the "Apply to current" radio buton is chosen we have two options. * 1. If "No list" is chosen we stop the current list at on this block. * 2. Otherwise we change the current list to the type requested here. * This piece of code changes the list style at the current point to the * Style requested by the user. */ UT_GenericVector<fl_BlockLayout*> vBlock; UT_uint32 i = 0; getView()->getBlocksInSelection(&vBlock); UT_uint32 count = vBlock.getItemCount(); getView()->cmdUnselectSelection(); if(m_bApplyToCurrent == true && m_isListAtPoint == true && m_NewListType != NOT_A_LIST) { getView()->getDocument()->beginUserAtomicGlob(); getView()->changeListStyle(getAutoNum(),m_NewListType,m_iStartValue, m_pszDelim.c_str(), m_pszDecimal.c_str(), m_pszFont.c_str(),m_fAlign,m_fIndent); if(getAutoNum() != NULL) { getAutoNum()->update(0); } getView()->getDocument()->endUserAtomicGlob(); clearDirty(); getView()->updateLayout(); getView()->setPoint(getView()->getPoint()); getView()->ensureInsertionPointOnScreen(); return; } /*! * This code stops the list at the current point. */ if ( m_isListAtPoint == true && m_NewListType == NOT_A_LIST) { getView()->getDocument()->beginUserAtomicGlob(); for(i=0;i < count; i++) { fl_BlockLayout * pBlock = (fl_BlockLayout *) vBlock.getNthItem(i); if(pBlock->isListItem() == true) { getView()->getDocument()->StopList(pBlock->getStruxDocHandle()); } } getView()->getDocument()->endUserAtomicGlob(); clearDirty(); getView()->updateLayout(); getView()->setPoint(getView()->getPoint()); getView()->ensureInsertionPointOnScreen(); return; } /*! * Start new list. 4 Possibilities. * 1. If there is a list at the current point and the user choose no list, stop * the list the current point. * * 2. start a new list with the properties given if there is not a * list at the current point. * * 3. Start a sublist at the current point if a list already exists there and * contains two or more items. * * 4. Change the list to the requested value if a list already eists but only * has one item in it. */ if(m_bStartNewList == true) { getView()->getDocument()->beginUserAtomicGlob(); for(i=0;i < count; i++) { fl_BlockLayout * pBlock2 = (fl_BlockLayout *) vBlock.getNthItem(i); if(pBlock2->isListItem() == true && m_NewListType == NOT_A_LIST) { // // This stops the current list. // if(pBlock2->isListItem() == true) { getView()->getDocument()->StopList(pBlock2->getStruxDocHandle()); } } else if ( pBlock2->isListItem() == false && m_NewListType != NOT_A_LIST ) { // // This starts the new list // pBlock2->getDocument()->disableListUpdates(); if(i == 0) { pBlock2->StartList(m_NewListType,m_iStartValue, m_pszDelim.c_str(), m_pszDecimal.c_str(), m_pszFont.c_str(), m_fAlign, m_fIndent, 0, 1); pBlock2->getDocument()->enableListUpdates(); pBlock2->getDocument()->updateDirtyLists(); } else { fl_BlockLayout * pBlock = (fl_BlockLayout *) vBlock.getNthItem(i); fl_BlockLayout * rBlock = (fl_BlockLayout *) pBlock->getPrev(); if(rBlock != NULL) { pBlock->resumeList(rBlock); pBlock->getDocument()->enableListUpdates(); } } } else if( pBlock2->getAutoNum() && (pBlock2->getAutoNum()->getNumLabels() > 1) && m_NewListType != NOT_A_LIST ) { // // This starts a sublist. // UT_uint32 curlevel = pBlock2->getLevel(); UT_uint32 currID = pBlock2->getAutoNum()->getID(); curlevel++; pBlock2->getDocument()->disableListUpdates(); // // Need to update m_fAlign and m_fIndent to reflect the higher level of indentation. // if(i == 0) { m_fAlign = m_fAlign + (float) LIST_DEFAULT_INDENT; pBlock2->StartList(m_NewListType,m_iStartValue, m_pszDelim.c_str(), m_pszDecimal.c_str(), m_pszFont.c_str(), m_fAlign, m_fIndent, currID,curlevel); pBlock2->getDocument()->enableListUpdates(); pBlock2->getDocument()->updateDirtyLists(); } else { fl_BlockLayout * pBlock = (fl_BlockLayout *) vBlock.getNthItem(i); fl_BlockLayout * rBlock = (fl_BlockLayout *) pBlock->getPrev(); if(rBlock != NULL) { pBlock->resumeList(rBlock); pBlock->getDocument()->enableListUpdates(); pBlock->getDocument()->updateDirtyLists(); } } } else if( pBlock2->getAutoNum() && (pBlock2->getAutoNum()->getNumLabels() <= 1) && m_NewListType != NOT_A_LIST ) { // // The list at the current point only has one item which is the current paragraph. // We can't share an sdh amongst two autonum's so we can't start a sublist. // We'll change the list style instead. // getView()->changeListStyle(pBlock2->getAutoNum(), m_NewListType, m_iStartValue, m_pszDelim.c_str(), m_pszDecimal.c_str(), m_pszFont.c_str(), m_fAlign, m_fIndent); if(pBlock2->getAutoNum() != NULL) { pBlock2->getAutoNum()->update(0); } } } clearDirty(); getView()->updateLayout(); getView()->setPoint(getView()->getPoint()); getView()->updateScreen(true); getView()->notifyListeners(AV_CHG_MOTION | AV_CHG_HDRFTR); getView()->getDocument()->endUserAtomicGlob(); getView()->ensureInsertionPointOnScreen(); return; } /*! * OK Attach the block at this point to the previous list of the same margin. */ if(m_bResumeList == true && m_isListAtPoint != true ) { getView()->getDocument()->beginUserAtomicGlob(); for(i=0;i < count; i++) { fl_BlockLayout * pBlock = (fl_BlockLayout *) vBlock.getNthItem(i); fl_BlockLayout * rBlock = pBlock->getPreviousListOfSameMargin(); if(rBlock != NULL) { pBlock->resumeList(rBlock); pBlock->getDocument()->enableListUpdates(); pBlock->getDocument()->updateDirtyLists(); } } getView()->getDocument()->endUserAtomicGlob(); } getView()->updateLayout(); getView()->setPoint(getView()->getPoint()); getView()->updateScreen(true); getView()->notifyListeners(AV_CHG_MOTION | AV_CHG_HDRFTR); getView()->ensureInsertionPointOnScreen(); clearDirty(); }
bool LoggerContestLog::initialise( const std::string &fn, bool newFile, int slotno ) { if ( !initialise( slotno ) ) return false; if ( TContestApp::getContestApp() ->isContestOpen( fn ) ) { return false; } // open the settings bundle files initialiseINI(); // open the LoggerContestLog file cfileName = fn; String ext = ExtractFileExt( fn.c_str() ); publishedName = ExtractFileName( fn.c_str() ).c_str(); if ( stricmp( ext.c_str(), ".gjv" ) == 0 ) { GJVFile = true; setReadOnly(); } else if ( stricmp( ext.c_str(), ".minos" ) == 0 ) { minosFile = true; } else if ( stricmp( ext.c_str(), ".log" ) == 0 ) { logFile = true; setReadOnly(); } else if ( stricmp( ext.c_str(), ".adi" ) == 0 ) { adifFile = true; setReadOnly(); } else if ( stricmp( ext.c_str(), ".edi" ) == 0 ) { ediFile = true; setReadOnly(); } else { MinosParameters::getMinosParameters() ->mshowMessage( "Not a known file type! (" + ext + ")" ); return false; } if ( !newFile ) { struct stat sbuf; if ( stat( fn.c_str(), &sbuf ) == 0 ) { if ( !( sbuf.st_mode & S_IWRITE ) ) { setReadOnly(); } } DWORD openMode = GENERIC_READ | GENERIC_WRITE; if ( isReadOnly() ) openMode = GENERIC_READ; // populate the LoggerContestLog object from the file // contest_file = open( fn.c_str(), open_mode ); HANDLE contestFile = CreateFile( fn.c_str(), openMode, FILE_SHARE_READ, 0, // security OPEN_EXISTING, FILE_FLAG_WRITE_THROUGH, 0 ); // template handle if ( contestFile == INVALID_HANDLE_VALUE ) { std::string lerr = lastError(); std::string emess = "Failed to open LoggerContestLog file " + fn + " : " + lerr; MinosParameters::getMinosParameters() ->mshowMessage( emess.c_str() ); return false; } bool loadOK = false; needExport = false; if ( GJVFile ) { GJVcontestFile = contestFile; if ( !GJVload() ) // load the header so that we can display it return false; loadOK = GJVloadContacts(); } else if ( minosFile ) { minosContestFile = contestFile; MinosTestImport mt( this ); stanzaCount = mt.importTest( minosContestFile ); if ( stanzaCount > 0 ) { // set the bundles accordingly entryBundle.openSection( entryBundleName.getValue() ); QTHBundle.openSection( QTHBundleName.getValue() ); stationBundle.openSection( stationBundleName.getValue() ); loadOK = true; } } else if ( logFile ) { logContestFile = contestFile; loadOK = importLOG( logContestFile ); needExport = true; } else if ( adifFile ) { adifContestFile = contestFile; loadOK = importAdif( adifContestFile ); needExport = true; } else if ( ediFile ) { ediContestFile = contestFile; loadOK = importReg1Test( ediContestFile ); needExport = true; } clearDirty(); // what we have just read CAN'T be dirty validateLoc(); // run_contest_dialog has already loaded the LoggerContestLog and set log_count // here, we display a "loading" box if ( isReadOnly() ) closeFile(); // to preserve file handles if ( !loadOK ) // sets ct as well { return false; } } else if ( minosFile ) { // Create a new file - they will get to change the name later HANDLE contestFile = CreateFile( fn.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, 0, // security CREATE_NEW, FILE_FLAG_WRITE_THROUGH, 0 ); // template handle if ( contestFile == INVALID_HANDLE_VALUE ) { MinosParameters::getMinosParameters() ->mshowMessage( "Failed to create file" ); return false; } if ( GJVFile ) { GJVcontestFile = contestFile; } else if ( minosFile ) { minosContestFile = contestFile; } } else { return false; } commonSave( newFile ); startScan(); // scan through all contacts return true; }