From kirt.fitzpatrick at gmail.com Sat Mar 17 21:52:41 2007 From: kirt.fitzpatrick at gmail.com (Kirt Fitzpatrick) Date: Sat, 17 Mar 2007 14:52:41 -0700 Subject: [TxMt Plugins] sendAction Question Message-ID: I am trying to call the moveLeft method on the editor window and I don't seem to be having any luck. I am a bit of a n00b to Objective C so I assume that I must be missing something. This is what I came up with. Am I doing something wrong? SEL methodSelector = sel_registerName( "moveLeft" ); [[NSApplication sharedApplication] sendAction:methodSelector to:nil from:self]; kirt -------------- next part -------------- An HTML attachment was scrubbed... URL: From rix.rob at gmail.com Sat Mar 17 21:58:38 2007 From: rix.rob at gmail.com (Rob Rix) Date: Sat, 17 Mar 2007 17:58:38 -0400 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: Message-ID: Yes, you are doing something wrong. I don't know if -sendAction:to:from: is the best way to accomplish your goal here, but you definitely don't want to be doing sel_registerName here. Instead you want @selector as follows: [[NSApplication sharedApplication] sendAction: @selector(moveLeft:) to: nil from: self]; Notice the colon after moveLeft. Action methods always take a 'sender' argument, which is what you're supplying in the 'from:' part of sendAction:to:from:. See file:///Developer/ADC%20Reference% 20Library/documentation/Cocoa/Reference/ApplicationKit/Classes/ NSresponder_Class/index.html for more information. Rob On 17-Mar-07, at 5:52 PM, Kirt Fitzpatrick wrote: > I am trying to call the moveLeft method on the editor window and I > don't seem to be having any luck. I am a bit of a n00b to > Objective C so I assume that I must be missing something. This is > what I came up with. Am I doing something wrong? > > SEL methodSelector = sel_registerName( "moveLeft" ); > [[NSApplication sharedApplication] sendAction:methodSelector to:nil > from:self]; > > kirt > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins From itod at mac.com Sat Mar 17 22:39:37 2007 From: itod at mac.com (Todd Ditchendorf) Date: Sat, 17 Mar 2007 15:39:37 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: Message-ID: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> Kirt, I've done quite a bit of communication from a tm plugin to the TM front most window[1][2][3]... I think you should probably try something like this: [[[NSApplication sharedApplication] mainWindow] moveLeft:self] Note that +[NSApplication sharedApplication] returns an NSApplication instance, not a window. An NSApplication handles much of the application's lifecycle. A window is represented by NSWindow. The frontmost TM editing window can always be fetched by calling - [NSApplication mainWindow] on the TM application instance from your plugin, as shown above If I were Allan, I would probably admonish you not to do anything too crazy to the frontmost TM window from your plugin, as it might surprise users. But then again, as I mentioned, I've probably done more peeking under TM's skirt with my plugins than anyone else has... So far Allan hasn't complained ;-] [1] http://ditchnet.ort/texmlmate [2] http://ditchnet.ort/texslmate [3] http://ditchnet.ort/blogmate Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: > I am trying to call the moveLeft method on the editor window and I > don't seem to be having any luck. I am a bit of a n00b to > Objective C so I assume that I must be missing something. This is > what I came up with. Am I doing something wrong? > > SEL methodSelector = sel_registerName( "moveLeft" ); > [[NSApplication sharedApplication] sendAction:methodSelector to:nil > from:self]; > > kirt > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins From itod at mac.com Sat Mar 17 22:46:32 2007 From: itod at mac.com (Todd Ditchendorf) Date: Sat, 17 Mar 2007 15:46:32 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> Message-ID: <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> oh... and btw, I don't think the line below is going to work anyhow... first of all, I think I gave you some bumb advice... I'd never heard of moveLeft: before... I just looked it up, and it looks like it's something that an NSTextView might implement, not an NSWindow. More importantly, Allan has developed his own alternative to NSTextView in TM, called OakTextView, and I would not be surprised if it doesn't implement that method anyhow, so this might be a dead end. Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote: > Kirt, I've done quite a bit of communication from a tm plugin to > the TM front most window[1][2][3]... I think you should probably > try something like this: > > [[[NSApplication sharedApplication] mainWindow] moveLeft:self] > > > Note that +[NSApplication sharedApplication] returns an > NSApplication instance, not a window. An NSApplication handles much > of the application's lifecycle. A window is represented by > NSWindow. The frontmost TM editing window can always be fetched by > calling -[NSApplication mainWindow] on the TM application instance > from your plugin, as shown above > > If I were Allan, I would probably admonish you not to do anything > too crazy to the frontmost TM window from your plugin, as it might > surprise users. But then again, as I mentioned, I've probably done > more peeking under TM's skirt with my plugins than anyone else > has... So far Allan hasn't complained ;-] > > > [1] http://ditchnet.ort/texmlmate > [2] http://ditchnet.ort/texslmate > [3] http://ditchnet.ort/blogmate > > > Todd Ditchendorf > > Scandalous Software - Mac XML Developer Tools > http://scan.dalo.us > > > > On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: > >> I am trying to call the moveLeft method on the editor window and I >> don't seem to be having any luck. I am a bit of a n00b to >> Objective C so I assume that I must be missing something. This is >> what I came up with. Am I doing something wrong? >> >> SEL methodSelector = sel_registerName( "moveLeft" ); >> [[NSApplication sharedApplication] sendAction:methodSelector >> to:nil from:self]; >> >> kirt >> >> _______________________________________________ >> textmate-plugins mailing list >> textmate-plugins at lists.macromates.com >> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins From rix.rob at gmail.com Sat Mar 17 22:51:21 2007 From: rix.rob at gmail.com (Rob Rix) Date: Sat, 17 Mar 2007 18:51:21 -0400 Subject: [TxMt Plugins] sendAction Question In-Reply-To: <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> Message-ID: <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Actually it's an NSResponder method, and taking a glance at TextMate.app/Contents/Resources/KeyBindings.dict shows that a number of NSResponder methods are implemented by TextMate. It's worth a shot. Rob On 17-Mar-07, at 6:46 PM, Todd Ditchendorf wrote: > oh... and btw, I don't think the line below is going to work > anyhow... first of all, I think I gave you some bumb advice... I'd > never heard of moveLeft: before... I just looked it up, and it > looks like it's something that an NSTextView might implement, not > an NSWindow. > > More importantly, Allan has developed his own alternative to > NSTextView in TM, called OakTextView, and I would not be surprised > if it doesn't implement that method anyhow, so this might be a dead > end. > > Todd Ditchendorf > > Scandalous Software - Mac XML Developer Tools > http://scan.dalo.us > > > > On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote: > >> Kirt, I've done quite a bit of communication from a tm plugin to >> the TM front most window[1][2][3]... I think you should probably >> try something like this: >> >> [[[NSApplication sharedApplication] mainWindow] moveLeft:self] >> >> >> Note that +[NSApplication sharedApplication] returns an >> NSApplication instance, not a window. An NSApplication handles >> much of the application's lifecycle. A window is represented by >> NSWindow. The frontmost TM editing window can always be fetched by >> calling -[NSApplication mainWindow] on the TM application instance >> from your plugin, as shown above >> >> If I were Allan, I would probably admonish you not to do anything >> too crazy to the frontmost TM window from your plugin, as it might >> surprise users. But then again, as I mentioned, I've probably done >> more peeking under TM's skirt with my plugins than anyone else >> has... So far Allan hasn't complained ;-] >> >> >> [1] http://ditchnet.ort/texmlmate >> [2] http://ditchnet.ort/texslmate >> [3] http://ditchnet.ort/blogmate >> >> >> Todd Ditchendorf >> >> Scandalous Software - Mac XML Developer Tools >> http://scan.dalo.us >> >> >> >> On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: >> >>> I am trying to call the moveLeft method on the editor window and >>> I don't seem to be having any luck. I am a bit of a n00b to >>> Objective C so I assume that I must be missing something. This >>> is what I came up with. Am I doing something wrong? >>> >>> SEL methodSelector = sel_registerName( "moveLeft" ); >>> [[NSApplication sharedApplication] sendAction:methodSelector >>> to:nil from:self]; >>> >>> kirt >>> >>> _______________________________________________ >>> textmate-plugins mailing list >>> textmate-plugins at lists.macromates.com >>> http://lists.macromates.com/mailman/listinfo/textmate-plugins >> >> _______________________________________________ >> textmate-plugins mailing list >> textmate-plugins at lists.macromates.com >> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins From itod at mac.com Sat Mar 17 22:55:34 2007 From: itod at mac.com (Todd Ditchendorf) Date: Sat, 17 Mar 2007 15:55:34 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: > Actually it's an NSResponder method, yes, but if you're trying to move the text selection caret, the impl you actually want to call will be in something like NSTextView. > It's worth a shot. agreed. but still... I've peeked into the OakTextView.h header file using class-dump[1], and I don't see moveLeft: listed there. I really don't think this will work. [1] http://www.codethecode.com/Projects/class-dump/ Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us On Mar 17, 2007, at 3:51 PM, Rob Rix wrote: > Actually it's an NSResponder method, and taking a glance at > TextMate.app/Contents/Resources/KeyBindings.dict shows that a > number of NSResponder methods are implemented by TextMate. > > It's worth a shot. > > Rob > > On 17-Mar-07, at 6:46 PM, Todd Ditchendorf wrote: > >> oh... and btw, I don't think the line below is going to work >> anyhow... first of all, I think I gave you some bumb advice... I'd >> never heard of moveLeft: before... I just looked it up, and it >> looks like it's something that an NSTextView might implement, not >> an NSWindow. >> >> More importantly, Allan has developed his own alternative to >> NSTextView in TM, called OakTextView, and I would not be surprised >> if it doesn't implement that method anyhow, so this might be a >> dead end. >> >> Todd Ditchendorf >> >> Scandalous Software - Mac XML Developer Tools >> http://scan.dalo.us >> >> >> >> On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote: >> >>> Kirt, I've done quite a bit of communication from a tm plugin to >>> the TM front most window[1][2][3]... I think you should probably >>> try something like this: >>> >>> [[[NSApplication sharedApplication] mainWindow] moveLeft:self] >>> >>> >>> Note that +[NSApplication sharedApplication] returns an >>> NSApplication instance, not a window. An NSApplication handles >>> much of the application's lifecycle. A window is represented by >>> NSWindow. The frontmost TM editing window can always be fetched >>> by calling -[NSApplication mainWindow] on the TM application >>> instance from your plugin, as shown above >>> >>> If I were Allan, I would probably admonish you not to do anything >>> too crazy to the frontmost TM window from your plugin, as it >>> might surprise users. But then again, as I mentioned, I've >>> probably done more peeking under TM's skirt with my plugins than >>> anyone else has... So far Allan hasn't complained ;-] >>> >>> >>> [1] http://ditchnet.ort/texmlmate >>> [2] http://ditchnet.ort/texslmate >>> [3] http://ditchnet.ort/blogmate >>> >>> >>> Todd Ditchendorf >>> >>> Scandalous Software - Mac XML Developer Tools >>> http://scan.dalo.us >>> >>> >>> >>> On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: >>> >>>> I am trying to call the moveLeft method on the editor window and >>>> I don't seem to be having any luck. I am a bit of a n00b to >>>> Objective C so I assume that I must be missing something. This >>>> is what I came up with. Am I doing something wrong? >>>> >>>> SEL methodSelector = sel_registerName( "moveLeft" ); >>>> [[NSApplication sharedApplication] sendAction:methodSelector >>>> to:nil from:self]; >>>> >>>> kirt >>>> >>>> _______________________________________________ >>>> textmate-plugins mailing list >>>> textmate-plugins at lists.macromates.com >>>> http://lists.macromates.com/mailman/listinfo/textmate-plugins >>> >>> _______________________________________________ >>> textmate-plugins mailing list >>> textmate-plugins at lists.macromates.com >>> http://lists.macromates.com/mailman/listinfo/textmate-plugins >> >> _______________________________________________ >> textmate-plugins mailing list >> textmate-plugins at lists.macromates.com >> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins From kirt.fitzpatrick at gmail.com Sat Mar 17 23:03:11 2007 From: kirt.fitzpatrick at gmail.com (Kirt Fitzpatrick) Date: Sat, 17 Mar 2007 16:03:11 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: It Todd appears is right. Which is what I was afraid of. Now I really need to work blind (without documentation). kirt On 3/17/07, Todd Ditchendorf wrote: > > > Actually it's an NSResponder method, > > yes, but if you're trying to move the text selection caret, the impl > you actually want to call will be in something like NSTextView. > > > It's worth a shot. > > agreed. but still... I've peeked into the OakTextView.h header file > using class-dump[1], and I don't see moveLeft: listed there. I really > don't think this will work. > > [1] http://www.codethecode.com/Projects/class-dump/ > > Todd Ditchendorf > > Scandalous Software - Mac XML Developer Tools > http://scan.dalo.us > > > > On Mar 17, 2007, at 3:51 PM, Rob Rix wrote: > > > Actually it's an NSResponder method, and taking a glance at > > TextMate.app/Contents/Resources/KeyBindings.dict shows that a > > number of NSResponder methods are implemented by TextMate. > > > > It's worth a shot. > > > > Rob > > > > On 17-Mar-07, at 6:46 PM, Todd Ditchendorf wrote: > > > >> oh... and btw, I don't think the line below is going to work > >> anyhow... first of all, I think I gave you some bumb advice... I'd > >> never heard of moveLeft: before... I just looked it up, and it > >> looks like it's something that an NSTextView might implement, not > >> an NSWindow. > >> > >> More importantly, Allan has developed his own alternative to > >> NSTextView in TM, called OakTextView, and I would not be surprised > >> if it doesn't implement that method anyhow, so this might be a > >> dead end. > >> > >> Todd Ditchendorf > >> > >> Scandalous Software - Mac XML Developer Tools > >> http://scan.dalo.us > >> > >> > >> > >> On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote: > >> > >>> Kirt, I've done quite a bit of communication from a tm plugin to > >>> the TM front most window[1][2][3]... I think you should probably > >>> try something like this: > >>> > >>> [[[NSApplication sharedApplication] mainWindow] moveLeft:self] > >>> > >>> > >>> Note that +[NSApplication sharedApplication] returns an > >>> NSApplication instance, not a window. An NSApplication handles > >>> much of the application's lifecycle. A window is represented by > >>> NSWindow. The frontmost TM editing window can always be fetched > >>> by calling -[NSApplication mainWindow] on the TM application > >>> instance from your plugin, as shown above > >>> > >>> If I were Allan, I would probably admonish you not to do anything > >>> too crazy to the frontmost TM window from your plugin, as it > >>> might surprise users. But then again, as I mentioned, I've > >>> probably done more peeking under TM's skirt with my plugins than > >>> anyone else has... So far Allan hasn't complained ;-] > >>> > >>> > >>> [1] http://ditchnet.ort/texmlmate > >>> [2] http://ditchnet.ort/texslmate > >>> [3] http://ditchnet.ort/blogmate > >>> > >>> > >>> Todd Ditchendorf > >>> > >>> Scandalous Software - Mac XML Developer Tools > >>> http://scan.dalo.us > >>> > >>> > >>> > >>> On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: > >>> > >>>> I am trying to call the moveLeft method on the editor window and > >>>> I don't seem to be having any luck. I am a bit of a n00b to > >>>> Objective C so I assume that I must be missing something. This > >>>> is what I came up with. Am I doing something wrong? > >>>> > >>>> SEL methodSelector = sel_registerName( "moveLeft" ); > >>>> [[NSApplication sharedApplication] sendAction:methodSelector > >>>> to:nil from:self]; > >>>> > >>>> kirt > >>>> > >>>> _______________________________________________ > >>>> textmate-plugins mailing list > >>>> textmate-plugins at lists.macromates.com > >>>> http://lists.macromates.com/mailman/listinfo/textmate-plugins > >>> > >>> _______________________________________________ > >>> textmate-plugins mailing list > >>> textmate-plugins at lists.macromates.com > >>> http://lists.macromates.com/mailman/listinfo/textmate-plugins > >> > >> _______________________________________________ > >> textmate-plugins mailing list > >> textmate-plugins at lists.macromates.com > >> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > > > _______________________________________________ > > textmate-plugins mailing list > > textmate-plugins at lists.macromates.com > > http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins > -------------- next part -------------- An HTML attachment was scrubbed... URL: From itod at mac.com Sat Mar 17 23:06:31 2007 From: itod at mac.com (Todd Ditchendorf) Date: Sat, 17 Mar 2007 16:06:31 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: <72EBD980-FDC9-42EB-9344-D8A7C8CD4364@mac.com> really we're going about this all wrong... TM has lots of great documentation and a wonderful dev community. You should describe here what effect it is you are trying to achieve. there's bound to be a way to do it... and possibly even thru published/documented api. Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us On Mar 17, 2007, at 4:03 PM, Kirt Fitzpatrick wrote: > It Todd appears is right. Which is what I was afraid of. Now I > really need to work blind (without documentation). > > kirt > > On 3/17/07, Todd Ditchendorf wrote:> Actually it's > an NSResponder method, > > yes, but if you're trying to move the text selection caret, the impl > you actually want to call will be in something like NSTextView. > > > It's worth a shot. > > agreed. but still... I've peeked into the OakTextView.h header file > using class-dump[1], and I don't see moveLeft: listed there. I really > don't think this will work. > > [1] http://www.codethecode.com/Projects/class-dump/ > > Todd Ditchendorf > > Scandalous Software - Mac XML Developer Tools > http://scan.dalo.us > > > > On Mar 17, 2007, at 3:51 PM, Rob Rix wrote: > > > Actually it's an NSResponder method, and taking a glance at > > TextMate.app/Contents/Resources/KeyBindings.dict shows that a > > number of NSResponder methods are implemented by TextMate. > > > > It's worth a shot. > > > > Rob > > > > On 17-Mar-07, at 6:46 PM, Todd Ditchendorf wrote: > > > >> oh... and btw, I don't think the line below is going to work > >> anyhow... first of all, I think I gave you some bumb advice... I'd > >> never heard of moveLeft: before... I just looked it up, and it > >> looks like it's something that an NSTextView might implement, not > >> an NSWindow. > >> > >> More importantly, Allan has developed his own alternative to > >> NSTextView in TM, called OakTextView, and I would not be surprised > >> if it doesn't implement that method anyhow, so this might be a > >> dead end. > >> > >> Todd Ditchendorf > >> > >> Scandalous Software - Mac XML Developer Tools > >> http://scan.dalo.us > >> > >> > >> > >> On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote: > >> > >>> Kirt, I've done quite a bit of communication from a tm plugin to > >>> the TM front most window[1][2][3]... I think you should probably > >>> try something like this: > >>> > >>> [[[NSApplication sharedApplication] mainWindow] moveLeft:self] > >>> > >>> > >>> Note that +[NSApplication sharedApplication] returns an > >>> NSApplication instance, not a window. An NSApplication handles > >>> much of the application's lifecycle. A window is represented by > >>> NSWindow. The frontmost TM editing window can always be fetched > >>> by calling -[NSApplication mainWindow] on the TM application > >>> instance from your plugin, as shown above > >>> > >>> If I were Allan, I would probably admonish you not to do anything > >>> too crazy to the frontmost TM window from your plugin, as it > >>> might surprise users. But then again, as I mentioned, I've > >>> probably done more peeking under TM's skirt with my plugins than > >>> anyone else has... So far Allan hasn't complained ;-] > >>> > >>> > >>> [1] http://ditchnet.ort/texmlmate > >>> [2] http://ditchnet.ort/texslmate > >>> [3] http://ditchnet.ort/blogmate > >>> > >>> > >>> Todd Ditchendorf > >>> > >>> Scandalous Software - Mac XML Developer Tools > >>> http://scan.dalo.us > >>> > >>> > >>> > >>> On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: > >>> > >>>> I am trying to call the moveLeft method on the editor window and > >>>> I don't seem to be having any luck. I am a bit of a n00b to > >>>> Objective C so I assume that I must be missing something. This > >>>> is what I came up with. Am I doing something wrong? > >>>> > >>>> SEL methodSelector = sel_registerName( "moveLeft" ); > >>>> [[NSApplication sharedApplication] sendAction:methodSelector > >>>> to:nil from:self]; > >>>> > >>>> kirt > >>>> > >>>> _______________________________________________ > >>>> textmate-plugins mailing list > >>>> textmate-plugins at lists.macromates.com > >>>> http://lists.macromates.com/mailman/listinfo/textmate-plugins > >>> > >>> _______________________________________________ > >>> textmate-plugins mailing list > >>> textmate-plugins at lists.macromates.com > >>> http://lists.macromates.com/mailman/listinfo/textmate-plugins > >> > >> _______________________________________________ > >> textmate-plugins mailing list > >> textmate-plugins at lists.macromates.com > >> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > > > _______________________________________________ > > textmate-plugins mailing list > > textmate-plugins at lists.macromates.com > > http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins From kirt.fitzpatrick at gmail.com Sat Mar 17 23:12:49 2007 From: kirt.fitzpatrick at gmail.com (Kirt Fitzpatrick) Date: Sat, 17 Mar 2007 16:12:49 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: <72EBD980-FDC9-42EB-9344-D8A7C8CD4364@mac.com> References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> <72EBD980-FDC9-42EB-9344-D8A7C8CD4364@mac.com> Message-ID: I'm writing a Vi plugin, Currently I must create a list of events and send them to NSWindow. However, this does not work for alot of actions that I need. I need to be able to execute all of the movement commands and selection commands. Having access to the undo stack would be great too. kirt On 3/17/07, Todd Ditchendorf wrote: > > really we're going about this all wrong... TM has lots of great > documentation and a wonderful dev community. You should describe here > what effect it is you are trying to achieve. there's bound to be a > way to do it... and possibly even thru published/documented api. > > Todd Ditchendorf > > Scandalous Software - Mac XML Developer Tools > http://scan.dalo.us > > > > On Mar 17, 2007, at 4:03 PM, Kirt Fitzpatrick wrote: > > > It Todd appears is right. Which is what I was afraid of. Now I > > really need to work blind (without documentation). > > > > kirt > > > > On 3/17/07, Todd Ditchendorf wrote:> Actually it's > > an NSResponder method, > > > > yes, but if you're trying to move the text selection caret, the impl > > you actually want to call will be in something like NSTextView. > > > > > It's worth a shot. > > > > agreed. but still... I've peeked into the OakTextView.h header file > > using class-dump[1], and I don't see moveLeft: listed there. I really > > don't think this will work. > > > > [1] http://www.codethecode.com/Projects/class-dump/ > > > > Todd Ditchendorf > > > > Scandalous Software - Mac XML Developer Tools > > http://scan.dalo.us > > > > > > > > On Mar 17, 2007, at 3:51 PM, Rob Rix wrote: > > > > > Actually it's an NSResponder method, and taking a glance at > > > TextMate.app/Contents/Resources/KeyBindings.dict shows that a > > > number of NSResponder methods are implemented by TextMate. > > > > > > It's worth a shot. > > > > > > Rob > > > > > > On 17-Mar-07, at 6:46 PM, Todd Ditchendorf wrote: > > > > > >> oh... and btw, I don't think the line below is going to work > > >> anyhow... first of all, I think I gave you some bumb advice... I'd > > >> never heard of moveLeft: before... I just looked it up, and it > > >> looks like it's something that an NSTextView might implement, not > > >> an NSWindow. > > >> > > >> More importantly, Allan has developed his own alternative to > > >> NSTextView in TM, called OakTextView, and I would not be surprised > > >> if it doesn't implement that method anyhow, so this might be a > > >> dead end. > > >> > > >> Todd Ditchendorf > > >> > > >> Scandalous Software - Mac XML Developer Tools > > >> http://scan.dalo.us > > >> > > >> > > >> > > >> On Mar 17, 2007, at 3:39 PM, Todd Ditchendorf wrote: > > >> > > >>> Kirt, I've done quite a bit of communication from a tm plugin to > > >>> the TM front most window[1][2][3]... I think you should probably > > >>> try something like this: > > >>> > > >>> [[[NSApplication sharedApplication] mainWindow] moveLeft:self] > > >>> > > >>> > > >>> Note that +[NSApplication sharedApplication] returns an > > >>> NSApplication instance, not a window. An NSApplication handles > > >>> much of the application's lifecycle. A window is represented by > > >>> NSWindow. The frontmost TM editing window can always be fetched > > >>> by calling -[NSApplication mainWindow] on the TM application > > >>> instance from your plugin, as shown above > > >>> > > >>> If I were Allan, I would probably admonish you not to do anything > > >>> too crazy to the frontmost TM window from your plugin, as it > > >>> might surprise users. But then again, as I mentioned, I've > > >>> probably done more peeking under TM's skirt with my plugins than > > >>> anyone else has... So far Allan hasn't complained ;-] > > >>> > > >>> > > >>> [1] http://ditchnet.ort/texmlmate > > >>> [2] http://ditchnet.ort/texslmate > > >>> [3] http://ditchnet.ort/blogmate > > >>> > > >>> > > >>> Todd Ditchendorf > > >>> > > >>> Scandalous Software - Mac XML Developer Tools > > >>> http://scan.dalo.us > > >>> > > >>> > > >>> > > >>> On Mar 17, 2007, at 2:52 PM, Kirt Fitzpatrick wrote: > > >>> > > >>>> I am trying to call the moveLeft method on the editor window and > > >>>> I don't seem to be having any luck. I am a bit of a n00b to > > >>>> Objective C so I assume that I must be missing something. This > > >>>> is what I came up with. Am I doing something wrong? > > >>>> > > >>>> SEL methodSelector = sel_registerName( "moveLeft" ); > > >>>> [[NSApplication sharedApplication] sendAction:methodSelector > > >>>> to:nil from:self]; > > >>>> > > >>>> kirt > > >>>> > > >>>> _______________________________________________ > > >>>> textmate-plugins mailing list > > >>>> textmate-plugins at lists.macromates.com > > >>>> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > >>> > > >>> _______________________________________________ > > >>> textmate-plugins mailing list > > >>> textmate-plugins at lists.macromates.com > > >>> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > >> > > >> _______________________________________________ > > >> textmate-plugins mailing list > > >> textmate-plugins at lists.macromates.com > > >> http://lists.macromates.com/mailman/listinfo/textmate-plugins > > > > > > _______________________________________________ > > > textmate-plugins mailing list > > > textmate-plugins at lists.macromates.com > > > http://lists.macromates.com/mailman/listinfo/textmate-plugins > > > > _______________________________________________ > > textmate-plugins mailing list > > textmate-plugins at lists.macromates.com > > http://lists.macromates.com/mailman/listinfo/textmate-plugins > > > > _______________________________________________ > > textmate-plugins mailing list > > textmate-plugins at lists.macromates.com > > http://lists.macromates.com/mailman/listinfo/textmate-plugins > > _______________________________________________ > textmate-plugins mailing list > textmate-plugins at lists.macromates.com > http://lists.macromates.com/mailman/listinfo/textmate-plugins > -------------- next part -------------- An HTML attachment was scrubbed... URL: From throw-away-1 at macromates.com Sat Mar 17 23:17:59 2007 From: throw-away-1 at macromates.com (Allan Odgaard) Date: Sun, 18 Mar 2007 00:17:59 +0100 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: On 17. Mar 2007, at 23:55, Todd Ditchendorf wrote: > [...] I've peeked into the OakTextView.h header file using class- > dump[1], and I don't see moveLeft: listed there. I really don't > think this will work. OakTextView does implement the majority of NSResponder mehtods. However, they are virtual in the sense that you need to use performSelector:withObject: or something like NSApplication?s sendAction:to:from:. As for using ?undocumented methods?: all of NSResponder is safe, since that will also exist in 2.0 -- for the rest, 2.0 will use a new OakTextView with an overall much changed (and cleaned up ;) ) API, at that time, the API will be made public, and plug-ins will also be able to use custom instances of the view. From itod at mac.com Sat Mar 17 23:24:47 2007 From: itod at mac.com (Todd Ditchendorf) Date: Sat, 17 Mar 2007 16:24:47 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: > On 17. Mar 2007, at 23:55, Todd Ditchendorf wrote: > >> [...] I've peeked into the OakTextView.h header file using class- >> dump[1], and I don't see moveLeft: listed there. I really don't >> think this will work. > > OakTextView does implement the majority of NSResponder mehtods. > However, they are virtual in the sense that you need to use > performSelector:withObject: or something like NSApplication?s > sendAction:to:from:. wow, cool. I stand humbly corrected. this is good to know. From kirt.fitzpatrick at gmail.com Sun Mar 18 00:31:08 2007 From: kirt.fitzpatrick at gmail.com (Kirt Fitzpatrick) Date: Sat, 17 Mar 2007 17:31:08 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: > OakTextView does implement the majority of NSResponder mehtods. > However, they are virtual in the sense that you need to use > performSelector:withObject: or something like NSApplication's > sendAction:to:from:. If this is true than how come Todd and Rob's suggestions for sendAction do not work? [[NSApplication sharedApplication] sendAction: @selector(moveLeft:) to: nil from: self]; -- or -- [[[NSApplication sharedApplication] mainWindow] moveLeft:self] thanks, kirt -------------- next part -------------- An HTML attachment was scrubbed... URL: From throw-away-1 at macromates.com Sun Mar 18 17:24:29 2007 From: throw-away-1 at macromates.com (Allan Odgaard) Date: Sun, 18 Mar 2007 18:24:29 +0100 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: On 18. Mar 2007, at 01:31, Kirt Fitzpatrick wrote: >> OakTextView does implement the majority of NSResponder mehtods. [...] > If this is true than how come Todd and Rob's suggestions for > sendAction do not work? > > [[NSApplication sharedApplication] sendAction: @selector(moveLeft:) > to: nil from: self]; > -- or -- > [[[NSApplication sharedApplication] mainWindow] moveLeft:self] The latter surely should not work. The former, maybe because your plug-in opens a window that interferes with the responder chain? Or some other problem in the code? It is hard to diagnose without seeing the full source. From kirt.fitzpatrick at gmail.com Sat Mar 31 21:20:42 2007 From: kirt.fitzpatrick at gmail.com (Kirt Fitzpatrick) Date: Sat, 31 Mar 2007 14:20:42 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: I have created a new project that distills out only the minimum code needed for this plugin to send a message to the active window. You can download it here (http://fowpas.net/ViMate.zip). It of course does not work but I am hoping that someone may be able to tell me why. Here is the most relevant code. @implementation ViPlugin - (id)initWithPlugInController:(id )aController { NSLog( @"we have lift off!" ); [ViWindow poseAsClass:[NSWindow class]]; return [super init]; } @end @implementation ViWindow - (void)sendEvent:(NSEvent *)theEvent { if ( [theEvent type] == NSKeyDown ) { if ( [[theEvent charactersIgnoringModifiers] characterAtIndex: 0] == 'h' ) { NSLog( @"we are trying to move left." ); [[NSApplication sharedApplication] sendAction: @selector(moveLeft:) to: nil from: self]; } else { [super sendEvent:theEvent]; } } else { [super sendEvent:theEvent]; } } @end thanks kirt -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirt.fitzpatrick at gmail.com Sat Mar 31 22:26:19 2007 From: kirt.fitzpatrick at gmail.com (Kirt Fitzpatrick) Date: Sat, 31 Mar 2007 15:26:19 -0700 Subject: [TxMt Plugins] sendAction Question In-Reply-To: References: <4AF48E9F-D68F-478F-A765-6F7CB4F8AA37@mac.com> <6F3BD737-E5E0-4DAD-9912-9BB76BDB18D3@mac.com> <9BCA590F-4416-478C-8A60-60860DFE7A3D@gmail.com> Message-ID: I figured it out. The firstResponder had what I needed after all. I could have sworn that I had tried this before. Anyway, it works now. Thanks for your help and patience. kirt @implementation ViWindow - (void)sendEvent:(NSEvent *)theEvent { if ( [theEvent type] == NSKeyDown ) { if ( [[theEvent charactersIgnoringModifiers] characterAtIndex: 0] == 'h' ) { NSLog( @"we are trying to move left." ); // This is the way to call the virtual methods. [[self firstResponder] performSelector: @selector(moveLeft:) withObject: self]; } else { [super sendEvent:theEvent]; } } else { [super sendEvent:theEvent]; } } @end On 3/31/07, Kirt Fitzpatrick wrote: > > I have created a new project that distills out only the minimum code > needed for this plugin to send a message to the active window. You can > download it here (http://fowpas.net/ViMate.zip). > It of course does not work but I am hoping that someone may be able to tell > me why. Here is the most relevant code. > > > > @implementation ViPlugin > - (id)initWithPlugInController:(id )aController > { > NSLog( @"we have lift off!" ); > [ViWindow poseAsClass:[NSWindow class]]; > > return [super init]; > } > @end > > > > > > @implementation ViWindow > - (void)sendEvent:(NSEvent *)theEvent > { > if ( [theEvent type] == NSKeyDown ) { > if ( [[theEvent charactersIgnoringModifiers] characterAtIndex: 0] > == 'h' ) { > NSLog( @"we are trying to move left." ); > [[NSApplication sharedApplication] sendAction: > @selector(moveLeft:) to: nil from: self]; > } else { > [super sendEvent:theEvent]; > } > } else { > [super sendEvent:theEvent]; > } > } > @end > > > > > thanks > kirt > > -------------- next part -------------- An HTML attachment was scrubbed... URL: