From 23e4ce8f1b211b388be7533b684dabab193be587 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 21 Sep 2006 16:11:02 +0000 Subject: The plain view now effectively uses command stacks, the results are pretty cool looking. --- src/viewerplain.cpp | 35 ++++++++++++++++++++++++++++------- src/viewerplain.h | 14 ++++++++++---- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/viewerplain.cpp b/src/viewerplain.cpp index d65c59d..9037a40 100644 --- a/src/viewerplain.cpp +++ b/src/viewerplain.cpp @@ -5,7 +5,6 @@ PluginInterface2( plain, ViewerPlain, Viewer, "Mike Buland", 0, 1 ); ViewerPlain::ViewerPlain() : - bCmdClean( true ), bRunClean( true ) { } @@ -16,29 +15,50 @@ ViewerPlain::~ViewerPlain() void ViewerPlain::beginCommand( Action::eAction nAct, const std::string &sTarget ) { - bCmdClean = true; - this->sTarget = sTarget; + Cmd cmd; + if( sCmd.empty() ) + cmd.nLevel = 0; + else + cmd.nLevel = sCmd.front().nLevel+1; + + cmd.bCmdClean = true; + cmd.sTarget = sTarget; + + sCmd.push_front( cmd ); } void ViewerPlain::endCommand() { - if( bCmdClean == false ) + if( sCmd.front().bCmdClean == false ) printf("\n"); + sCmd.pop_front(); +} + +void ViewerPlain::indent() +{ + if( sCmd.empty() ) return; + int jmax = sCmd.front().nLevel; + for( int j = 0; j < jmax; j++ ) + { + printf(" "); + } } void ViewerPlain::printHead() { - if( bCmdClean == true ) + if( sCmd.front().bCmdClean == true ) { bRunClean = false; - bCmdClean = false; - printf("--- %s ---\n", sTarget.c_str() ); + sCmd.front().bCmdClean = false; + indent(); + printf("--- %s ---\n", sCmd.front().sTarget.c_str() ); } } void ViewerPlain::beginRequiresCheck( bool bCached, const std::string &sName ) { printHead(); + indent(); printf(" deps: %s\n", sName.c_str() ); } @@ -49,6 +69,7 @@ void ViewerPlain::endRequiresCheck() void ViewerPlain::beginPerform( Perform *pPerform ) { printHead(); + indent(); printf(" %8s: %s\n", pPerform->getRule().c_str(), pPerform->getTarget().c_str() ); } diff --git a/src/viewerplain.h b/src/viewerplain.h index 76fecc5..118ae80 100644 --- a/src/viewerplain.h +++ b/src/viewerplain.h @@ -2,7 +2,7 @@ #define VIEWER_PLAIN_H #include - +#include #include "viewer.h" class ViewerPlain : public Viewer @@ -22,12 +22,18 @@ public: virtual void endAction(); void printHead(); + void indent(); private: - bool bCmdClean; bool bRunClean; - std::string sTarget; - + typedef struct + { + int nLevel; + bool bCmdClean; + std::string sTarget; + } Cmd; + typedef std::list CmdStack; + CmdStack sCmd; }; #endif -- cgit v1.2.3