Changeset 362

Show
Ignore:
Timestamp:
12/31/07 02:08:47 (1 year ago)
Author:
JJR
Message:

move signal imports out of classes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wrap/utils/GtkDClass.d

    r361 r362  
    5757private import utils.funct; 
    5858 
     59private import std.ctype; 
     60private import std.path; 
     61private import std.stdio; 
     62private import std.string; 
     63 
    5964public class GtkDClass 
    6065{ 
    61  
    62     private import std.ctype; 
    63     private import std.path; 
    64     private import std.stdio; 
    65     private import std.string; 
    66  
    67     //Moved up... for dsss: 
    68     //private import utils.HtmlStrip; 
    69     //private import utils.WrapperIF; 
    70     //private import utils.convparms; 
    71     //private import utils.funct; 
    72  
    7366    private WrapperIF wrapper; 
    7467    private char[] inAPI; 
     
    238231        gtkDText ~= getNoAssertVersion(); */ 
    239232 
    240         // moved to class level 
    241                 /* Type information should be publicly imported by all modules. */ 
    242         gtkDText ~= "public import " ~convParms.bindDir~ "." ~convParms.outPack~ "types;\n\n"; 
     233        /* Type information should be publicly imported by all modules. */ 
     234        gtkDText ~= "public  import " ~convParms.bindDir~ "." ~convParms.outPack~ "types;\n\n"; 
    243235        gtkDText ~= "private import " ~convParms.bindDir~ "." ~convParms.outPack ~ ";\n\n"; 
    244  
    245         // moved bac to class level 
     236         
     237        // move signal imports out of classes - JJR 
     238        if (needSignalImports) 
     239        { 
     240            int i = moveToBlockStart("Signal Details", inLines); 
     241            // if "Signal Details" exists in API Lines 
     242            // than we know that we need signal imports. 
     243            if (i < inLines.length) 
     244            { 
     245                gtkDText ~= "private import gobject.Signals;\n"; 
     246                gtkDText ~= "public  import gtkc.gdktypes;\n"; 
     247            }    
     248        }    
    246249         
    247250        // the use of phobs is limited, maybe we can get by with this... 
     
    300303        { 
    301304            gtkDText ~= importTango; 
    302             gtkDText ~= importElse~"}\n\n"; 
     305            gtkDText ~= importElse~"}\n"; 
    303306        } 
    304307 
     
    888891 
    889892        int i = moveToBlockStart("Signal Details", inLines); 
     893         
    890894        i += 2; 
     895         
    891896        debug(getSignal)if(i<inLines.length)writefln("\t %s", inLines[i]); 
    892897 
     
    934939            char[] delegateDeclaration = fun.getDelegateDeclaration(convParms, 1); 
    935940 
    936             addSignalImports(text); 
     941            // Removed function "addSignalImports" and replaced it  
     942            // with simple "if" block to make sure class local imports 
     943            // don't get added - JJR 
     944             
     945            if ( needSignalImports ) 
     946            { 
     947                if ( !isInterface ) 
     948                { 
     949                    text ~= "int[char[]] connectedSignals;"; 
     950                } 
     951                text ~= ""; 
     952 
     953                needSignalImports = false; 
     954            } 
     955 
    937956            text ~= delegateDeclaration ~ "[] on" ~ gtkDSignal~"Listeners;" ; 
    938957            addAddListener(text, signalName, gtkDSignal, delegateDeclaration); 
     
    10601079    } 
    10611080 
    1062     /** 
    1063      * adding: 
    1064      * "private import gobject.Signals;" 
    1065      * "private import gdk.gdktypes;" 
    1066      * Params: 
    1067      *      text = 
    1068      */ 
    1069     void addSignalImports(inout char[][] text) 
    1070     { 
    1071         if ( needSignalImports ) 
    1072         { 
    1073             text ~= ""; 
    1074             text ~= "// imports for the signal processing"; 
    1075             text ~= "private import gobject.Signals;"; 
    1076             text ~= "private import gtkc.gdktypes;"; 
    1077             if ( !isInterface ) 
    1078             { 
    1079                 text ~= "int[char[]] connectedSignals;"; 
    1080             } 
    1081             text ~= ""; 
    1082  
    1083             needSignalImports = false; 
    1084  
    1085         } 
    1086     } 
    10871081 
    10881082    private char[] getSignalFunctionDeclaration(inout int line, char[][] lines)