* DBModeler/Modeler.m: use sel_isEqual to check menu

* DBModeler/Resources/SQLGenerator.gsmarkup: make window resizeable
* DBModeler/CodeGenerator.m: add credits for initialCapitalString and
  initialLowercaseString
  use ASSIGN() in generated code.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@30260 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Dave Wetzel 2010-04-29 18:14:30 +00:00
parent 2f65a25e2f
commit 51b728a2b8
5 changed files with 46 additions and 11 deletions

View file

@ -6,6 +6,11 @@
added - (NSString *)cScalarTypeString
* DBModeler/CodeGenerator.h/m: new file
Added a Code Generator like EOGenerator from www.rubicode.com
* DBModeler/Modeler.m: use sel_isEqual to check menu
* DBModeler/Resources/SQLGenerator.gsmarkup: make window resizeable
* DBModeler/CodeGenerator.m: add credits for initialCapitalString and
initialLowercaseString
use ASSIGN() in generated code.
2010-04-26 David Wetzel <dave@turbocat.de>

View file

@ -33,8 +33,38 @@
#import <AppKit/AppKit.h>
@implementation NSString (GeneratorAddtions)
// those 2 methods are from EOGenerator
/*-
* Copyright (c) 2002-2006 Carl Lindberg and Mike Gentry
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
- (NSString *)initialCapitalString
{
NSRange firstLetterRange;
@ -463,7 +493,7 @@ void addToUsedClasses(NSMutableArray * mutArray,NSSet * knownNames, NSArray * ot
[[eoAttr name] initialCapitalString],
[eoAttr valueClassName], lowStr];
[cs appendFormat:@" [self willChange];\n [_%@ release];\n _%@ = [aValue retain];\n}\n\n",
[cs appendFormat:@" [self willChange];\n ASSIGN(_%@, aValue);\n}\n\n",
lowStr, lowStr];
[cs appendFormat:@"- (%@ *) %@\n{\n return _%@;\n}\n\n", [eoAttr valueClassName], [eoAttr name], lowStr];
}
@ -482,7 +512,7 @@ void addToUsedClasses(NSMutableArray * mutArray,NSSet * knownNames, NSArray * ot
[[eoRel name] initialCapitalString],
[[eoRel destinationEntity] className], lowStr];
[cs appendFormat:@" [self willChange];\n [_%@ release];\n _%@ = [aValue retain];\n}\n\n",
[cs appendFormat:@" [self willChange];\n ASSIGN(_%@, aValue);\n}\n\n",
lowStr, lowStr];
[cs appendFormat:@"- (%@ *)%@\n{\n return _%@;\n}\n\n", [[eoRel destinationEntity] className], [eoRel name], lowStr];
}

View file

@ -235,9 +235,7 @@
- (BOOL) validateMenuItem:(NSMenuItem *)menuItem
{
if (([menuItem action] == @selector(createTemplate:))) {
NSLog(@"validateMenuItem: OK");
if (sel_isEqual([menuItem action], @selector(createTemplate:))) {
return YES;
}

View file

@ -3,12 +3,12 @@
<gsmarkup>
<objects>
<window title="SQL Generation" id="sqlgenWindow" resizable="no">
<window title="SQL Generation" id="sqlgenWindow" resizable="yes">
<vbox leftPadding="10" padding="10">
<box title="SQL Generation Options" topPadding="10"
leftPadding="15" rightPadding="15" width="425">
<hbox halign="wexpand">
<vbox halign="left" valign="wexpand">
<hbox halign="wexpand" valign="top">
<vbox halign="left" valign="top" rightPadding="15">
<button id="dropDatabase" title="Drop Database"
type="switch" halign="left" valign="top"
action="switchChanged:" target="#NSOwner"
@ -17,14 +17,12 @@
type="switch" halign="left" valign="top"
action="switchChanged:" target="#NSOwner"
padding="1.5" />
<vspace />
<button id="dropPKSupport"
title="Drop Primary Key Support" type="switch"
halign="left" valign="bottom"
halign="left" valign="top"
action="switchChanged:" target="#NSOwner"
padding="1.5" />
</vbox>
<hspace />
<vbox halign="right" valign="top">
<button id="createDB" title="Create Database"
type="switch" halign="left" valign="top"

View file

@ -248,6 +248,10 @@
NSString * vType = [self valueType];
unichar myChar;
if ([vType length] < 1) {
return nil;
}
myChar = [vType characterAtIndex:0];
switch (myChar) {