Skip to content
This repository was archived by the owner on May 2, 2021. It is now read-only.

Commit

Permalink
#9 Merge branch 'issue/QM-9'
Browse files Browse the repository at this point in the history
Automatic update
  • Loading branch information
Tae Won Ha committed Apr 5, 2013
2 parents b8923a1 + 3248afc commit a7f8acc
Show file tree
Hide file tree
Showing 29 changed files with 546 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "tbcacao"]
path = tbcacao
url = git@github.com:qvacua/tbcacao.git
[submodule "sparke"]
path = sparke
url = git://github.com/andymatuschak/Sparkle.git
129 changes: 125 additions & 4 deletions Qmind.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Qmind/QMAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

#import <Cocoa/Cocoa.h>

static NSString *const qBundleVersionKey = @"CFBundleVersion";
static NSString *const qDefaultsVersionKey = @"Version";

/**
* The NSApp delegate.
*
Expand All @@ -18,4 +21,12 @@
@property (weak) IBOutlet NSMenuItem *insertNewChildNodeMenuItem;
@property (weak) IBOutlet NSMenuItem *insertNewLeftChildNodeMenuItem;

@property (unsafe_unretained) IBOutlet NSWindow *preferencesWindow;

@property NSUserDefaults *userDefaults;
@property NSBundle *mainBundle;
@property NSDocumentController *documentController;

- (IBAction)showPreferencesWindow:(id)sender;

@end
39 changes: 33 additions & 6 deletions Qmind/QMAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,28 @@
*/

#import "QMAppDelegate.h"
#import "TBCacao/TBCacao.h"

@implementation QMAppDelegate

@synthesize insertNewChildNodeMenuItem = _insertNewChildNodeMenuItem;
@synthesize insertNewLeftChildNodeMenuItem = _insertNewLeftChildNodeMenuItem;
TB_MANUALWIRE(userDefaults)
TB_MANUALWIRE(mainBundle)
TB_MANUALWIRE(documentController)

#pragma mark IBActions
- (IBAction)showPreferencesWindow:(id)sender {
[self.preferencesWindow makeKeyAndOrderFront:self];
}

#pragma mark NSObject
- (id)init {
self = [super init];
if (self) {
[[TBContext sharedContext] autowireSeed:self];
}

return self;
}

#pragma mark NSApplicationDelegate
- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {
Expand All @@ -23,17 +40,27 @@ - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender {
}

- (void)applicationDidFinishLaunching:(NSNotification *)notification {
NSInteger currentVersion = [[self.mainBundle objectForInfoDictionaryKey:qBundleVersionKey] integerValue];
[self readPreferencesWithCurrentVersion:currentVersion];

#ifdef DEBUG
NSString *template = [NSString stringWithFormat:@"%@%@", NSHomeDirectory(), @"/Projects/qmind/Meta/TestFiles/%d.mm"];

int count = 7;

for (int i = 6; i < count; i++) {
[[NSDocumentController sharedDocumentController]
openDocumentWithContentsOfURL:[NSURL fileURLWithPath:[NSString stringWithFormat:template, i]]
display:YES error:nil];
[self.documentController openDocumentWithContentsOfURL:[NSURL fileURLWithPath:[NSString stringWithFormat:template, i]] display:YES error:nil];
}
#endif
}

#pragma mark Private
- (void)readPreferencesWithCurrentVersion:(NSInteger)currentVersion {
NSInteger versionOfDefaults = [self.userDefaults integerForKey:qDefaultsVersionKey];

if (versionOfDefaults == 0) {
// user defaults does not exist
[self.userDefaults setInteger:currentVersion forKey:qDefaultsVersionKey];
}
}

@end
9 changes: 5 additions & 4 deletions Qmind/QMCellDrawer.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
@implementation QMCellDrawer

TB_BEAN
TB_AUTOWIRE_WITH_INSTANCE_VAR(textLayoutManager, _textLayoutManager)
TB_AUTOWIRE_WITH_INSTANCE_VAR(cellLayoutManager, _cellLayoutManager)
TB_AUTOWIRE_WITH_INSTANCE_VAR(textDrawer, _textDrawer)
TB_AUTOWIRE_WITH_INSTANCE_VAR(settings, _settings)

TB_AUTOWIRE(textLayoutManager)
TB_AUTOWIRE(cellLayoutManager)
TB_AUTOWIRE(textDrawer)
TB_AUTOWIRE(settings)

#pragma mark Public
- (void)drawContentForCell:(QMCell *)cell rect:(NSRect)dirtyRect {
Expand Down
2 changes: 1 addition & 1 deletion Qmind/QMCellEditor.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ @implementation QMCellEditor {
QShadowedView *_containerView;
}

TB_MANUALWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_MANUALWIRE(settings)

@synthesize view = _view;
@synthesize delegate = _delegate;
Expand Down
2 changes: 1 addition & 1 deletion Qmind/QMCellLayoutManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@implementation QMCellLayoutManager

TB_BEAN
TB_AUTOWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_AUTOWIRE(settings)

#pragma mark Public
- (QMCellRegion)regionOfCell:(QMCell *)cell atPoint:(NSPoint)locationInView {
Expand Down
4 changes: 2 additions & 2 deletions Qmind/QMCellSizeManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
@implementation QMCellSizeManager

TB_BEAN
TB_AUTOWIRE_WITH_INSTANCE_VAR(textLayoutManager, _textLayoutManager)
TB_AUTOWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_AUTOWIRE(textLayoutManager)
TB_AUTOWIRE(settings)

#pragma mark Public
- (NSSize)sizeOfCell:(QMCell *)cell {
Expand Down
2 changes: 1 addition & 1 deletion Qmind/QMCellStateManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
- (BOOL)hasSelectedCells;
- (QMCell *)objectInSelectedCellsAtIndex:(NSUInteger)index;
- (void)addCellToSelection:(QMCell *)cellToAdd modifier:(NSUInteger)modifier;
- (void)removeCellFromSelection:(QMCell *)cellToRemove modifier:(int)modifier;
- (void)removeCellFromSelection:(QMCell *)cellToRemove modifier:(NSUInteger)modifier;
- (void)clearSelection;

- (void)clearCellsForDrag;
Expand Down
2 changes: 1 addition & 1 deletion Qmind/QMCellStateManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ - (void)addCellToSelection:(QMCell *)cellToAdd modifier:(NSUInteger)modifier {
[self addSingleCell:cellToAdd];
}

- (void)removeCellFromSelection:(QMCell *)cellToRemove modifier:(int)modifier {
- (void)removeCellFromSelection:(QMCell *)cellToRemove modifier:(NSUInteger)modifier {
if (modifier & NSCommandKeyMask & NSShiftKeyMask) {
// both modifiers
return;
Expand Down
10 changes: 5 additions & 5 deletions Qmind/QMDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ @implementation QMDocument {
QMDocumentWindowController *_windowController;
}

TB_MANUALWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_MANUALWIRE_WITH_INSTANCE_VAR(mindmapReader, _mindmapReader)
TB_MANUALWIRE_WITH_INSTANCE_VAR(mindmapWriter, _mindmapWriter)
TB_MANUALWIRE(settings)
TB_MANUALWIRE(mindmapReader)
TB_MANUALWIRE(mindmapWriter)

@synthesize windowController = _windowController;

Expand All @@ -40,8 +40,8 @@ - (void)copyItemsToPasteboard:(NSArray *)items {
}

- (void)cutItemsToPasteboard:(NSArray *)items {
id const anyItem = [items lastObject];
QMNode *parent = [anyItem parent];
QMNode *anyItem = [items lastObject];
QMNode *parent = anyItem.parent;

[_windowController clearSelection:self];

Expand Down
6 changes: 3 additions & 3 deletions Qmind/QMDocumentWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ @implementation QMDocumentWindowController {
CGFloat _lastIconsPaneWidth;
}

TB_MANUALWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_MANUALWIRE_WITH_INSTANCE_VAR(iconManager, _iconManager)
TB_MANUALWIRE(settings)
TB_MANUALWIRE(iconManager)

@synthesize mindmapView = _mindmapView;
@synthesize availableIconsArray = _availableIconsArray;
Expand Down Expand Up @@ -89,7 +89,7 @@ - (void)updateCellWithIdentifier:(id)identifier withNewLeftChild:(id)childIdenti

#pragma mark IBActions
- (IBAction)zoomByMode:(id)sender {
int clickedSegment = [sender selectedSegment];
NSInteger clickedSegment = [sender selectedSegment];

switch (clickedSegment) {
case 0:
Expand Down
4 changes: 2 additions & 2 deletions Qmind/QMFontConverter.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ @implementation QMFontConverter {
}

TB_BEAN
TB_AUTOWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_AUTOWIRE_WITH_INSTANCE_VAR(fontManager, _fontManager)
TB_AUTOWIRE(settings)
TB_AUTOWIRE(fontManager)

#pragma mark Public
- (NSFont *)fontFromFontAttrDict:(NSDictionary *)fontAttrDict {
Expand Down
5 changes: 4 additions & 1 deletion Qmind/QMManualBeanProvider.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ + (NSArray *)beanContainers {

if (manualBeans == nil) {
manualBeans = @[
[TBBeanContainer beanContainerWithBean:[NSFontManager sharedFontManager]]
[TBBeanContainer beanContainerWithBean:[NSFontManager sharedFontManager]],
[TBBeanContainer beanContainerWithBean:[NSUserDefaults standardUserDefaults]],
[TBBeanContainer beanContainerWithBean:[NSBundle mainBundle]],
[TBBeanContainer beanContainerWithBean:[NSDocumentController sharedDocumentController]],
];
}

Expand Down
4 changes: 2 additions & 2 deletions Qmind/QMMindmapReader.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#import "QMRootNode.h"

static NSString * const qMapKey = @"map";
static NSString * const qVersionKey = @"version";
static NSString * const qDefaultsVersionKey = @"version";
static NSString * const qNodeKey = @"node";

@implementation QMMindmapReader {
Expand Down Expand Up @@ -53,7 +53,7 @@ - (void)parser:(NSXMLParser *)parser

if ([elementName isEqualToString:qMapKey]) {
// This is the map node which contains everything
NSString *version = [attributeDict objectForKey:qVersionKey];
NSString *version = [attributeDict objectForKey:qDefaultsVersionKey];
log4Debug(@"MindMap version: %@", version);

return;
Expand Down
2 changes: 0 additions & 2 deletions Qmind/QMMindmapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ static const int qDeleteAllIconsMenuItemTag = 1100;
#pragma mark NSResponder
- (void)keyDown:(NSEvent *)theEvent;
- (void)mouseDown:(NSEvent *)event;
- (void)mouseDragged:(NSEvent *)event;
- (void)mouseUp:(NSEvent *)event;
- (void)scrollWheel:(NSEvent *)event;
- (void)magnifyWithEvent:(NSEvent *)event;
- (BOOL)acceptsFirstResponder;
Expand Down
8 changes: 4 additions & 4 deletions Qmind/QMMindmapView.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ @implementation QMMindmapView {
NSUInteger _mouseDownModifier;
}

TB_MANUALWIRE_WITH_INSTANCE_VAR(cellSelector, _cellSelector)
TB_MANUALWIRE_WITH_INSTANCE_VAR(cellLayoutManager, _cellLayoutManager)
TB_MANUALWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_MANUALWIRE_WITH_INSTANCE_VAR(uiDrawer, _uiDrawer)
TB_MANUALWIRE(cellSelector)
TB_MANUALWIRE(cellLayoutManager)
TB_MANUALWIRE(settings)
TB_MANUALWIRE(uiDrawer)

@synthesize dataSource = _dataSource;
@synthesize rootCell = _rootCell;
Expand Down
6 changes: 3 additions & 3 deletions Qmind/QMMindmapViewDataSourceImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ @implementation QMMindmapViewDataSourceImpl {
__weak QMMindmapView *_view;
}

TB_MANUALWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_MANUALWIRE_WITH_INSTANCE_VAR(iconManager, _iconManager)
TB_MANUALWIRE(settings)
TB_MANUALWIRE(iconManager)

#pragma mark Public
- (BOOL)mindmapView:(QMMindmapView *)mindmapView isItemLeft:(id)item {
Expand Down Expand Up @@ -105,7 +105,7 @@ - (void)mindmapView:(QMMindmapView *)mindmapView deleteIconOfItem:(id)item atInd
}

- (void)mindmapView:(QMMindmapView *)mindmapView deleteAllIconsOfItem:(id)item {
[self doInsideUndoGroup:NSLocalizedString(@"undo.node.icon.delete", @"Delete Icon") usingBlock:^{
[self doInsideUndoGroup:NSLocalizedString(@"undo.node.icon.all.delete", @"Delete Icon") usingBlock:^{
[_doc deleteAllIconsOfItem:item];
}];
}
Expand Down
2 changes: 1 addition & 1 deletion Qmind/QMMindmapWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@implementation QMMindmapWriter

TB_BEAN
TB_AUTOWIRE_WITH_INSTANCE_VAR(fontConverter, _fontConverter)
TB_AUTOWIRE(fontConverter)

#pragma mark Public
- (NSData *)dataForRootNode:(QMRootNode *)rootNode {
Expand Down
2 changes: 1 addition & 1 deletion Qmind/QMTextLayoutManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @implementation QMTextLayoutManager {
}

TB_BEAN
TB_AUTOWIRE_WITH_INSTANCE_VAR(settings, _settings)
TB_AUTOWIRE(settings)

#pragma mark Public
- (CGFloat)widthOfString:(NSString *)string {
Expand Down
8 changes: 6 additions & 2 deletions Qmind/Qmind-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SUFeedURL</key>
<string>http://qvacua.com/qmind/appcast.xml</string>
<key>SUPublicDSAKeyFile</key>
<string>sparkle-pub.pem</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDocumentTypes</key>
Expand Down Expand Up @@ -42,11 +46,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.1.0</string>
<string>0.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>15</string>
<string>16</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>
Expand Down
12 changes: 12 additions & 0 deletions Qmind/Resources/sparkle-pub.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-----BEGIN PUBLIC KEY-----
MIIBtzCCASsGByqGSM44BAEwggEeAoGBAOlzzBvZj77sIuH3M0UXswch8coQOl9R
nbyfZDaiU19Treuh0T3xtWCcL3wf8vaCnD9ITTmjYmigJy9w9EHeqa5/z/MN11Vo
sHSjrTQ7yejmSM8P+SQlImPQC3QoQkxtHvocwJTjriDQQspOaoOIvCMTNeYwy8Wh
ESF6ARwfqVJHAhUAlZkcLRR1a148vjIC7DwYQPNZ1bkCgYAZBdblHvHv2xq286La
lV/E6dzpcSOV5cF53KBbPyyhmteqUQwmGBs9vSrH5WfI7xVRMILb3dGLTmFPa9ZJ
VwaN0SGG8TWEcoaI4O2YfHiFwmGN1NfggnOi8J8peldFu2vap6OwdiNNGH5jwVu+
atFX70UkFzKh39OuvdJVFLkYSQOBhQACgYEAu3DYq91S9AHGWhBMObRNUTisbcVx
czAXiMqiTog3l+jPyaALOe7ocEvWB5OtTAk3o40Rp01JtLytXce+UqecjS6J1bOH
AaUK0XyMSiAfv8f8ghfWHAFsy53HAh9IU8DTVx3lTqpYtymTSVkiEeNEffDr6Nfu
QvtgWdK215ATy3o=
-----END PUBLIC KEY-----
2 changes: 2 additions & 0 deletions Qmind/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

"undo.node.icon.add" = "Insert Icon";
"undo.node.icon.delete" = "Delete Icon";
"undo.node.icon.all.delete" = "Delete All Icons";

"delete.node.icon" = "Delete %@";
"delete.node.icon.generic" = "Delete Icon";
"delete.node.unsupported.icon" = "Unsupported Icon";


Loading

0 comments on commit a7f8acc

Please sign in to comment.