/[svn]/gigedit/trunk/src/gigedit/scripteditor.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/scripteditor.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3158 by schoenebeck, Mon May 8 18:05:35 2017 UTC revision 3225 by schoenebeck, Fri May 26 22:10:16 2017 UTC
# Line 1  Line 1 
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.
# Line 68  ScriptEditor::ScriptEditor() : Line 68  ScriptEditor::ScriptEditor() :
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
# Line 339  LinuxSampler::ScriptVM* ScriptEditor::Ge Line 344  LinuxSampler::ScriptVM* ScriptEditor::Ge
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(
# Line 350  static void getIteratorsForIssue(Glib::R Line 362  static void getIteratorsForIssue(Glib::R
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);

Legend:
Removed from v.3158  
changed lines
  Added in v.3225

  ViewVC Help
Powered by ViewVC