1 |
/* |
/* |
2 |
Copyright (c) 2014-2016 Christian Schoenebeck |
Copyright (c) 2014-2017 Christian Schoenebeck |
3 |
|
|
4 |
This file is part of "gigedit" and released under the terms of the |
This file is part of "gigedit" and released under the terms of the |
5 |
GNU General Public License version 2. |
GNU General Public License version 2. |
68 |
m_vm = NULL; |
m_vm = NULL; |
69 |
#endif |
#endif |
70 |
|
|
71 |
|
if (!Settings::singleton()->autoRestoreWindowDimension) { |
72 |
|
set_default_size(800, 700); |
73 |
|
set_position(Gtk::WIN_POS_MOUSE); |
74 |
|
} |
75 |
|
|
76 |
// depending on GTK version and installed themes, there may be different |
// depending on GTK version and installed themes, there may be different |
77 |
// icons, and different names for them, so for each type of icon we use, |
// icons, and different names for them, so for each type of icon we use, |
78 |
// we provide a list of possible icon names, the first one found to be |
// we provide a list of possible icon names, the first one found to be |
344 |
} |
} |
345 |
|
|
346 |
static void getIteratorsForIssue(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::ParserIssue& issue, Gtk::TextBuffer::iterator& start, Gtk::TextBuffer::iterator& end) { |
static void getIteratorsForIssue(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::ParserIssue& issue, Gtk::TextBuffer::iterator& start, Gtk::TextBuffer::iterator& end) { |
347 |
start = txtbuf->get_iter_at_line_index(issue.firstLine - 1, issue.firstColumn - 1); |
Gtk::TextBuffer::iterator itLine = |
348 |
|
txtbuf->get_iter_at_line_index(issue.firstLine - 1, 0); |
349 |
|
const int charsInLine = itLine.get_bytes_in_line(); |
350 |
|
start = txtbuf->get_iter_at_line_index( |
351 |
|
issue.firstLine - 1, |
352 |
|
// check we are not getting past the end of the line here, otherwise Gtk crashes |
353 |
|
issue.firstColumn - 1 < charsInLine ? issue.firstColumn - 1 : charsInLine - 1 |
354 |
|
); |
355 |
end = start; |
end = start; |
356 |
end.forward_lines(issue.lastLine - issue.firstLine); |
end.forward_lines(issue.lastLine - issue.firstLine); |
357 |
end.forward_chars( |
end.forward_chars( |
362 |
} |
} |
363 |
|
|
364 |
static void applyCodeTag(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::VMSourceToken& token, Glib::RefPtr<Gtk::TextBuffer::Tag>& tag) { |
static void applyCodeTag(Glib::RefPtr<Gtk::TextBuffer>& txtbuf, const LinuxSampler::VMSourceToken& token, Glib::RefPtr<Gtk::TextBuffer::Tag>& tag) { |
365 |
Gtk::TextBuffer::iterator itStart = |
Gtk::TextBuffer::iterator itLine = |
366 |
txtbuf->get_iter_at_line_index(token.firstLine(), token.firstColumn()); |
txtbuf->get_iter_at_line_index(token.firstLine(), 0); |
367 |
|
const int charsInLine = itLine.get_bytes_in_line(); |
368 |
|
Gtk::TextBuffer::iterator itStart = txtbuf->get_iter_at_line_index( |
369 |
|
token.firstLine(), |
370 |
|
// check we are not getting past the end of the line here, otherwise Gtk crashes |
371 |
|
token.firstColumn() < charsInLine ? token.firstColumn() : charsInLine - 1 |
372 |
|
); |
373 |
Gtk::TextBuffer::iterator itEnd = itStart; |
Gtk::TextBuffer::iterator itEnd = itStart; |
374 |
const int length = token.text().length(); |
const int length = token.text().length(); |
375 |
itEnd.forward_chars(length); |
itEnd.forward_chars(length); |