Esempio n. 1
2
 /**
  * Constructor Method
  */
 public function __construct()
 {
     parent::__construct();
     $lang_manager = new GtkSourceLanguagesManager();
     $lang = $lang_manager->get_language_from_mime_type('application/x-php');
     $this->buffer = new GtkSourceBuffer();
     $this->buffer->set_language($lang);
     $this->buffer->set_highlight(true);
     $this->buffer->set_check_brackets(TRUE);
     $this->set_buffer($this->buffer);
     $default_font = OS == 'WIN' ? 'Courier 10' : 'Monospace 10';
     $pango = new PangoFontDescription($default_font);
     $this->modify_font($pango);
     $this->set_auto_indent(TRUE);
     $this->set_insert_spaces_instead_of_tabs(TRUE);
     $this->set_tabs_width(4);
     $this->set_show_margin(FALSE);
     $this->set_show_line_numbers(true);
     $this->set_show_line_markers(true);
     $this->set_highlight_current_line(TRUE);
     $this->set_smart_home_end(TRUE);
 }
 /**
  * Seta a linguagem do código
  * 
  * @name set_language
  * @param string $mime_type String contendo o mime type do código editado
  */
 public function set_language($mime_type)
 {
     // Cria o language manager
     $lang_manager = new GtkSourceLanguagesManager();
     // Busca a linguagem com base no mime type
     $this->__language = $lang_manager->get_language_from_mime_type($mime_type);
     // Seta a linguagem do editor
     $this->__widgets['buffer']->set_language($this->__language);
 }