Changeset 700
- Timestamp:
- 07/25/07 02:37:45 (1 year ago)
- Files:
-
- other/dps/trunk/dsss.conf (modified) (1 diff)
- other/dps/trunk/dsssps/components.d (modified) (4 diffs)
- other/dps/trunk/dsssps/dps.d (modified) (9 diffs)
- other/dps/trunk/dsssps/prefs.d (added)
- other/dps/trunk/dsssps/process.d (added)
- other/dps/trunk/sss/conf.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
other/dps/trunk/dsss.conf
r699 r700 3 3 [dsssps/dps.d] 4 4 target=dps 5 6 [foo] other/dps/trunk/dsssps/components.d
r699 r700 1 1 module dsssps.components; 2 3 import tango.io.Console; 2 4 3 5 import tango.sys.Environment; … … 6 8 import wx.wx; 7 9 10 import dsssps.dps; 11 import dsssps.prefs; 12 import dsssps.process; 13 8 14 class Component : wxTreeItemData { 9 void activate() { assert(0, "Bad component."); } 15 void activate(wxTreeCtrl tree, wxEvent e) {} 16 void popupMenu(wxTreeCtrl tree, wxEvent e) {} 10 17 } 11 18 … … 24 31 25 32 /// Edit the file 26 override void activate( )33 override void activate(wxTreeCtrl tree, wxEvent e) 27 34 { 28 (new Process("gvim " ~ name, Environment.get())).execute();35 (new DPSProcessRun(editor ~ " " ~ name, &(dpsApp.loadTopDSSSConf))).Show(false); 29 36 } 30 37 … … 32 39 char[] name; 33 40 } 41 42 class CompFileBuild : CompFile { 43 this(char[] name) { super(name); } 44 45 override void popupMenu(wxTreeCtrl tree, wxEvent e) 46 { 47 // Create the menu 48 wxMenu topMenu = new wxMenu(); 49 50 topMenu.Append(++floatingIds, "Build"); 51 dpsApp.EVT_MENU(floatingIds, &OnBuild); 52 53 topMenu.Append(++floatingIds, "Build Verbose"); 54 dpsApp.EVT_MENU(floatingIds, &OnBuildVerbose); 55 56 // And display it 57 tree.PopupMenu(topMenu, (cast(wxTreeEvent) e).point); 58 } 59 60 /// Callback for building 61 void OnBuild(Object s, wxEvent e) 62 { 63 // FIXME 64 (new DPSProcessWindow("dsss build " ~ fname)).Show(true); 65 } 66 67 /// Callback for building verbose 68 void OnBuildVerbose(Object s, wxEvent e) 69 { 70 // FIXME 71 (new DPSProcessWindow("dsss build " ~ fname ~ " -v")).Show(true); 72 } 73 } 74 75 class CompTop : Component { 76 override void popupMenu(wxTreeCtrl tree, wxEvent e) 77 { 78 // Create a menu on-the-fly with "build" and "edit dsss.conf" 79 wxMenu topMenu = new wxMenu(); 80 81 topMenu.Append(++floatingIds, "Build"); 82 dpsApp.EVT_MENU(floatingIds, &OnBuild); 83 84 topMenu.Append(++floatingIds, "Build Verbose"); 85 dpsApp.EVT_MENU(floatingIds, &OnBuildVerbose); 86 87 topMenu.Append(++floatingIds, "Clean"); 88 dpsApp.EVT_MENU(floatingIds, &OnClean); 89 90 topMenu.Append(++floatingIds, "Edit dsss.conf"); 91 dpsApp.EVT_MENU(floatingIds, &OnEditDSSSConf); 92 93 // Then display it 94 tree.PopupMenu(topMenu, (cast(wxTreeEvent) e).point); 95 } 96 97 /// Callback for building 98 void OnBuild(Object s, wxEvent e) 99 { 100 // FIXME 101 (new DPSProcessWindow("dsss build")).Show(true); 102 } 103 104 /// Callback for building verbose 105 void OnBuildVerbose(Object s, wxEvent e) 106 { 107 // FIXME 108 (new DPSProcessWindow("dsss build -v")).Show(true); 109 } 110 111 /// Callback for cleaning 112 void OnClean(Object s, wxEvent e) 113 { 114 // FIXME 115 (new DPSProcessWindow("dsss distclean")).Show(true); 116 } 117 118 /// Callback for editing 119 void OnEditDSSSConf(Object s, wxEvent e) 120 { 121 // FIXME 122 (new DPSProcessRun(editor ~ " dsss.conf", &(dpsApp.loadTopDSSSConf))).Show(false); 123 } 124 } other/dps/trunk/dsssps/dps.d
r699 r700 24 24 25 25 import dsssps.components; 26 import dsssps.prefs; 26 27 27 28 char[] binPath; … … 33 34 { 34 35 wxTreeCtrl components; /// The components tree 35 36 37 // IDs for important elements 38 enum Elem { Tree, MenuBar, MenuPreferences, MenuQuit }; 39 36 40 /// Load the top dsss.conf file into the components tree 37 41 void loadTopDSSSConf() … … 44 48 DSSSConf conf = readConfig([]); 45 49 50 // set up the head 51 wxTreeItemId top = components.AddRoot(conf.settings[""]["name"], 0, -1, new CompTop()); 52 46 53 // then call loadDSSSConf to load it in 47 wxTreeItemId top = components.AddRoot(conf.settings[""]["name"]);48 54 loadDSSSConf(components, top, conf); 49 55 } … … 85 91 comp = tree.AppendItem(top, 86 92 sect ~ " [binary]", 1, -1, 87 new CompFile (sect));93 new CompFileBuild(sect)); 88 94 89 95 // now use rebuild to get the list … … 108 114 } 109 115 116 // then use rebuild to get the list of non-existing files 117 p = new Process("rebuild -notfound " ~ sect, Environment.get()); 118 p.execute(); 119 flist = null; 120 foreach (line; new LineIterator!(char)(p.stdout)) { 121 flist ~= line.dup; 122 } 123 p.wait(); 124 125 // sort it 126 flist.sort; 127 if (flist.length != 0) { 128 // OK, need to add a not-found section 129 wxTreeItemId notfound = 130 tree.AppendItem(comp, 131 "Non-existent files", 0, -1); 132 133 foreach (file; flist) { 134 tree.AppendItem(notfound, 135 file, 1, -1, 136 new CompFile(file)); 137 } 138 } 139 110 140 } else { 111 141 // otherwise, just the top … … 118 148 } 119 149 120 // IDs for important elements121 enum Elem { Tree };122 123 150 public override bool OnInit() 124 151 { 125 152 wxFrame frame = new wxFrame(null, wxID_ANY, "DSSS Project Studio"); 153 154 // set up the menus 155 wxMenu fileMenu = new wxMenu(); 156 157 fileMenu.Append(Elem.MenuPreferences, "Preferences"); 158 EVT_MENU(Elem.MenuPreferences, &OnPreferences); 159 160 fileMenu.Append(Elem.MenuQuit, "Quit"); 161 EVT_MENU(Elem.MenuQuit, &OnQuit); 162 163 wxMenuBar menuBar = new wxMenuBar(); 164 menuBar.Append(fileMenu, "File"); 165 frame.menuBar(menuBar); 126 166 127 167 // get some images for the tree … … 134 174 components.AssignImageList(il); 135 175 EVT_TREE_ITEM_ACTIVATED(Elem.Tree, &activatedFile); 176 EVT_TREE_ITEM_RIGHT_CLICK(Elem.Tree, &treeMenu); 136 177 137 178 // load in the dsss.conf file … … 148 189 { 149 190 // s should be a wxTreeItemId 150 s = e.EventObject(); 151 if (cast(wxTreeCtrl) s is null) { 152 return; 153 } 154 wxTreeCtrl wtc = cast(wxTreeCtrl) s; 155 191 wxTreeCtrl wtc = cast(wxTreeCtrl) e.EventObject(); 156 192 wxTreeItemId i = wtc.Selection(); 157 193 wxTreeItemData d = wtc.GetItemData(i); … … 160 196 if (c !is null) { 161 197 // activate it 162 c.activate( );198 c.activate(wtc, e); 163 199 } 164 200 } 165 201 } 202 203 /// Pop up the menu for the tree 204 void treeMenu(Object s, wxEvent e) 205 { 206 wxTreeCtrl wtc = cast(wxTreeCtrl) e.EventObject(); 207 wxTreeItemId i = wtc.Selection(); 208 wxTreeItemData d = wtc.GetItemData(i); 209 if (d !is null) { 210 Component c = cast(Component) d; 211 if (c !is null) { 212 c.popupMenu(wtc, e); 213 } 214 } 215 } 216 217 /// Pressed "preferences" 218 void OnPreferences(Object s, wxEvent e) 219 { 220 Cout("Preferences.").newline; 221 } 222 223 /// Pressed "Quit" 224 void OnQuit(Object s, wxEvent e) 225 { 226 exit(0); 227 } 166 228 } 229 230 DPSApp dpsApp; 231 232 /// Use this int for "floating" wx IDs: ++floatingIds to get a new one 233 int floatingIds = 99; 167 234 168 235 int main(char[][] args) 169 236 { 170 237 binPath = Environment.exePath(args[0]).path(); 171 DPSApp app = new DPSApp(); 172 app.Run(); 238 loadPrefs(args[0]); 239 dpsApp = new DPSApp(); 240 dpsApp.Run(); 173 241 return 0; 174 242 } other/dps/trunk/sss/conf.d
r699 r700 432 432 char[] confFile; 433 433 434 if ((new FilePath(configF Name)).exists()) {434 if ((new FilePath(configF)).exists()) { 435 435 if (genconfig) { 436 436 // this makes no sense … … 439 439 } 440 440 441 // before reading the config, distclean if it's changed442 if (configF == configFName) {443 if ((new FilePath(configLBName)).exists()) {444 if (fileNewer(configFName, configLBName)) {445 // our config has changed446 distclean(readConfig(null, false, configLBName));447 }448 }449 450 // copy in our new dsss.lastbuild451 (new FilePath(configLBName)).copy(configFName);452 }453 454 441 // Read the config file 455 confFile = cast(char[]) (new File(configF Name)).read();442 confFile = cast(char[]) (new File(configF)).read(); 456 443 } else { 457 444 // Generate the config file … … 479 466 if (genconfig) { 480 467 // write it 481 (new File(configF Name)).write(confFile);468 (new File(configF)).write(confFile); 482 469 } 483 470 … … 916 903 proc = new Process(cmd); 917 904 } 905 proc.execute(); 918 906 919 907 // now catch its output
