void MWorkFile::dump( WFile& fil ) { MRule* rule = _item->rule(); WString& mask = _component->mask(); fil.printf( "#%FP", this ); fil.printf( ", %s:%s", (const char*)mask, (const char*)rule->tag() ); fil.printf( ", %s", (const char*)*this ); WString n; int icount = _states.count(); if( icount > 0 ) { bool first = TRUE; for( int i=0; i<icount; i++ ) { MState* st = (MState*)_states[i]; WString temp; st->sw()->getText( temp, st ); if( temp.size() > 0 ) { if( first ) n.concat( " (" ); if( !first ) n.concat( ' ' ); n.concat( temp ); first = FALSE; } } if( !first ) n.concat( ')' ); } fil.printf( " %s\n", (const char*)n ); }
void MWorkFile::makeCommand( WString& s, WVList* workFiles ) { WVList states; addStates( states ); //do we need to make this copy? MRule* rule = _item->rule(); WString& mask = _component->mask(); WFileName f( *this ); f.relativeTo( _component->filename() ); rule->makeCommand( s, &f, workFiles, mask, &states, _component->mode(), &_browseable ); }
void MConfig::addRules( WFileName& srcMask, WFileName& tgtMask, WVList& list, WString& tagMask ) { int icount = _rules.count(); for( int i=0; i<icount; i++ ) { MRule* rule = (MRule*)_rules[i]; if( rule->match( tagMask, srcMask, tgtMask ) ) { list.add( rule ); } } }
MRule* MConfig::findMatchingRule( WFileName& fn, WString& mask ) { int icount = _rules.count(); for( int i=0; i<icount; i++ ) { MRule* rule = (MRule*)_rules[i]; if( rule->match( mask, fn ) ) { return( rule ); } } return( nilRule() ); }
int MConfig::findMatchingRules( WFileName& fn, WString& mask, WVList& list ) { int icount = _rules.count(); for( int i=0; i<icount; i++ ) { MRule* rule = (MRule*)_rules[i]; if( rule->match( mask, fn ) ) { list.add( rule ); } } return( list.count() ); }
MRule* MConfig::findRule( WString& ruletag ) { int icount = _rules.count(); for( int i=0; i<icount; i++ ) { MRule* rule = (MRule*)_rules[i]; if( ruletag == rule->tag() ) { return( rule ); } } return( NULL ); }
void MItem::addActions( WFileName& fn, WVList& list ) { WVList rules; if( _config->findMatchingRules( fn, _component->mask(), rules ) ) { for( int i=0; i<rules.count(); i++ ) { MRule* r = (MRule*)rules[i]; for( int j=0; j<r->actions().count(); j++ ) { list.add( r->actions()[j] ); } } } }
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 ); } }
void MConfig::enumAccel( WObject *obj, bcbk fn ) { int icount; WKeyCode key; int i; icount = _actions.count(); for( i=0; i < icount; i++ ) { MAction *action; action = (MAction *)_actions[i]; key = action->menuAccel(); if( key != WKeyNone ) { if( (obj->*fn)( key ) ) return; } } icount = _rules.count(); for( i=0; i < icount; i++ ) { MRule *rule; rule = (MRule *)_rules[i]; if( rule->enumAccel( obj, fn ) ) return; } }