TextMate is a graphical text editor for OS X 10.7+
Revision | c52090144cece31ea333dd9af9f213ffc608af4c (tree) |
---|---|
Time | 2012-08-24 05:41:50 |
Author | Allan Odgaard <git@abet...> |
Commiter | Allan Odgaard |
Sticky settings, initial commit
There is more work to do here, like also setup the Preferences window to use settings_t::set (probably via a Cocoa wrapper we can bind to), but this is a decent start and takes care of most of the reported annoyances.
@@ -301,7 +301,9 @@ private: | ||
301 | 301 | - (void)takeSpellingLanguageFrom:(id)sender |
302 | 302 | { |
303 | 303 | [[NSSpellChecker sharedSpellChecker] setLanguage:[sender representedObject]]; |
304 | - document->buffer().set_spelling_language(to_s((NSString*)[sender representedObject])); | |
304 | + std::string const language = to_s((NSString*)[sender representedObject]); | |
305 | + document->buffer().set_spelling_language(language); | |
306 | + settings_t::set(kSettingsSpellingLanguageKey, language, NULL_STR, document->path()); | |
305 | 307 | } |
306 | 308 | |
307 | 309 | - (BOOL)validateMenuItem:(NSMenuItem*)aMenuItem |
@@ -1702,6 +1702,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac | ||
1702 | 1702 | - (void)setTheme:(theme_ptr const&)newTheme |
1703 | 1703 | { |
1704 | 1704 | theme = newTheme; |
1705 | + if(theme) | |
1706 | + settings_t::set(kSettingsThemeKey, theme->uuid()); | |
1705 | 1707 | |
1706 | 1708 | if(document) |
1707 | 1709 | { |
@@ -1725,6 +1727,9 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac | ||
1725 | 1727 | fontName = to_s([newFont fontName]); |
1726 | 1728 | fontSize = [newFont pointSize]; |
1727 | 1729 | |
1730 | + settings_t::set(kSettingsFontNameKey, fontName); | |
1731 | + settings_t::set(kSettingsFontSizeKey, fontSize); | |
1732 | + | |
1728 | 1733 | if(layout) |
1729 | 1734 | { |
1730 | 1735 | AUTO_REFRESH; |
@@ -1736,12 +1741,16 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac | ||
1736 | 1741 | { |
1737 | 1742 | AUTO_REFRESH; |
1738 | 1743 | if(document) |
1744 | + { | |
1739 | 1745 | document->buffer().indent().set_tab_size(newTabSize); |
1746 | + settings_t::set(kSettingsTabSizeKey, newTabSize, document->file_type()); | |
1747 | + } | |
1740 | 1748 | } |
1741 | 1749 | |
1742 | 1750 | - (void)setShowInvisibles:(BOOL)flag |
1743 | 1751 | { |
1744 | 1752 | showInvisibles = flag; |
1753 | + settings_t::set(kSettingsShowInvisiblesKey, (bool)showInvisibles); | |
1745 | 1754 | [self setNeedsDisplay:YES]; |
1746 | 1755 | } |
1747 | 1756 |
@@ -1751,13 +1760,17 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac | ||
1751 | 1760 | { |
1752 | 1761 | AUTO_REFRESH; |
1753 | 1762 | layout->set_wrapping(flag, wrapColumn); |
1763 | + settings_t::set(kSettingsSoftWrapKey, (bool)flag, document->file_type()); | |
1754 | 1764 | } |
1755 | 1765 | } |
1756 | 1766 | |
1757 | 1767 | - (void)setSoftTabs:(BOOL)flag |
1758 | 1768 | { |
1759 | 1769 | if(flag != self.softTabs) |
1770 | + { | |
1760 | 1771 | document->buffer().indent().set_soft_tabs(flag); |
1772 | + settings_t::set(kSettingsSoftTabsKey, (bool)flag, document->file_type()); | |
1773 | + } | |
1761 | 1774 | } |
1762 | 1775 | |
1763 | 1776 | - (void)takeWrapColumnFrom:(id)sender |
@@ -1771,6 +1784,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac | ||
1771 | 1784 | // ; |
1772 | 1785 | |
1773 | 1786 | wrapColumn = [sender tag]; |
1787 | + settings_t::set(kSettingsWrapColumnKey, wrapColumn, document->file_type()); | |
1774 | 1788 | if(layout) |
1775 | 1789 | { |
1776 | 1790 | AUTO_REFRESH; |