From ian.w.white at gmail.com Fri Sep 14 14:09:49 2007 From: ian.w.white at gmail.com (Ian White) Date: Fri, 14 Sep 2007 15:09:49 +0100 Subject: [TxMt Plugins] [ANN] matewatch - free time tracking for textmate projects Message-ID: Hi list, I got sick of the bloated time tracking solutions available for OS X, I work mainly in Textmate, so I rolled my own. http://blog.ardes.com/articles/2007/09/14/textmate-user-time-tracking-for-free-matewatch And it's free! Cheers, Ian White -- Argument from Design--We build web applications Western House 239 Western Road Sheffield S10 1LE UK Mobile: +44 (0)797 4678409 | Office: +44 (0)114 2667712 | From bibiko at eva.mpg.de Thu Sep 20 14:43:25 2007 From: bibiko at eva.mpg.de (Hans-Joerg Bibiko) Date: Thu, 20 Sep 2007 16:43:25 +0200 Subject: [TxMt Plugins] sendAction Question Message-ID: <72657E77-A2F4-434A-8942-D582AB5DBF50@eva.mpg.de> Hi, I just found this thread in the net. I don't know whether it is too late ;) Regarding to make a selection in a TM document. Did you try this way: -(void)setSelectionTo:(NSDictionary*)someOptions { NSString* line; NSString* column; if(![someOptions objectForKey:@"toLine"]) line = [[[NSApp targetForAction:@selector(allEnvironmentVariables)] allEnvironmentVariables] objectForKey:@"TM_LINE_NUMBER"]; else line = [someOptions objectForKey:@"toLine"]; if(![someOptions objectForKey:@"toColumn"]) column = @"1"; else if([[someOptions objectForKey:@"toColumn"] isEqualToString:@"end"]) column = [NSString stringWithFormat:@"%d",([[[[NSApp targetForAction:@selector(allEnvironmentVariables)] allEnvironmentVariables] objectForKey:@"TM_CURRENT_LINE"] length] + 1)]; else column = [someOptions objectForKey:@"toColumn"]; if([someOptions objectForKey:@"length"]) column = [NSString stringWithFormat:@"%d",[[[[NSApp targetForAction:@selector(allEnvironmentVariables)] allEnvironmentVariables] objectForKey:@"TM_COLUMN_NUMBER"] intValue] + [[someOptions objectForKey:@"length"] intValue]]; id d = [NSApp targetForAction:@selector(document)]; [d selectToLine:line andColumn:column]; } For me it works perfectly ;) Regards, Hans From throw-away-1 at macromates.com Thu Sep 20 14:45:52 2007 From: throw-away-1 at macromates.com (Allan Odgaard) Date: Thu, 20 Sep 2007 16:45:52 +0200 Subject: [TxMt Plugins] Dialog API improvements Message-ID: <9287B3B3-C9EE-4C2C-92A9-421EABADC7F2@macromates.com> There have recently been a few patches to the Dialog plug-in that I have yet to role in. Mainly because the current architecture does not scale well with new functionality. We have spoken a bit about it on IRC, but since not all contributors are on IRC, I am moving the discussion to this list. The restructuring I am envisioning is to move to a command based system so that the basic syntax is: tm_dialog ?command? [?options?] Additionally there will be: tm_dialog help ?command? And just tm_dialog to get a list of commands. Each command will be responsible for a certain function. Presently we have these things (including pending patches): Synchronous nib loading Asynchronous nib loading Pop-up menu Type-to-narrow pop-up list File dialog (open/save) System dialog (color/font) HTML tool tips In my mind, each should be a fully self-contained file providing that functionality. From an architectural POV I imagine that tm_dialog will basically connect to the Dialog plug-in using distributed-objects (as now) and send it: 1. The full command line (i.e. with arguments) 2. File handles for tm_dialog?s stdin, stdout, and stderr Basically all work will then be done in the Dialog plug-in. Which will conceptually do: 1. Check what command the command line arguments contain 2. Lookup a class/object to handle that command in a dictionary 3. Pass on the info to that class/object (if found). So the main thing that needs to be worked out is a super class for the commands to subclass. This has two jobs: 1. Provide a method for the subclass to register a command (called e.g. in +load) 2. Provide an interface for the method that is called when the command should go into action All in all that should be quite simple. Though we probably want a bit of sugar, such as converting the arguments to an NSDictionary (rather than have each command use getopt_long etc.) and maybe a few other things. A minor concern is how a command can signal tm_dialog to wait for a semaphore, as is presently required by the nib-loading command (when given e.g. the -w option) A bigger concern is what to do with backwards compatibility. Maybe it would be possible to let $DIALOG point at a script that rewrites the arguments, and then introduce a new variable for the new tm_dialog command. From throw-away-1 at macromates.com Thu Sep 20 15:26:31 2007 From: throw-away-1 at macromates.com (Allan Odgaard) Date: Thu, 20 Sep 2007 17:26:31 +0200 Subject: [TxMt Plugins] Dialog API improvements In-Reply-To: <9287B3B3-C9EE-4C2C-92A9-421EABADC7F2@macromates.com> References: <9287B3B3-C9EE-4C2C-92A9-421EABADC7F2@macromates.com> Message-ID: On 20/09/2007, at 16:45, Allan Odgaard wrote: > [...] > The restructuring I am envisioning is to move to a command based > system so that the basic syntax is: > tm_dialog ?command? [?options?] > [...] I should mention that another candidate is to use an object oriented approach, so we would have: tm_dialog create (window|menu|?) And later that object could be manipulated with other commands. Though given how only few of the commands follow the ?create, manipulate, dispose?-cycle, it is probably not a good interface. From bibiko at eva.mpg.de Thu Sep 20 16:01:48 2007 From: bibiko at eva.mpg.de (=?ISO-8859-1?Q?Hans-J=F6rg_Bibiko?=) Date: Thu, 20 Sep 2007 18:01:48 +0200 Subject: [TxMt Plugins] Dialog API improvements In-Reply-To: References: <9287B3B3-C9EE-4C2C-92A9-421EABADC7F2@macromates.com> Message-ID: <3DE256CC-A359-4237-968B-9C48E4B308F4@eva.mpg.de> Hi, my FIRST thought is something like that: tm_dialog LISTTOKENS tm_dialog UPDATETOKEN tm_dialog CLOSETOKEN tm_dialog WAITFORTOKEN tm_dialog SHOW PopupMenu WITH '{menuItems={title=A;};}' tm_dialog SHOW RequestString WITH '{prompt=A;string=Hello;}' AS 'centered modal' tm_dialog SHOW OpenPanel AS 'modal centered' ADD Accessory.nib WITH '{...}' tm_dialog WITH '{...}' SHOW OpenPanel AS 'modal centered' tm_dialog SHOW SavePanel ADD Accessory.nib WITH '{...}' AS modal tm_dialog SHOW InteractivePopupMenu WITH 'suggestions=(...);' AS 'modal quiet' tm_dialog SHOW HTMLTooltip WITH '{...}' tm_dialog SHOW MyNib ASYNC CREATENEWITEMS '{...}' AS 'centered' WITHDEFAULTS '{...}' tm_dialog AS centered SHOW MyNib CREATENEWITEMS '{...}' ASYNC So you write a kind of an English sentence with variable word order. The entire arguments could be parsed into a NSDictionary and sent to the 'super class' to dispatch. Regards, Hans From chris at cjack.com Thu Sep 20 16:34:22 2007 From: chris at cjack.com (Chris Thomas) Date: Thu, 20 Sep 2007 12:34:22 -0400 Subject: [TxMt Plugins] Dialog API improvements In-Reply-To: References: <9287B3B3-C9EE-4C2C-92A9-421EABADC7F2@macromates.com> Message-ID: On Sep 20, 2007, at 11:26 AM, Allan Odgaard wrote: > On 20/09/2007, at 16:45, Allan Odgaard wrote: > >> [...] >> The restructuring I am envisioning is to move to a command based >> system so that the basic syntax is: >> tm_dialog ?command? [?options?] >> [...] > > I should mention that another candidate is to use an object oriented > approach, so we would have: > > tm_dialog create (window|menu|?) > > And later that object could be manipulated with other commands. > > Though given how only few of the commands follow the ?create, > manipulate, dispose?-cycle, it is probably not a good interface. Reverse the order and it can be done without forcing other commands to conform: "tm_dialog (window|menu) create". That's probably the most flexible solution. But, it might be better to use the former approach with different verbs: "show" for synchronous and "create" for asynchronous. "tm_dialog show menu", for example, makes perfect sense and allows the "create" verb to be added later if there's ever a reason to manipulate a menu asynchronously. The implementation in the Dialog plugin would use the second argument as a key for the command subclass, and then dispatch the command line to the subclass. This has the side effect of possibly slightly simplifying the implementation of "tm_dialog help ". Chris From joachimm at etek.chalmers.se Fri Sep 21 03:34:43 2007 From: joachimm at etek.chalmers.se (Joachim =?iso-8859-1?Q?M=E5rtensson?=) Date: Fri, 21 Sep 2007 05:34:43 +0200 (CEST) Subject: [TxMt Plugins] Dialog API improvements In-Reply-To: References: <9287B3B3-C9EE-4C2C-92A9-421EABADC7F2@macromates.com> Message-ID: <52972.193.11.234.162.1190345683.squirrel@webmail.chalmers.se> I prefer having the following interface tm_dialog