[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] GUI-doc redirection mechanism



Here is a draft of the redirect stubs generator.

It adds a utility class method  to Helper,  *makeGUIStubs.

This method uses an html template in Help/GUI/stubs/StubTemplate.html.
(this makes it very easy to edit the template).

The method iterates over all registered GUI schemes, and lists links to
the doc file of each scheme at the bottom of the help file.

I would propose that the distro contains ready-made stubs for CocoaGUI
and SwingGUI, and that the stubs themselves contain an instruction for
regenerating themselves, so that people can simply execute a line of
code and then have stubs for their own configuration.

For the generator to work now, you must create the stubs directory and
put the StubTemplate.html there.

I may still have to tweak the help path calculation for alternate kits.

If this is basically ok, I will commit it. We can tweak it later. That
way testing it will be easier

jostM

% a cross-platform redirector for a GUI widget


Inherits from: Object : ViewRedirecter


A Cross-platform redirect class for a %. This class will create and return the platform/editor specific version of a %. 


You can configure the help system to automatically redirect the  implementation class by... 


See also: GUI, GUI Classes, GUI Overview


Platform Specific Examples and Documentation:


If you do not see your GUI kit listed here, then execute the following code to regenerate the GUI stubs.

(

Helper.makeGUIStubs; // this may take a moment to complete

Document.current.close;  // this document will close when the update is finished

)


Some of the following links might not work, if the help files for the listed kit are not included in your setup:


%%



+ Helper{

*makeGUIStubs {arg classesArray, path;
	var template, tfile;
	path= path ? "Help/GUI/stubs/";
	
	tfile=File(path++"StubTemplate.html","r");
	template=tfile.readAllString;
	tfile.close;
	
	classesArray = classesArray ?  ViewRedirecter.allSubclasses;
	
	classesArray.do {arg class;
		var file, content, name, string, links="";
		content="test";
		(path++class.name.asString++".html").postln;
		file=File(path++class.name.asString++".html", "w");
		
		name=class.key.asString;
		name[0]=name[0].toUpper;
		
		GUI.schemes.do{arg scheme;
			var nm, helpFilePath="";
			try{nm=scheme.perform(class.key).name.asString;
			{helpFilePath=nm.findHelpFile.replace(Platform.helpDir++"/","")}.try({helpFilePath=nm++".html"});
			links=links++(("<p class=\"p1\"><b>%:<span class=\"Apple-tab-span\">     </span>"
				++"</b><a href=\"../../%\">%</a></p><p class=\"p1\"></p>")
				.format(scheme ,helpFilePath,nm));
			};
		
		};
		
		string=template.replace("%%",links);
		
		string=string.replace("%",name);

		file.write(string);
		file.close;
	
	}
		

}


}