Changeset 704

Show
Ignore:
Timestamp:
07/25/07 11:37:05 (1 year ago)
Author:
Gregor
Message:

Changed how subdirs work - now can open as project, but does not expand into project.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • other/dps/trunk/dsss.conf

    r700 r704  
    33[dsssps/dps.d] 
    44target=dps 
    5  
    6 [foo] 
  • other/dps/trunk/dsssps/components.d

    r703 r704  
    11module dsssps.components; 
    22 
     3import tango.io.Console; 
    34import tango.io.File; 
     5import tango.io.FileSystem; 
    46 
    57import tango.sys.Environment; 
     
    127129} 
    128130 
     131/// Top component 
    129132class CompTop : Component { 
    130133    override void popupMenu(wxTreeCtrl tree, wxEvent e) 
     
    177180    } 
    178181} 
     182 
     183/// Component for subdirectories, can build or open as a project 
     184class CompSubdir : Component { 
     185    this(char[] name) 
     186    { 
     187        this.name = name.dup; 
     188    } 
     189 
     190    char[] fname() 
     191    { 
     192        return name.dup; 
     193    } 
     194 
     195    override void popupMenu(wxTreeCtrl tree, wxEvent e) 
     196    { 
     197        // Create a menu on-the-fly with "build" and "edit dsss.conf" 
     198        wxMenu topMenu = new wxMenu(); 
     199         
     200        topMenu.Append(++floatingIds, "Build"); 
     201        dpsApp.EVT_MENU(floatingIds, &OnBuild); 
     202 
     203        topMenu.Append(++floatingIds, "Build Verbose"); 
     204        dpsApp.EVT_MENU(floatingIds, &OnBuildVerbose); 
     205 
     206        topMenu.Append(++floatingIds, "Clean"); 
     207        dpsApp.EVT_MENU(floatingIds, &OnClean); 
     208 
     209        topMenu.Append(++floatingIds, "Open as project"); 
     210        dpsApp.EVT_MENU(floatingIds, &OnOpen); 
     211 
     212        // Then display it 
     213        tree.PopupMenu(topMenu, (cast(wxTreeEvent) e).point); 
     214    } 
     215 
     216    /// Callback for building 
     217    void OnBuild(Object s, wxEvent e) 
     218    { 
     219        // FIXME 
     220        (new DPSProcessWindow("dsss build " ~ name)).Show(true); 
     221    } 
     222 
     223    /// Callback for building verbose 
     224    void OnBuildVerbose(Object s, wxEvent e) 
     225    { 
     226        // FIXME 
     227        (new DPSProcessWindow("dsss build -v " ~ name)).Show(true); 
     228    } 
     229 
     230    /// Callback for cleaning 
     231    void OnClean(Object s, wxEvent e) 
     232    { 
     233        // FIXME 
     234        (new DPSProcessWindow("dsss distclean " ~ name)).Show(true); 
     235    } 
     236 
     237    /// Callback for opening 
     238    void OnOpen(Object s, wxEvent e) 
     239    { 
     240        // chdir to it, then run DPS 
     241        char[] origdir = FileSystem.getDirectory(); 
     242        try { 
     243            Cout("DIR: ")(name).newline; 
     244            FileSystem.setDirectory(name); 
     245            Cout("DPS: ")(dpsBinPath).newline; 
     246            (new Process(dpsBinPath, Environment.get())).execute(); 
     247        } catch (Exception e) {} // ignore failures (FIXME) 
     248        FileSystem.setDirectory(origdir); 
     249    } 
     250 
     251    private: 
     252    char[] name; 
     253} 
  • other/dps/trunk/dsssps/dps.d

    r702 r704  
    2525import dsssps.components; 
    2626import dsssps.prefs; 
    27  
    28 char[] binPath; 
    2927 
    3028/** 
     
    7876                // recurse to load the subdir 
    7977                comp = tree.AppendItem(top, 
    80                     sect ~ " [subdir]", 0); 
    81  
    82                 char[] origwd = FileSystem.getDirectory(); 
    83                 try { 
    84                     FileSystem.setDirectory(sect); 
    85                     DSSSConf sdconf = readConfig([]); 
    86                     loadDSSSConf(tree, comp, sdconf); 
    87                 } catch (Exception e) { 
    88                     // failures ignored, will just be a smaller tree 
    89                 } 
    90                 FileSystem.setDirectory(origwd); 
     78                    sect ~ " [subdir]", 0, -1, new CompSubdir(sect)); 
    9179 
    9280            } else if (conf.settings[sect]["type"] == "binary") { 
     
    171159        // get some images for the tree 
    172160        wxImageList il = new wxImageList(); 
    173         il.Add(new wxBitmap(binPath ~ "/folder.png", BitmapType.wxBITMAP_TYPE_PNG)); 
    174         il.Add(new wxBitmap(binPath ~ "/text-x-generic.png", BitmapType.wxBITMAP_TYPE_PNG)); 
     161        il.Add(new wxBitmap(dpsBinDir ~ "/folder.png", BitmapType.wxBITMAP_TYPE_PNG)); 
     162        il.Add(new wxBitmap(dpsBinDir ~ "/text-x-generic.png", BitmapType.wxBITMAP_TYPE_PNG)); 
    175163         
    176164        // now set up the tree 
     
    239227int main(char[][] args) 
    240228{ 
    241     binPath = Environment.exePath(args[0]).path(); 
    242229    loadPrefs(args[0]); 
    243230    dpsApp = new DPSApp(); 
  • other/dps/trunk/dsssps/prefs.d

    r700 r704  
    22 
    33import tango.io.FileConst; 
     4import tango.io.FilePath; 
    45 
    56import tango.sys.Environment; 
     
    89 
    910char[] prefFile = ".dpsrc"; 
     11 
     12/// The path to DPS itself 
     13char[] dpsBinPath; 
     14 
     15/// And the directory in which DPS resides 
     16char[] dpsBinDir; 
    1017 
    1118/// DSSS directory 
     
    2532{ 
    2633    char[] defDir; 
     34 
     35    FilePath dbp = Environment.exePath(argvz); 
     36    dpsBinPath = dbp.toUtf8().dup; 
     37    dpsBinDir = dbp.path().dup; 
    2738 
    2839    // figure out the proper preference file