Re: [Cocoapsql-developer] please agree to changes in project settings
Status: Alpha
Brought to you by:
alkirkus
From: Al K. <al...@ki...> - 2002-05-29 01:21:36
|
Hi Olaf. You have a good point here. We should not assume any particular directory structure other than maybe the default imposed by the postgres package itself. Ideally it would be good if there was a way for project builder to reference an environment variable which we could set to point to the postgres installation directory if it differed from the default location, but I don't know if we can do that. I believe that the default location is /usr/local/pgsql just as you have it. Bottom line, I think that your path settings should be the default and we who do not have standard installation locations, because we used fink or whatever other reason, should be forced to deal with it. I think you should set project builder to reference postgres relevant includes in /usr/local/pgsql/include and relavent libraries in /usr/local/pgsql/lib. As for the second item relating to the the import statement, this goes directly to the path issue above. When postgres installed via fink it created a postgresql/ directory under /include. Since I was referencing the generic /include header directory I needed to include the /postgresql/ as part of the path name. You should double check but I believe that when a default install to /usr/local/pgsql is done, the relevant headers wind up in /usr/local/pgsql/include. If this is correct then your change is exactly right. As for the import, include discussion, you are correct. I only used the #include as a cue to myself to remember that these were postgres specific items written in ANSI C and not an objective C header. I have no problem with either change!! As for the third item, your code looks like it will work but there is a larger mistake here that needs to be corrected to save a lot of future work. I wanted to discus this with you. As I began learning Cocoa from the Aaron Hilegass book his examples did not explain the responder chain and the related concepts until later. I had already begun coding this program. Simply put I believe that the PSQLController should be coded as a subclass of NSWindowController instead of the simple NSObject and be made the delegate of the relevant windows. Then the First responder object needs to be modified by adding the relevant action methods reflecting the code that is already present in the PSQLController object. Once done the PSQLController will automatically be the first responder whenever it is key and the menus will automatically activate/deactivate as needed. There may still be a small issue with the connect/disconnect menu items but everything else should work OK, I think? I hope that last part made some sense to you as I am having trouble keeping it all straight myself. Let me know what you think, Al On Tuesday, May 28, 2002, at 05:15 PM, Olaf van Oudenallen wrote: > Hi Al, > > I have to discuss the following (two) items before commiting. The third > item is just to inform you. I will report commited changes again to > this list. > > Do you agree on the first two items? > > - Working with the project on different systems > - Changed #include <postgresql/libpq-fe.h> to #import <libpq-fe.h> > - Auto set the 'Connect', 'Disconnect' and 'Export' menu items > enabled/disabled: > > Working with the project on different systems > As I have postgresql installed in (subdirectiries of) /usr/local/pgsql/ > The current targets settings for HEADER Search Path do not work for me. > So I have added the Search Pathe: > to HEADER: /usr/local/pgsql/include/ > > Hard coding an included library is another problem (for me): > build-error: > MasterObjectFile.Combine /Developer/TVOproducts/Cocoa Psql.build/Cocoa > Psql.build/Objects-normal/ProjectBuilderMasterObjectFile.o > ...skipped Cocoa Psql.app/Contents/MacOS/Cocoa Psql for lack of > /sw/lib/libpq.a... > Therefore I wonder if files to be included can be added without a path. > Any way I used to get away with adding some folders (/sw/lib/) and an > alias to have the libpq.a being included in the project. Now I had to > make a copy of the file and place it in the folder /sw/lib/ > I am sure I have forgotten when I install the next update to > Postgrsql...... > Any solution? > > Changed #include <postgresql/libpq-fe.h> to #import <libpq-fe.h> > As #import is the default for Cocoa (and better as the libs get loaded > only once now), I changed #include to #import. > As I get an error on compiling PSQLController.m (header file > 'postgresql/libpq-fe.h' not found) I changed <postgresql/libpq-fe.h> in > <libpq-fe.h> > So in the following files: > changed #include <postgresql/libpq-fe.h> > into #import <libpq-fe.h> > in the following files: > PSQLConnection.h > PSQLQuery.h > > Auto set the 'Connect', 'Disconnect' and 'Export' menu items > enabled/disabled: > I added the actions to the first responder of MainMenu.nib > menuConnect: > menuDisconnect: > raiseConnectionSettingsWindow: > doExportMenuAction: (for consistancy reasons) > and reconnected the Connection-menu items to these actions in the first > responder. > > To auto Enable menuItems, I have made PSQLController the delagate of > the mainWindow. > > Added to PSQLController.m > - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { > SEL action = [menuItem action]; > if (action==@selector(menuConnect:) && [connection connected]) { > return NO; } > else if (action==@selector(menuDisconnect:) && ![connection > connected]) { > return NO; } > else if (action==@selector(doExportMenuAction:) && ![tableView > numberOfRows] > 0) { > return NO; } > else { > return YES; > } > } |