• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscapheguic翻訳omegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

TextMate is a graphical text editor for OS X 10.7+


Commit MetaInfo

Revisionc52090144cece31ea333dd9af9f213ffc608af4c (tree)
Time2012-08-24 05:41:50
AuthorAllan Odgaard <git@abet...>
CommiterAllan Odgaard

Log Message

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.

Change Summary

Incremental Difference

--- a/Frameworks/OakTextView/src/OakDocumentView.mm
+++ b/Frameworks/OakTextView/src/OakDocumentView.mm
@@ -301,7 +301,9 @@ private:
301301 - (void)takeSpellingLanguageFrom:(id)sender
302302 {
303303 [[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());
305307 }
306308
307309 - (BOOL)validateMenuItem:(NSMenuItem*)aMenuItem
--- a/Frameworks/OakTextView/src/OakTextView.mm
+++ b/Frameworks/OakTextView/src/OakTextView.mm
@@ -1702,6 +1702,8 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
17021702 - (void)setTheme:(theme_ptr const&)newTheme
17031703 {
17041704 theme = newTheme;
1705+ if(theme)
1706+ settings_t::set(kSettingsThemeKey, theme->uuid());
17051707
17061708 if(document)
17071709 {
@@ -1725,6 +1727,9 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
17251727 fontName = to_s([newFont fontName]);
17261728 fontSize = [newFont pointSize];
17271729
1730+ settings_t::set(kSettingsFontNameKey, fontName);
1731+ settings_t::set(kSettingsFontSizeKey, fontSize);
1732+
17281733 if(layout)
17291734 {
17301735 AUTO_REFRESH;
@@ -1736,12 +1741,16 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
17361741 {
17371742 AUTO_REFRESH;
17381743 if(document)
1744+ {
17391745 document->buffer().indent().set_tab_size(newTabSize);
1746+ settings_t::set(kSettingsTabSizeKey, newTabSize, document->file_type());
1747+ }
17401748 }
17411749
17421750 - (void)setShowInvisibles:(BOOL)flag
17431751 {
17441752 showInvisibles = flag;
1753+ settings_t::set(kSettingsShowInvisiblesKey, (bool)showInvisibles);
17451754 [self setNeedsDisplay:YES];
17461755 }
17471756
@@ -1751,13 +1760,17 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
17511760 {
17521761 AUTO_REFRESH;
17531762 layout->set_wrapping(flag, wrapColumn);
1763+ settings_t::set(kSettingsSoftWrapKey, (bool)flag, document->file_type());
17541764 }
17551765 }
17561766
17571767 - (void)setSoftTabs:(BOOL)flag
17581768 {
17591769 if(flag != self.softTabs)
1770+ {
17601771 document->buffer().indent().set_soft_tabs(flag);
1772+ settings_t::set(kSettingsSoftTabsKey, (bool)flag, document->file_type());
1773+ }
17611774 }
17621775
17631776 - (void)takeWrapColumnFrom:(id)sender
@@ -1771,6 +1784,7 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
17711784 // ;
17721785
17731786 wrapColumn = [sender tag];
1787+ settings_t::set(kSettingsWrapColumnKey, wrapColumn, document->file_type());
17741788 if(layout)
17751789 {
17761790 AUTO_REFRESH;