~ubuntu-branches/ubuntu/vivid/ardour/vivid-proposed

« back to all changes in this revision

Viewing changes to gtk2_ardour/tempo_lines.cc

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler, Jaromír Mikeš, Felipe Sateler
  • Date: 2014-05-22 14:39:25 UTC
  • mfrom: (29 sid)
  • mto: This revision was merged to the branch mainline in revision 30.
  • Revision ID: package-import@ubuntu.com-20140522143925-vwqfo9287pmkrroe
Tags: 1:2.8.16+git20131003-3
* Team upload

[ Jaromír Mikeš ]
* Add -dbg package

[ Felipe Sateler ]
* Upload to experimental

Show diffs side-by-side

added added

removed removed

Lines of Context:
146
146
                        }
147
147
 
148
148
                        xpos = rint(((nframes64_t)(*i).frame) / (double)frames_per_unit);
149
 
                        if (inserted_last_time && !_lines.empty()) {
150
 
                                li = _lines.lower_bound(xpos); // first line >= xpos
151
 
                        }
 
149
 
 
150
                        li = _lines.lower_bound(xpos); // first line >= xpos
152
151
                             
153
152
                        line = (li != _lines.end()) ? li->second : NULL;
154
153
                        assert(!line || line->property_x1() == li->first);
215
214
                                // Create a new line
216
215
                        } else if (_lines.size() < needed || _lines.size() < MAX_CACHED_LINES) {
217
216
                                //cout << "*** CREATING LINE" << endl;
218
 
                                assert(_lines.find(xpos) == _lines.end());
219
 
                                line = new ArdourCanvas::SimpleLine (*_group);
220
 
                                line->property_x1() = xpos;
221
 
                                line->property_x2() = xpos;
222
 
                                line->property_y1() = 0.0;
223
 
                                line->property_y2() = _height;
224
 
                                line->property_color_rgba() = color;
225
 
                                _lines.insert(make_pair(xpos, line));
226
 
                                inserted_last_time = true;
 
217
                                if (_lines.find(xpos) == _lines.end()) {
 
218
                                        line = new ArdourCanvas::SimpleLine (*_group);
 
219
                                        line->property_x1() = xpos;
 
220
                                        line->property_x2() = xpos;
 
221
                                        line->property_y1() = 0.0;
 
222
                                        line->property_y2() = _height;
 
223
                                        line->property_color_rgba() = color;
 
224
                                        _lines.insert(make_pair(xpos, line));
 
225
                                        inserted_last_time = true;
 
226
                                }
227
227
 
228
228
                                // Steal from the left
229
229
                        } else {
230
230
                                //cout << "*** STEALING FROM LEFT" << endl;
231
 
                                assert(_lines.find(xpos) == _lines.end());
232
 
                                Lines::iterator steal = _lines.begin();
233
 
                                line = steal->second;
234
 
                                _lines.erase(steal);
235
 
                                line->property_color_rgba() = color;
236
 
                                line->property_x1() = xpos;
237
 
                                line->property_x2() = xpos;
238
 
                                _lines.insert(make_pair(xpos, line));
239
 
                                inserted_last_time = true; // search next time
240
 
                                invalidated = true;
241
 
                               
242
 
                                // Shift clean range right
243
 
                                _clean_left = max(_clean_left, steal->first);
244
 
                                _clean_right = max(_clean_right, xpos);
 
231
                                if (_lines.find(xpos) == _lines.end()) {
 
232
                                        Lines::iterator steal = _lines.begin();
 
233
                                        line = steal->second;
 
234
                                        _lines.erase(steal);
 
235
                                        line->property_color_rgba() = color;
 
236
                                        line->property_x1() = xpos;
 
237
                                        line->property_x2() = xpos;
 
238
                                        _lines.insert(make_pair(xpos, line));
 
239
                                        inserted_last_time = true; // search next time
 
240
                                        invalidated = true;
 
241
                                        
 
242
                                        // Shift clean range right
 
243
                                        _clean_left = max(_clean_left, steal->first);
 
244
                                        _clean_right = max(_clean_right, xpos);
 
245
                                }
245
246
                        }
246
247
 
247
248
                        break;