Changeset 89522f27a66031ffc1904084a1ab36ceb0d09bb2

Show
Ignore:
Timestamp:
11/01/09 21:02:25 (4 years ago)
Author:
Armin Burgmeier <armin@…>
git-author:
Benjamin Herr <ben@0x539.de> / 2009-11-01T20:04:40Z+0100
Parents:
9b62f6365de4d1740ae510df93023079d3ff3cd2
Children:
e78b79d23d374130c9b81ead5d63732d830f1614
git-committer:
Armin Burgmeier <armin@arbur.net> / 2009-11-01T21:02:25Z+0100
Message:

Added "draw spaces" option

2009-11-01 Benjamin Herr <ben@…>

  • code/core/preferences.hpp:
  • code/core/preferences.cpp: Added view.whitespace_display option.
  • code/dialogs/preferences-dialog.hpp:
  • code/dialogs/preferences-dialog.cpp: Added a corresponding widget to the View pane in the preferences dialog.
  • code/core/docwindow.hpp:
  • code/core/docwindow.cpp: Honor the setting.
  • configure.ac: Require gtksourceview-2.0 >= 2.4 since gtk_source_view_set_draw_spaces() is available only since this version.
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r9b62f63 r89522f2  
     12009-11-01  Benjamin Herr  <ben@0x539.de> 
     2 
     3        * code/core/preferences.hpp: 
     4        * code/core/preferences.cpp: Added view.whitespace_display option. 
     5 
     6        * code/dialogs/preferences-dialog.hpp: 
     7        * code/dialogs/preferences-dialog.cpp: Added a corresponding widget to 
     8        the View pane in the preferences dialog. 
     9 
     10        * code/core/docwindow.hpp: 
     11        * code/core/docwindow.cpp: Honor the setting. 
     12 
     13        * configure.ac: Require gtksourceview-2.0 >= 2.4 since 
     14        gtk_source_view_set_draw_spaces() is available only since this 
     15        version. 
     16 
    1172009-10-31  Armin Burgmeier  <armin@arbur.net> 
    218 
  • code/core/docwindow.cpp

    re861d03 r89522f2  
    189189                sigc::mem_fun(*this, 
    190190                              &DocWindow::on_bracket_highlight_changed)); 
    191  
     191        m_preferences.view.whitespace_display.signal_changed().connect( 
     192                sigc::mem_fun(*this, 
     193                              &DocWindow::on_whitespace_display_changed)); 
    192194        m_preferences.appearance.font.signal_changed().connect( 
    193195                sigc::mem_fun(*this, &DocWindow::on_font_changed)); 
     
    215217        gtk_source_buffer_set_highlight_matching_brackets( 
    216218                m_buffer, m_preferences.view.bracket_highlight); 
     219        gtk_source_view_set_draw_spaces( 
     220                m_view, m_preferences.view.whitespace_display); 
    217221        const Pango::FontDescription& desc = m_preferences.appearance.font; 
    218222        gtk_widget_modify_font( 
     
    500504} 
    501505 
     506void Gobby::DocWindow::on_whitespace_display_changed() 
     507{ 
     508        gtk_source_view_set_draw_spaces( 
     509                m_view, m_preferences.view.whitespace_display); 
     510} 
     511 
    502512void Gobby::DocWindow::on_font_changed() 
    503513{ 
  • code/core/docwindow.hpp

    re861d03 r89522f2  
    107107        void on_margin_pos_changed(); 
    108108        void on_bracket_highlight_changed(); 
     109        void on_whitespace_display_changed(); 
    109110 
    110111        void on_font_changed(); 
  • code/core/preferences.cpp

    rd932cb3 r89522f2  
    2020#include "core/preferences.hpp" 
    2121 
     22// TODO: Support direct enum config storage via context specialization for 
     23// enums. 
    2224Gobby::Preferences::User::User(Config::ParentEntry& entry): 
    2325        name(entry.get_value<Glib::ustring>("name", Glib::get_user_name())), 
     
    6567        margin_pos(entry.get_value<unsigned int>("margin-position", 80) ), 
    6668        bracket_highlight(entry.get_value<bool>( 
    67                 "highlight-matching-brackets", true)) 
     69                "highlight-matching-brackets", true)), 
     70        whitespace_display(static_cast<GtkSourceDrawSpacesFlags>( 
     71                entry.get_value<int>("display-whitespace", 0))) 
    6872{ 
    6973} 
     
    7781        entry.set_value("margin-position", margin_pos); 
    7882        entry.set_value("highlight-matching-brackets", bracket_highlight); 
     83        entry.set_value("display-whitespace", 
     84                        static_cast<int>(whitespace_display)); 
    7985} 
    8086 
  • code/core/preferences.hpp

    r6b79c69 r89522f2  
    2323 
    2424#include "features.hpp" 
     25 
     26#include <gtksourceview/gtksourceview.h> 
    2527 
    2628#include <gtkmm/toolbar.h> 
     
    131133                Option<unsigned int> margin_pos; 
    132134                Option<bool> bracket_highlight; 
     135                Option<GtkSourceDrawSpacesFlags> whitespace_display; 
    133136        }; 
    134137 
  • code/dialogs/preferences-dialog.cpp

    rd9e7c10 r89522f2  
    402402        m_group_margin(_("Right Margin") ), 
    403403        m_group_bracket(_("Bracket Matching") ), 
     404        m_group_spaces(_("Whitespace Display") ), 
    404405        m_btn_wrap_text(_("Enable text wrapping") ), 
    405406        m_btn_wrap_words(_("Do not split words over two lines") ), 
     
    408409        m_btn_margin_display(_("Display right margin") ), 
    409410        m_lbl_margin_pos(_("Right margin at column:") ), 
    410         m_btn_bracket_highlight(_("Highlight matching bracket") ) 
     411        m_btn_bracket_highlight(_("Highlight matching bracket") ), 
     412        m_cmb_spaces_display(preferences.view.whitespace_display) 
    411413{ 
    412414        Gtk::WrapMode mode = preferences.view.wrap_mode; 
     
    453455                       preferences.view.bracket_highlight); 
    454456 
     457        m_cmb_spaces_display.add( 
     458                _("Display no whitespace"), 
     459                static_cast<GtkSourceDrawSpacesFlags>(0)); 
     460        m_cmb_spaces_display.add( 
     461                _("Display spaces"), 
     462                static_cast<GtkSourceDrawSpacesFlags>( 
     463                        GTK_SOURCE_DRAW_SPACES_SPACE | 
     464                        GTK_SOURCE_DRAW_SPACES_NBSP)); 
     465        m_cmb_spaces_display.add( 
     466                _("Display tabs"), 
     467                static_cast<GtkSourceDrawSpacesFlags>( 
     468                        GTK_SOURCE_DRAW_SPACES_TAB)); 
     469        m_cmb_spaces_display.add( 
     470                _("Display tabs and spaces"), 
     471                static_cast<GtkSourceDrawSpacesFlags>( 
     472                        GTK_SOURCE_DRAW_SPACES_SPACE | 
     473                        GTK_SOURCE_DRAW_SPACES_NBSP | 
     474                        GTK_SOURCE_DRAW_SPACES_TAB)); 
     475        m_cmb_spaces_display.show(); 
     476 
    455477        m_box_margin_pos.set_spacing(6); 
    456478        m_box_margin_pos.set_sensitive(margin_display); 
     
    475497        m_group_bracket.add(m_btn_bracket_highlight); 
    476498        m_group_bracket.show(); 
    477          
     499 
     500        m_group_spaces.add(m_cmb_spaces_display); 
     501        m_group_spaces.show(); 
     502 
    478503        add(m_group_wrap); 
    479504        add(m_group_linenum); 
     
    481506        add(m_group_margin); 
    482507        add(m_group_bracket); 
     508        add(m_group_spaces); 
    483509} 
    484510 
  • code/dialogs/preferences-dialog.hpp

    rd9e7c10 r89522f2  
    187187                Group m_group_margin; 
    188188                Group m_group_bracket; 
     189                Group m_group_spaces; 
    189190 
    190191                Gtk::CheckButton m_btn_wrap_text; 
     
    201202 
    202203                Gtk::CheckButton m_btn_bracket_highlight; 
     204                PreferencesComboBox<GtkSourceDrawSpacesFlags> 
     205                        m_cmb_spaces_display; 
    203206        }; 
    204207 
  • configure.ac

    rd451ded r89522f2  
    3737AM_CONDITIONAL(WIN32, test x$win32 = xtrue) 
    3838 
    39 required_libs="libxml++-2.6 glibmm-2.4 >= 2.16.0 giomm-2.4 >= 2.16.4 gtkmm-2.4 >= 2.12.0 glib-2.0 >= 2.18.0 gthread-2.0 gtksourceview-2.0" 
     39required_libs="libxml++-2.6 glibmm-2.4 >= 2.16.0 giomm-2.4 >= 2.16.4 gtkmm-2.4 >= 2.12.0 glib-2.0 >= 2.18.0 gthread-2.0 gtksourceview-2.0 >= 2.4" 
    4040 
    4141# Check if we are running on OS X, for special link handling.