diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 15:26:58 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-02 16:18:16 -0700 |
commit | 7f402c85eb34a739055dc3e5bb4be337169ec68c (patch) | |
tree | cbb0365029213b87f8da70b00268bf8981b9a892 /003trace.cc | |
parent | d082b17675f40037b0e6c26384d99362acd0749e (diff) | |
download | mu-7f402c85eb34a739055dc3e5bb4be337169ec68c.tar.gz |
1921 - show trace by clicking on code
Region to click on to edit is now reduced to just the menu bar for the sandbox (excluding the 'x' for deleting the sandbox). The symmetry there might be useful, but we'll see if the relative click area is in line with how commonly the actions are performed.
Diffstat (limited to '003trace.cc')
-rw-r--r-- | 003trace.cc | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/003trace.cc b/003trace.cc index 3695703a..d2afb21c 100644 --- a/003trace.cc +++ b/003trace.cc @@ -103,7 +103,7 @@ struct trace_stream { string curr_layer; int curr_depth; string dump_layer; - string collect_layer; // if set, ignore all other layers + set<string> collect_layers; // if not empty, ignore all absent layers ofstream null_stream; // never opens a file, so writes silently fail trace_stream() :curr_stream(NULL), curr_depth(0) {} ~trace_stream() { if (curr_stream) delete curr_stream; } @@ -113,13 +113,21 @@ struct trace_stream { } ostream& stream(int depth, string layer) { - if (!collect_layer.empty() && layer != collect_layer) return null_stream; + if (!is_collecting(layer)) return null_stream; curr_stream = new ostringstream; curr_layer = layer; curr_depth = depth; return *curr_stream; } + bool is_collecting(const string& layer) { + return collect_layers.empty() || collect_layers.find(layer) != collect_layers.end(); + } + + bool is_narrowly_collecting(const string& layer) { + return collect_layers.find(layer) != collect_layers.end(); + } + // be sure to call this before messing with curr_stream or curr_layer void newline() { if (!curr_stream) return; |