void WEXPORT MProject::readSelf( WObjectFile& p ) { if( !_recursing ) { if( p.version() < 26 ) { p.readObject( &_filename ); } _filename = p.filename(); // _filename.toLower(); setMakefile(); if( p.version() > 26 ) { p.readObject( &_before ); p.readObject( &_after ); } int icount; p.readObject( &icount ); for( int i=0; i<icount; i++ ) { WFileName tgtFilename; p.readObject( &tgtFilename ); if( p.version() < 35 ) { tgtFilename.relativeTo( _filename ); } if( !attachComponent( tgtFilename ) ) { //this line won't work; no view attached yet! //sayf( SayWarning, SayOk, "IDE Error: Unable to read target file '%s'", (const char*)tgtFilename ); } } _dirty = false; _needsMake = true; } }
void WEXPORT MComponent::readSelf( WObjectFile& p ) { WObject::readSelf( p ); if( p.version() < 26 ) { p.readObject( &_filename ); } _filename = p.filename(); // _filename.toLower(); if( p.version() < 33 ) { p.readObject( _target ); } if( p.version() < 32 ) { p.readObject( &_items ); } if( p.version() > 23 ) { p.readObject( &_mask ); if( _config->version() > 0 ) { if( _mask.size() == 3 ) { _config->setKludge( 3 ); } else if( _mask.size() == 4 ) { _config->setKludge( 4 ); } } _config->kludgeMask( _mask ); _config->zapMask( _mask ); } p.readObject( &_autodepend ); if( p.version() > 36 ) { p.readObject( &_autotrack ); } if( p.version() > 27 ) { p.readObject( &_mode ); } if( p.version() > 29 ) { p.readObject( &_before ); p.readObject( &_after ); } if( p.version() > 32 ) { p.readObject( _target ); } if( p.version() > 31 ) { p.readObject( &_items ); } if( _mask[1] == 'v' ) { //turn VP targets into MFC targets - VP targets no longer exist _mask.setChar( 1, 'm' ); WFileName fn; _filename.noPath( fn ); WString ruletag; if( _mask[0] == 'w' ) { ruletag = "WEXE"; } else { ruletag = "NEXE"; } WFileName tmp_fn( filename() ); MRule* tmp_rule = _config->findRule( ruletag ); target()->setRule( tmp_rule ); } }
void WEXPORT MItem::readSelf( WObjectFile& p ) { WFileName::readSelf( p ); p.readObject( &_ruleTag ); _rule = _config->findRule( _ruleTag ); if( !_rule ) { _rule = _config->nilRule(); } p.readObject( &_states ); if( p.version() > 24 ) { p.readObject( &_actionStates ); } _parent = (MItem*)p.readObject(); _component = (MComponent*)p.readObject(); updateAttribs(); if( p.version() > 30 ) { p.readObject( &_expanded ); } if( p.version() > 37 ) { p.readObject( &_owner ); } else { _owner = MITEM_OWNER_IDE; } if( p.version() < 28 ) { bool temp; p.readObject( &temp ); //include p.readObject( &temp ); //exclude p.readObject( &temp ); //shadow } if( p.version() < 24 ) { WString mask; p.readObject( &mask ); _component->mask() = mask; } pruneStates( _states ); //this part needs to be done after the item is completely constructed! int icount = _actionStates.count(); if( icount ) { WVList actions; addActions( actions ); for( int i=icount; i>0; ) { i--; ActionStates* astates = (ActionStates*)_actionStates[i]; if( astates->linkup( actions ) ) { pruneStates( astates->states() ); } else { delete _actionStates.removeAt( i ); } } } }
MComponent* MProject::attachComponent( WFileName& filename ) { MComponent* comp = NULL; WObjectFile ot; if( ot.open( filename, OStyleReadB ) ) { _recursing = true; if( ot.version() < 34 ) { ot.readObject( this ); comp = (MComponent*)ot.readObject(); comp->setRelFilename( filename ); _components.add( comp ); setDirty(); } else { char ident[sizeof( _targetIdent ) + 1]; ot.readObject( ident, sizeof( ident ) - 1 ); if( !streq( ident, _targetIdent ) ) { //bad file format } else { ot.readObject( this ); comp = (MComponent*)ot.readObject(); comp->setRelFilename( filename ); _components.add( comp ); setDirty(); } } _recursing = false; ot.close(); } return( comp ); }
void WEXPORT MC2Switch::readSelf( WObjectFile& p ) { MSwitch::readSelf( p ); p.readObject( &_on ); if( p.version() > 28 ) { for( int i=0; i<SWMODE_COUNT; i++ ) { p.readObject( &_state[i] ); } } else { p.readObject( &_state[SWMODE_RELEASE] ); _state[SWMODE_DEBUG] = _state[SWMODE_RELEASE]; } }
void WEXPORT MProject::writeSelf( WObjectFile& p ) { if( !_recursing ) { p.writeObject( &_before ); p.writeObject( &_after ); int icount = _components.count(); p.writeObject( icount ); for( int i=0; i<icount; i++ ) { MComponent* comp = (MComponent*)_components[i]; WFileName tgtFile( comp->relFilename() ); p.writeObject( &tgtFile, FORCE ); if( comp->isDirty() ) { if( !tryOpenTargetFile( p.version(), true, comp ) ) { p.setObjOk( false ); } } } _dirty = false; } }
void WEXPORT MState::readSelf( WObjectFile& p ) { p.readObject( &_toolTag ); _tool = _config->findTool( _toolTag ); if( !_tool ) { MRule* r = _config->findRule( _toolTag ); //temp if( r ) { _tool = r->tool(); } else { _tool = _config->nilTool(); } _toolTag = _tool->tag(); } p.readObject( &_switchTag ); _config->kludgeString( _switchTag ); FixTypo( _switchTag ); _switch = _tool->findSwitch( _switchTag ); if( p.version() > 27 ) { p.readObject( &_mode ); } }