From stefan at fresco.org Sat Feb 1 19:54:04 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:08 2005 Subject: [Fresco-changes] Fresco/Berlin configure.ac,1.59,1.60 Message-ID: Update of /cvs/fresco/Fresco/Berlin In directory purcel:/tmp/cvs-serv23122/Berlin Modified Files: configure.ac Log Message: little fix to let Berlin correctly detect omniORB again Index: configure.ac =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/configure.ac,v retrieving revision 1.59 retrieving revision 1.60 diff -u -d -r1.59 -r1.60 --- configure.ac 29 Jan 2003 13:53:24 -0000 1.59 +++ configure.ac 1 Feb 2003 19:54:02 -0000 1.60 @@ -98,6 +98,11 @@ enabled_drawing_kits="$enabled_drawing_kits Drawing/openGL" fi +dnl this test is needed so we catch colocation-optimization +dnl flags that need to make their way into the acconfig.hh file +dnl we need to find a better way to do this ! -stefan +FRESCO_ORB + dnl ------------------------------------------------------------------ dnl Prague, Babylon, and Fresco dnl ------------------------------------------------------------------ @@ -125,10 +130,6 @@ AC_SUBST(INSTALL_CPPFLAGS) AC_SUBST(INSTALL_LIBS) AC_SUBST(Fresco_IDL_prefix) - -dnl this test is needed so we catch colocation-optimization -dnl flags that need to make their way into the acconfig.hh file -FRESCO_ORB dnl ------------------------------------------------------------------ dnl some helper utils From neiljp at fresco.org Fri Feb 7 04:32:49 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:08 2005 Subject: [Fresco-changes] Fresco/Fresco-Python-demos/src berlin.py,1.13,1.14 Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python-demos/src In directory purcel:/tmp/cvs-serv11617 Modified Files: berlin.py Log Message: Update python module to new server resolution methods. Closes task68. Index: berlin.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/berlin.py,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- berlin.py 28 Jan 2003 03:34:31 -0000 1.13 +++ berlin.py 7 Feb 2003 04:32:45 -0000 1.14 @@ -10,7 +10,7 @@ instances of the Kits and Connection objects. """ -import sys, string, threading +import sys, os, string, threading # Import omniORBpy stuff from omniORB import CORBA @@ -72,99 +72,165 @@ objects. It loads _defaultKitNames as the default set of kits, but more can be added using the add_kit method.""" def __init__(self): - """Initialise the Kits singleton, and insert it into the global - (berlin module) namespace""" - global kits - kits = self - self._kitNames = {} - self._kitNames.update(_defaultKitNames) - self._kitObjects = {} + """Initialise the Kits singleton, and insert it into the global + (berlin module) namespace""" + global kits + kits = self + self._kitNames = {} + self._kitNames.update(_defaultKitNames) + self._kitObjects = {} def add_kit(self, name, module, kit): - """Adds the given kit to the list of accessable kits""" - self._kitNames[name] = (module, kit) + """Adds the given kit to the list of accessable kits""" + self._kitNames[name] = (module, kit) def __getattr__(self, kit): - """Returns a cached kit. If the kit is not already cached, then it is - looked up using the list of kits that you can update with add_kit()""" - # Check cache - if self._kitObjects.has_key(kit): - return self._kitObjects[kit] - # Try and resolve - if self._kitNames.has_key(kit): - # Find and resolve the kit - module, name = self._kitNames[kit] - idl = "IDL:fresco.org/%s/%s:1.0"%self._kitNames[kit] - obj = connection.context.resolve(idl, []) - cls = globals()[module].__dict__[name] - obj = obj._narrow(cls) - if obj is not None: - self._kitObjects[kit] = obj - return obj - # Raise an exception to signal error - raise NameError, "Kit '%s' not found."%kit + """Returns a cached kit. If the kit is not already cached, then it is + looked up using the list of kits that you can update with add_kit()""" + # Check cache + if self._kitObjects.has_key(kit): + return self._kitObjects[kit] + # Try and resolve + if self._kitNames.has_key(kit): + # Find and resolve the kit + module, name = self._kitNames[kit] + idl = "IDL:fresco.org/%s/%s:1.0"%self._kitNames[kit] + obj = connection.context.resolve(idl, []) + cls = globals()[module].__dict__[name] + obj = obj._narrow(cls) + if obj is not None: + self._kitObjects[kit] = obj + return obj + # Raise an exception to signal error + raise NameError, "Kit '%s' not found."%kit class Connection: """Connection wrapper that does all the CORBA stuff""" def __init__(self, clientContext=None): - """Initialises the singleton, inserts it into the global (berlin - module) namespace, and finds the Berlin server. You may pass your own - ClientContext object (not CORBA var!), else a ClientContextImpl will - be used.""" - global connection - connection = self + """Initialises the singleton, inserts it into the global (berlin + module) namespace, and finds the Berlin server. You may pass your own + ClientContext object (not CORBA var!), else a ClientContextImpl will + be used.""" + global connection + connection = self - # Initialise the ORB - #omniORB.maxTcpConnectionPerServer(100) - self.orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) + # Initialise the ORB + #omniORB.maxTcpConnectionPerServer(100) + self.orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) - # Find the POA - self.poa = self.orb.resolve_initial_references("RootPOA") - # Activate the POA - self.poaManager = self.poa._get_the_POAManager() - self.poaManager.activate() + # Find the POA + self.poa = self.orb.resolve_initial_references("RootPOA") + # Activate the POA + self.poaManager = self.poa._get_the_POAManager() + self.poaManager.activate() - # Create an ClientContext - if clientContext is None: clientContext = ClientContextImpl() - # Create an object reference, and implicitly activate the object - self.clientContext = clientContext._this() + # Create an ClientContext + if clientContext is None: clientContext = ClientContextImpl() + # Create an object reference, and implicitly activate the object + self.clientContext = clientContext._this() - # get a server context - object = self.orb.resolve_initial_references("NameService") - context = object._narrow(CosNaming.NamingContext) - name = [CosNaming.NameComponent("FrescoServer", "Object")] - object = context.resolve(name) - self.server = object._narrow(Fresco.Server) - #print "Got Server var =",self.server - #print "Client Context var =",self.clientContext - self.context = self.server.create_server_context(self.clientContext) + # Default arguments + export_ref = ior_file_path = server_id = stringified_ior = "" + + # Parse argument list + try: + index = sys.argv.index("-R") or sys.argv.index("--export-ref") + if index >= 1: export_ref = sys.argv[index+1] + except: + pass + + try: + index = sys.argv.index("-I") or sys.argv.index("--ior-file-path") + if index >= 1: ior_file_path = sys.argv[index+1] + except: + pass + + try: + index = sys.argv.index("-i") or sys.argv.index("--server-id") + if index >= 1: server_id = sys.argv[index+1] + except: + pass + + # Use $FRESCO_DISPLAY if the argument list is empty + if export_ref == "" and ior_file_path == "" and server_id == "": + if os.environ.has_key("FRESCO_DISPLAY"): + stringified_ior = os.environ["FRESCO_DISPLAY"] + + # Set defaults + if export_ref == "": export_ref = "ior" + if ior_file_path == "": ior_file_path = "/tmp/fresco" + if server_id == "": server_id = "FrescoServer" + + # Try with $FRESCO_DISPLAY + if stringified_ior != "": + object = self.orb.string_to_object(stringified_ior) + else: + # Try with other methods + if export_ref == "nameserver": + object = self.orb.resolve_initial_references("NameService") + context = object._narrow(CosNaming.NamingContext) + try: + name = [CosNaming.NameComponent(server_id, "Object")] + object = context.resolve(name) + except: + print >> sys.stderr, \ + "ERROR: Could not find specified server-id in" \ + "nameservice\n" + sys.exit(1) + elif export_ref == "corbaloc": + print "Not implemented yet" + sys.exit(1) + elif export_ref == "ior": + ior_filename = os.path.join(ior_file_path, server_id) + try: + ior_file = open(ior_filename) + stringified_ior = ior_file.readline().rstrip() + except: + print >> sys.stderr, "ERROR: Cannot open %s\n" \ + "This could signify that the server is not running\n" \ + "or that a server is running" \ + "but with a different -I option parameter.\n" \ + "If the latter, use the same option\n" \ + "with this client as with the server.\n" \ + "This could also signify that a server is running but\n" \ + "its address is being\n" \ + "published using another method; try the -R option." \ + % ior_filename + sys.exit(1) + object = self.orb.string_to_object(stringified_ior) + ior_file.close() + del ior_file + self.server = object._narrow(Fresco.Server) + self.context = self.server.create_server_context(self.clientContext) + #print "Got Server var =",self.server + #print "Client Context var =",self.clientContext class KBThread (threading.Thread): """A thread that waits for the user to hit enter, and then signals an application quit. This assumes there is a global var called 'app' with an attribute called 'quit' that is a threading.Event object""" def run(self): - "Run until enter" - print "Hit ENTER to quit." - while 1: - line = sys.stdin.readline() - if len(line) == 1: break - self.do_quit() + "Run until enter" + print "Hit ENTER to quit." + while 1: + line = sys.stdin.readline() + if len(line) == 1: break + self.do_quit() def do_quit(self): - "Override if you want to quit some other way" - app.quit.set() + "Override if you want to quit some other way" + app.quit.set() class App: "Base class for applications with some default useful functionality" def __init__(self): - """Creates global kits and connection objects, the app.quit Event - object, and a KBThread to set it.""" - global app - app = self - self.quit = threading.Event() # set quit to.. quit :) - self.kbthread = KBThread() - self.kbthread.setDaemon(1) # dont wait for kb thread :) - self.kbthread.start() + """Creates global kits and connection objects, the app.quit Event + object, and a KBThread to set it.""" + global app + app = self + self.quit = threading.Event() # set quit to.. quit :) + self.kbthread = KBThread() + self.kbthread.setDaemon(1) # dont wait for kb thread :) + self.kbthread.start() def Label(string): @@ -175,11 +241,11 @@ """Small wrapper command which calls a python function with a single argument which is the Any.""" def __init__(self, callback): - self.callback = callback + self.callback = callback def execute(self, any): - print "Callback to",self.callback,"with",any - if self.callback: - self.callback(any) + print "Callback to",self.callback,"with",any + if self.callback: + self.callback(any) # vim: ts=8:sts=4:sw=4 From nicholas at fresco.org Sat Feb 8 02:12:42 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:08 2005 Subject: [Fresco-changes] Fresco/Berlin/server ServerContextImpl.cc,1.6,1.7 Message-ID: Update of /cvs/fresco/Fresco/Berlin/server In directory purcel:/tmp/cvs-serv309 Modified Files: ServerContextImpl.cc Log Message: Remove unused variable with side-effect CORBA call in destructor. Index: ServerContextImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/server/ServerContextImpl.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ServerContextImpl.cc 27 Nov 2002 23:02:53 -0000 1.6 +++ ServerContextImpl.cc 8 Feb 2003 02:12:39 -0000 1.7 @@ -57,7 +57,6 @@ Trace trace("ServerContextImpl::~ServerContextImpl"); for (klist_t::iterator i = _kits.begin(); i != _kits.end(); ++i) (*i).second->decrement(); - Babylon::String title = Unicode::to_internal(*_client->application_title()); Logger::log(Logger::corba) << "ServerContext " << (void *)(this) << " destructed." << std::endl; } From nicholas at fresco.org Sat Feb 8 02:42:05 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:08 2005 Subject: [Fresco-changes] Fresco/GGI/demos ggiwrapper.cc,1.14,1.15 Message-ID: Update of /cvs/fresco/Fresco/GGI/demos In directory purcel:/tmp/cvs-serv1093 Modified Files: ggiwrapper.cc Log Message: Changed short option forms to -x and -y for --width and --height respectively. The ggiwrapper no longer aborts on startup! Index: ggiwrapper.cc =================================================================== RCS file: /cvs/fresco/Fresco/GGI/demos/ggiwrapper.cc,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- ggiwrapper.cc 7 Nov 2002 18:53:11 -0000 1.14 +++ ggiwrapper.cc 8 Feb 2003 02:42:03 -0000 1.15 @@ -48,8 +48,8 @@ GetOpt getopt(argv[0], "a berlin client demonstrating the Canvas"); getopt.add('h', "help", GetOpt::novalue, "help message"); getopt.add('r', "run", GetOpt::mandatory, "the ggi program to run"); - getopt.add('w', "width", GetOpt::mandatory, "the width of the visual"); - getopt.add('h', "height", GetOpt::mandatory, "the height of the visual"); + getopt.add('x', "width", GetOpt::mandatory, "the width of the visual"); + getopt.add('y', "height", GetOpt::mandatory, "the height of the visual"); add_resolving_options_to_getopt(getopt); getopt.parse(argc - 1, argv + 1); From neiljp at fresco.org Sat Feb 8 06:46:13 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/include/Berlin PNG.hh,1.2,1.3 Message-ID: Update of /cvs/fresco/Fresco/Berlin/include/Berlin In directory purcel:/tmp/cvs-serv18475/Berlin/include/Berlin Modified Files: PNG.hh Log Message: Fix typo and long-lines Index: PNG.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/PNG.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- PNG.hh 29 May 2002 06:49:38 -0000 1.2 +++ PNG.hh 8 Feb 2003 06:46:10 -0000 1.3 @@ -53,16 +53,23 @@ Fresco::Raster::Data *marshal(unsigned char *const *); unsigned char **demarshal(const Fresco::Raster::Data &); Fresco::Color pixel(unsigned long, unsigned long, unsigned char *const *); - void pixel(unsigned long, unsigned long, const Fresco::Color &, unsigned char **); - Fresco::Raster::ColorSeq *pixels(unsigned long, unsigned long, unsigned long, unsigned long, unsigned char *const *); - void pixels(unsigned long, unsigned long, unsigned long, unsigned long, const Fresco::Raster::ColorSeq &, unsigned char **); + void pixel(unsigned long, unsigned long, const Fresco::Color &, + unsigned char **); + Fresco::Raster::ColorSeq *pixels(unsigned long, unsigned long, unsigned long, + unsigned long, unsigned char *const *); + void pixels(unsigned long, unsigned long, unsigned long, unsigned long, + const Fresco::Raster::ColorSeq &, unsigned char **); unsigned char **read(const std::string &); void write(const std::string &, unsigned char *const *); private: - void palette_to_rgbalpha(const unsigned char *, const unsigned char *, unsigned char *); - void gray_to_rgbalpha(const unsigned char *, const unsigned char *, unsigned char *); - void grayalpha_to_rgbalpha(const unsigned char *, const unsigned char *, unsigned char *); - void rgb_to_rgbalpha(const unsigned char *, const unsigned char *, unsigned char *); + void palette_to_rgbalpha(const unsigned char *, const unsigned char *, + unsigned char *); + void gray_to_rgbalpha(const unsigned char *, const unsigned char *, + unsigned char *); + void grayalpha_to_rgbalpha(const unsigned char *, const unsigned char *, + unsigned char *); + void rgb_to_rgbalpha(const unsigned char *, const unsigned char *, + unsigned char *); png_structp _rpng; png_infop _rinfo; png_infop _rend; From neiljp at fresco.org Sat Feb 8 06:46:13 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Fresco-IDL/share/idl/Fresco ImageKit.idl,1.6,1.7 Message-ID: Update of /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco In directory purcel:/tmp/cvs-serv18475/Fresco-IDL/share/idl/Fresco Modified Files: ImageKit.idl Log Message: Fix typo and long-lines Index: ImageKit.idl =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco/ImageKit.idl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ImageKit.idl 25 Jan 2003 12:43:48 -0000 1.6 +++ ImageKit.idl 8 Feb 2003 06:46:11 -0000 1.7 @@ -41,7 +41,7 @@ //. all of the nasty details related to layout and so forth. interface ImageKit : Kit { - //. Create a empty Raster. + //. Create an empty Raster. Raster create_empty_raster(); //. Create a Raster from a file. 'rasterpath' from Berlin's config file //. is prepended! If the file is not found a the ImageKit From neiljp at fresco.org Sat Feb 8 20:45:18 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/include/Berlin Console.hh,1.29,1.30 Message-ID: Update of /cvs/fresco/Fresco/Berlin/include/Berlin In directory purcel:/tmp/cvs-serv11810/Berlin/include/Berlin Modified Files: Console.hh Log Message: - Tidy comments - Add -C/--list-available-consoles option to server (towards bug129) - Implement support in the console for the new option - Refactor Console::open to use the new support functions Index: Console.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/Console.hh,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- Console.hh 12 Jan 2003 02:25:08 -0000 1.29 +++ Console.hh 8 Feb 2003 20:45:16 -0000 1.30 @@ -32,6 +32,7 @@ #include #include #include +#include //. This is an abstraction of the underlying graphics libraries Berlin uses. //. The DrawingKits call the methods of this object. @@ -79,11 +80,17 @@ }; + //. List available consoles (modules) + static void list_available(ostream &); + + //. Check whether a particular console (module) is avilable + static bool is_available(std::string const &console); //. Sets up the graphics library. It gets passed the commandline arguments - //. of the server (argc and argv), checks them for any console-related options and - //. afterwards passes them on to the graphic's library. Finally you need to pass - //. the POA to this method. + //. of the server (argc and argv), checks them for any console-related + //. options and afterwards passes them on to the graphic's library. + //. Finally you need to pass the POA to this method. + // FIXME: argc/argv are unused? are we still aiming for cascading GetOpt? static int open(const std::string &, int argc, char **argv, PortableServer::POA_ptr, Fresco::PixelCoord x, Fresco::PixelCoord y) @@ -103,7 +110,8 @@ Fresco::PixelCoord, //.< Requested y size. Fresco::PixelCoord) = 0; //.< Requested color depth. - //. Activates a given drawable: After activation it can recieve requests via CORBA. + //. Activates a given drawable: After activation it can recieve requests + //. via CORBA. Fresco::Drawable_ptr activate_drawable(Drawable *); //. FIXME: Missing documentation! PortableServer::Servant reference_to_servant(Fresco::Drawable_ptr); @@ -148,6 +156,11 @@ static Console *_console; static Reaper _reaper; elist_t _extensions; + + typedef std::map console_list_t; + static console_list_t my_available_consoles; + //. Attempt to load all consoles, and cache their name/location + static void cache_available_consoles(); }; //. This is a chunk of (video-) memory that is used to store raster data. From neiljp at fresco.org Sat Feb 8 20:45:19 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/server server.cc,1.65,1.66 Message-ID: Update of /cvs/fresco/Fresco/Berlin/server In directory purcel:/tmp/cvs-serv11810/Berlin/server Modified Files: server.cc Log Message: - Tidy comments - Add -C/--list-available-consoles option to server (towards bug129) - Implement support in the console for the new option - Refactor Console::open to use the new support functions Index: server.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/server/server.cc,v retrieving revision 1.65 retrieving revision 1.66 diff -u -d -r1.65 -r1.66 --- server.cc 23 Jan 2003 00:43:01 -0000 1.65 +++ server.cc 8 Feb 2003 20:45:16 -0000 1.66 @@ -203,8 +203,11 @@ "the resource file to load"); getopt.add('e', "execute", GetOpt::mandatory, "the command to execute upon startup"); - getopt.add('c', "console", GetOpt::mandatory, "the console to choose"); - getopt.add('s', "pixels", GetOpt::mandatory, "number of pixels (eg. '640x480')"); + getopt.add('c', "console", GetOpt::mandatory, "the console to use"); + getopt.add('C', "list-available-consoles", GetOpt::novalue, + "list known consoles"); + getopt.add('s', "pixels", GetOpt::mandatory, + "number of pixels (eg. '640x480')"); size_t argo = getopt.parse(argc, argv); argc -= argo; argv += argo; @@ -228,7 +231,7 @@ getopt.get("export-ref",&value); set_server_reference_export_method(value); } - + value=""; if (getopt.get("logger", &value)) { @@ -345,6 +348,13 @@ Logger::log(Logger::loader) << "Tracing enabled." << std::endl; } + if (getopt.is_set("list-available-consoles")) + { + std::cout << "Available consoles:" << endl; + Console::list_available(std::cout); + return 0; + } + #ifdef JPROF if (getopt.is_set("profiler")) { @@ -448,7 +458,7 @@ catch (const std::runtime_error &e) { std::cerr << "ERROR: Failed to open the Console \"" << value - << "\": " << e.what() << std::endl; + << "\":\n\t" << e.what() << std::endl; exit(2); } From neiljp at fresco.org Sat Feb 8 20:45:19 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/src Console.cc,1.12,1.13 Message-ID: Update of /cvs/fresco/Fresco/Berlin/src In directory purcel:/tmp/cvs-serv11810/Berlin/src Modified Files: Console.cc Log Message: - Tidy comments - Add -C/--list-available-consoles option to server (towards bug129) - Implement support in the console for the new option - Refactor Console::open to use the new support functions Index: Console.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/Console.cc,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- Console.cc 29 Oct 2002 02:28:48 -0000 1.12 +++ Console.cc 8 Feb 2003 20:45:16 -0000 1.13 @@ -36,8 +36,6 @@ Plugin *plugin = 0; }; - - // --------------------------------------------------------------- // class Console // --------------------------------------------------------------- @@ -50,43 +48,96 @@ delete plugin; } +Console::console_list_t Console::my_available_consoles; + +void Console::cache_available_consoles() +{ + static bool cached = false; + if (cached) return; + + Prague::Path path = RCManager::get_path("modulepath"); + for (Prague::Path::iterator path_elt = path.begin(), path_end = path.end(); + path_elt != path_end; ++path_elt) + { + Directory dir(*path_elt + "/Console", Directory::alpha, "\\.so$"); + for (Directory::iterator file = dir.begin(), last_file = dir.end(); + file != last_file; ++file) + { + try { plugin = new Plugin((*file)->long_name());} + catch (const std::runtime_error &e) + { + Logger::log(Logger::loader) << "Plugin '" << (*file)->name() + << "' is not loadable [" << e.what() << "]" + << std::endl; + continue; + } + delete plugin; + plugin = 0; + std::string name = (*file)->name(); + unsigned const dotpos = name.find(".so"); // FIXME breaks if in middle + name = name.substr(0,dotpos); + my_available_consoles.insert(std::make_pair(name,(*file)->long_name())); + } + } + cached = true; +} + +void Console::list_available(std::ostream & o) +{ + cache_available_consoles(); + for (console_list_t::const_iterator iter = my_available_consoles.begin(), + end = my_available_consoles.end(); + iter != end; ++iter) + { + o << iter->first << " (" << iter->second << ")" << endl; + } +} + +bool Console::is_available(std::string const &console) +{ + cache_available_consoles(); + if (my_available_consoles.find(console) != my_available_consoles.end()) + return true; + return false; +} + int Console::open(const std::string &console, int argc, char **argv, PortableServer::POA_ptr poa, Fresco::PixelCoord x, Fresco::PixelCoord y) throw(std::runtime_error) { - Prague::Path path = RCManager::get_path("modulepath"); - + cache_available_consoles(); + if (my_available_consoles.size()==0) + { + throw std::runtime_error("No valid consoles found in modulepath"); + } if (!console.empty()) - { + { // Console name given: Load exactly the one specified - std::string name = path.lookup_file(std::string("Console/") + console + ".so"); - if (name.empty()) - { - std::string msg = "No console named \"" + console + "\" found in modulepath."; - throw std::runtime_error(msg); - } - else plugin = new Plugin(name); - } - else - // No specific console requested: load whichever is found first - for (Prague::Path::iterator i = path.begin(); i != path.end(); ++i) + if (!is_available(console)) { - Directory directory(*i + "/Console", Directory::alpha, "\\.so$"); - for (Directory::iterator j = directory.begin(); - j != directory.end() && !plugin; - ++j) - try { plugin = new Plugin((*j)->long_name());} - - catch (const std::runtime_error &e) - { - Logger::log(Logger::loader) << (*j)->name() << " not loadable " - << e.what() << std::endl; - continue; - } + std::string const msg = "No console named \"" + console + + "\" found in modulepath."; + throw std::runtime_error(msg); } - if (!plugin) throw std::runtime_error("No console found in modulepath."); + else plugin = new Plugin(my_available_consoles[console]); + } + else + { + // No specific console requested: load the one which is found first + std::string const & console_name = my_available_consoles.begin()->first; + try + { + plugin = new Plugin(my_available_consoles[console_name]); + } + catch (std::runtime_error const &) + { + std::string const msg = "Previously-found console " + console_name + + " not available."; + throw std::runtime_error(msg); + } + } _console = (*plugin)->load(argc, argv, x, y); _console->_poa = PortableServer::POA::_duplicate(poa); return argc; From neiljp at fresco.org Sat Feb 8 21:17:27 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/server server.cc,1.66,1.67 Message-ID: Update of /cvs/fresco/Fresco/Berlin/server In directory purcel:/tmp/cvs-serv13230/Berlin/server Modified Files: server.cc Log Message: Make -c server option refer to -C, to obtain possible values Index: server.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/server/server.cc,v retrieving revision 1.66 retrieving revision 1.67 diff -u -d -r1.66 -r1.67 --- server.cc 8 Feb 2003 20:45:16 -0000 1.66 +++ server.cc 8 Feb 2003 21:17:25 -0000 1.67 @@ -203,7 +203,8 @@ "the resource file to load"); getopt.add('e', "execute", GetOpt::mandatory, "the command to execute upon startup"); - getopt.add('c', "console", GetOpt::mandatory, "the console to use"); + getopt.add('c', "console", GetOpt::mandatory, + "console to use (use -C for possible values)"); getopt.add('C', "list-available-consoles", GetOpt::novalue, "list known consoles"); getopt.add('s', "pixels", GetOpt::mandatory, @@ -491,8 +492,8 @@ if (!value.empty()) props[0].value = CORBA::string_dup(value.c_str()); else props[0].value = CORBA::string_dup("LibArtDrawingKit"); DrawingKit_var drawing = - server->resolve("IDL:fresco.org/Fresco/DrawingKit:1.0", - props, poa); + server->resolve("IDL:fresco.org/Fresco/DrawingKit:1.0", + props, poa); Logger::log(Logger::drawing) << "DrawingKit is resolved." << std::endl; if (CORBA::is_nil(drawing)) { From neiljp at fresco.org Sun Feb 9 19:03:56 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/src PNG.cc,1.5,1.6 RasterImpl.cc,1.4,1.5 Message-ID: Update of /cvs/fresco/Fresco/Berlin/src In directory purcel:/tmp/cvs-serv31030/Berlin/src Modified Files: PNG.cc RasterImpl.cc Log Message: Better error handling if rasters are not located, or are invalid. Closes bug178. Index: PNG.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/PNG.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- PNG.cc 2 Jun 2002 23:42:19 -0000 1.5 +++ PNG.cc 9 Feb 2003 19:03:54 -0000 1.6 @@ -157,7 +157,6 @@ } inline unsigned char **PNG::Decoder::decode() - { Trace trace("PNGDecoder::decode"); if (!_valid) @@ -352,7 +351,10 @@ { unsigned char **rows = 0; std::ifstream ifs(file.c_str()); - if (!ifs) std::cerr << "PNG : file " << file << " unreadable" << std::endl; + if (!ifs.is_open()) + { + std::cerr << "PNG : file " << file << " unreadable" << std::endl; + } else { Decoder decoder(ifs.rdbuf(), _rpng, _rinfo, _rend); Index: RasterImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/RasterImpl.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- RasterImpl.cc 4 Jan 2003 13:47:18 -0000 1.4 +++ RasterImpl.cc 9 Feb 2003 19:03:54 -0000 1.5 @@ -35,21 +35,20 @@ Prague::Path path = RCManager::get_path("rasterpath"); std::string pngfile = path.lookup_file(file); if (pngfile.empty()) - { - std::cerr << "RasterImpl Warning : can't find '" << file << "' in current rasterpath" << std::endl; - pngfile = path.lookup_file("berlin-128.png"); - } + { + std::cerr << "RasterImpl Warning : can't find '" << file + << "' in current rasterpath" << std::endl; + throw CreationFailureException(); + } + _rows = _png.read(pngfile); - if (!_rows) - { - std::cerr << "RasterImpl error: can't read " << pngfile << std::endl; - pngfile = path.lookup_file("berlin-128.png"); - _rows = _png.read(pngfile); - if (!_rows) { - std::cerr << "RasterImpl fatal error: can't read " << pngfile << std::endl; - exit(-1); - } - } + + if (_rows == 0) + { + std::cerr << "RasterImpl Warning : can't read '" << file + << "' in current rasterpath" << std::endl; + throw CreationFailureException(); + } } RasterImpl::~RasterImpl() { Trace trace("RasterImpl::~RasterImpl");} void RasterImpl::clear() From neiljp at fresco.org Sun Feb 9 19:03:57 2003 From: neiljp at fresco.org (Neil John Pilgrim) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Fresco-IDL/share/idl/Fresco ImageKit.idl,1.7,1.8 Message-ID: Update of /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco In directory purcel:/tmp/cvs-serv31030/Fresco-IDL/share/idl/Fresco Modified Files: ImageKit.idl Log Message: Better error handling if rasters are not located, or are invalid. Closes bug178. Index: ImageKit.idl =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco/ImageKit.idl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ImageKit.idl 8 Feb 2003 06:46:11 -0000 1.7 +++ ImageKit.idl 9 Feb 2003 19:03:54 -0000 1.8 @@ -49,7 +49,7 @@ // FIXME: This should throw an exception if the file is not found. // The current behaviour is not useful for real-world // applications. - Raster create_raster(in string file); + Raster create_raster(in string file) raises (CreationFailureException); }; }; From nicholas at fresco.org Sun Feb 9 19:14:38 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/include/Berlin Console.hh,1.30,1.31 Message-ID: Update of /cvs/fresco/Fresco/Berlin/include/Berlin In directory purcel:/tmp/cvs-serv31554/Berlin/include/Berlin Modified Files: Console.hh Log Message: Add missing std namespace qualifier. Index: Console.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/Console.hh,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- Console.hh 8 Feb 2003 20:45:16 -0000 1.30 +++ Console.hh 9 Feb 2003 19:14:36 -0000 1.31 @@ -81,7 +81,7 @@ }; //. List available consoles (modules) - static void list_available(ostream &); + static void list_available(std::ostream &); //. Check whether a particular console (module) is avilable static bool is_available(std::string const &console); From nicholas at fresco.org Sun Feb 9 19:14:39 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/src Console.cc,1.13,1.14 Message-ID: Update of /cvs/fresco/Fresco/Berlin/src In directory purcel:/tmp/cvs-serv31554/Berlin/src Modified Files: Console.cc Log Message: Add missing std namespace qualifier. Index: Console.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/Console.cc,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Console.cc 8 Feb 2003 20:45:16 -0000 1.13 +++ Console.cc 9 Feb 2003 19:14:36 -0000 1.14 @@ -89,7 +89,7 @@ end = my_available_consoles.end(); iter != end; ++iter) { - o << iter->first << " (" << iter->second << ")" << endl; + o << iter->first << " (" << iter->second << ")" << std::endl; } } From nicholas at fresco.org Sun Feb 9 19:23:55 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/server server.cc,1.67,1.68 Message-ID: Update of /cvs/fresco/Fresco/Berlin/server In directory purcel:/tmp/cvs-serv31921/Berlin/server Modified Files: server.cc Log Message: Fix missing std namespace. Fix typo. Index: server.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/server/server.cc,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- server.cc 8 Feb 2003 21:17:25 -0000 1.67 +++ server.cc 9 Feb 2003 19:23:52 -0000 1.68 @@ -351,7 +351,7 @@ if (getopt.is_set("list-available-consoles")) { - std::cout << "Available consoles:" << endl; + std::cout << "Available consoles:" << std::endl; Console::list_available(std::cout); return 0; } @@ -360,7 +360,7 @@ if (getopt.is_set("profiler")) { setupProfilingStuff(); - Logger::log(Logger::loader) << "Profiling anabled." << std::endl; + Logger::log(Logger::loader) << "Profiling enabled." << std::endl; } #endif From nicholas at fresco.org Mon Feb 10 14:58:34 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] web/hosts/issues/detectors newissues.py,1.2,1.3 Message-ID: Update of /cvs/fresco/web/hosts/issues/detectors In directory purcel:/tmp/cvs-serv13530 Modified Files: newissues.py Log Message: Don't throw exception where there are no users to notify. Fixes bug237. Index: newissues.py =================================================================== RCS file: /cvs/fresco/web/hosts/issues/detectors/newissues.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- newissues.py 29 Jan 2003 01:41:35 -0000 1.2 +++ newissues.py 10 Feb 2003 14:58:31 -0000 1.3 @@ -18,12 +18,13 @@ break # send a copy to all interested users - for msgid in cl.get(nodeid, 'messages'): - try: - # note: last arg must be a list - cl.send_message(nodeid, msgid, change_note, users) - except roundupdb.MessageSendError, message: - raise roundupdb.DetectorError, message + if users: + for msgid in cl.get(nodeid, 'messages'): + try: + # note: last arg must be a list + cl.send_message(nodeid, msgid, change_note, users) + except roundupdb.MessageSendError, message: + raise roundupdb.DetectorError, message def init(db): db.bug.react('create', notify) From stefan at fresco.org Tue Feb 11 02:58:39 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Fresco-Python setup.py.in,NONE,1.1 Makefile.in,1.10,1.11 configure.ac,1.17,1.18 Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python In directory purcel:/tmp/cvs-serv5962 Modified Files: Makefile.in configure.ac Added Files: setup.py.in Log Message: let 'make install' use python's distutils --- NEW FILE: setup.py.in --- #!/usr/bin/env python from distutils.core import setup setup(name="Fresco", version="@PACKAGE_VERSION@", description="Fresco Python bindings", url="http://www.fresco.org", packages=["Fresco"]) Index: Makefile.in =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python/Makefile.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.in 20 Nov 2002 07:14:20 -0000 1.10 +++ Makefile.in 11 Feb 2003 02:58:37 -0000 1.11 @@ -21,7 +21,9 @@ SHELL := /bin/sh +prefix := @prefix@ top_srcdir := @top_srcdir@ +srcdir := @srcdir@ subdirs := Fresco # insert inter-directory dependencies below @@ -44,12 +46,12 @@ doc: #do nothing here install: - $(MAKE) action="install" + ./setup.py install --prefix=$(prefix) install-doc: #do nothing here uninstall: - $(MAKE) action="uninstall" + rm -rf `./setup.py packagedir` clean: $(MAKE) action="clean" Index: configure.ac =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python/configure.ac,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- configure.ac 10 Dec 2002 05:46:18 -0000 1.17 +++ configure.ac 11 Feb 2003 02:58:37 -0000 1.18 @@ -27,7 +27,7 @@ AC_PREREQ(2.52) AC_REVISION($Revision$) -AC_INIT(Berlin, M3, devel@fresco.org) +AC_INIT(Berlin, M1, devel@fresco.org) AC_CONFIG_AUX_DIR(config) dnl ------------------------------------------------------------------ @@ -41,12 +41,22 @@ AC_SUBST(Fresco_IDL_prefix) +AC_PATH_PROGS([python_program], [python python1.6 python2.1 python2.2]) +if test ".$python_program" == "." ; then + AC_MSG_ERROR([can't install Python bindings without interpreter]) +fi + dnl ------------------------------------------------------------------ dnl Output substitution dnl ------------------------------------------------------------------ dnl AC_MSG_PART(Output Substitution) -AC_CONFIG_FILES([config/local.mk Makefile Fresco/Makefile:config/Makefile.omniorb.in]) +AC_CONFIG_FILES([setup.py], [chmod +x setup.py]) +AC_CONFIG_FILES([config/local.mk]) +AC_CONFIG_FILES([Makefile Fresco/Makefile:config/Makefile.omniorb.in]) +if test "$srcdir" != .; then + AC_CONFIG_LINKS([Fresco/__init__.py:Fresco/__init__.py]) +fi -AC_OUTPUT \ No newline at end of file +AC_OUTPUT From stefan at fresco.org Tue Feb 11 02:58:40 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Fresco-Python/Fresco __init__.py,NONE,1.1 Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python/Fresco In directory purcel:/tmp/cvs-serv5962/Fresco Added Files: __init__.py Log Message: let 'make install' use python's distutils --- NEW FILE: __init__.py --- # Python Berlin client library # Copyright (c) 2000 by Stephen Davies # This file is licensed for use under the GPL # # Tabstop is 8, SoftTabStop is 4, ShiftWidth is 4 (as per last line) # """ Import from this module to connect to the Berlin server and access the kits therein. Use the get_kits() and get_connection() functions to access instances of the Kits and Connection objects. """ import sys, os, string, threading # Import omniORBpy stuff from omniORB import CORBA import omniORB, CosNaming # Import the Fresco stubs import Unidraw import Fresco__POA class ExitCommand(Fresco__POA.Command): def execute(self, any): app.quit.set() class ClientContextImpl (Fresco__POA.ClientContext): "A default implementation of the ClientContext interface" def _get_user_name(self): return US("joe") def _get_application_title(self): return US("python demo") def exit(self): return ExitCommand()._this() def ping(self): return def US(s): "Convert the given python string to a Unistring" return map(lambda x:ord(x), s) # The default kits available. More can be added using kits.add_kit() # TODO: include version and property information in the tuple _defaultKitNames = { 'tool' : ('Fresco', 'ToolKit'), 'image' : ('Fresco', 'ImageKit'), 'figure' : ('Fresco', 'FigureKit'), 'primitive': ('Fresco', 'PrimitiveKit'), 'command' : ('Fresco', 'CommandKit'), 'gadget' : ('Fresco', 'GadgetKit'), 'desktop' : ('Fresco', 'DesktopKit'), 'layout' : ('Fresco', 'LayoutKit'), 'text' : ('Fresco', 'TextKit'), 'widget' : ('Fresco', 'WidgetKit'), 'unidraw' : ('Unidraw', 'UnidrawKit'), } # An empty Any object for sending to Commands nullAny = CORBA.Any(CORBA.TC_null, None) # You should use these functions instead of directly creating instances def get_kits(): "Return a Kits singleton" if not kits: return Kits() return kits def get_connection(clientContext = None): """Return a Connection singleton. If it doesn't already exist, one is created using the ClientContext parameter""" if not connection: return Connection(clientContext) return connection # The global vars kits = None connection = None class Kits: """This class resolves kits upon request, and caches the resolved kit objects. It loads _defaultKitNames as the default set of kits, but more can be added using the add_kit method.""" def __init__(self): """Initialise the Kits singleton, and insert it into the global (berlin module) namespace""" global kits kits = self self._kitNames = {} self._kitNames.update(_defaultKitNames) self._kitObjects = {} def add_kit(self, name, module, kit): """Adds the given kit to the list of accessable kits""" self._kitNames[name] = (module, kit) def __getattr__(self, kit): """Returns a cached kit. If the kit is not already cached, then it is looked up using the list of kits that you can update with add_kit()""" # Check cache if self._kitObjects.has_key(kit): return self._kitObjects[kit] # Try and resolve if self._kitNames.has_key(kit): # Find and resolve the kit module, name = self._kitNames[kit] idl = "IDL:fresco.org/%s/%s:1.0"%self._kitNames[kit] obj = connection.context.resolve(idl, []) cls = globals()[module].__dict__[name] obj = obj._narrow(cls) if obj is not None: self._kitObjects[kit] = obj return obj # Raise an exception to signal error raise NameError, "Kit '%s' not found."%kit class Connection: """Connection wrapper that does all the CORBA stuff""" def __init__(self, clientContext=None): """Initialises the singleton, inserts it into the global (berlin module) namespace, and finds the Berlin server. You may pass your own ClientContext object (not CORBA var!), else a ClientContextImpl will be used.""" global connection connection = self # Initialise the ORB #omniORB.maxTcpConnectionPerServer(100) self.orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID) # Find the POA self.poa = self.orb.resolve_initial_references("RootPOA") # Activate the POA self.poaManager = self.poa._get_the_POAManager() self.poaManager.activate() # Create an ClientContext if clientContext is None: clientContext = ClientContextImpl() # Create an object reference, and implicitly activate the object self.clientContext = clientContext._this() # Default arguments export_ref = ior_file_path = server_id = stringified_ior = "" # Parse argument list try: index = sys.argv.index("-R") or sys.argv.index("--export-ref") if index >= 1: export_ref = sys.argv[index+1] except: pass try: index = sys.argv.index("-I") or sys.argv.index("--ior-file-path") if index >= 1: ior_file_path = sys.argv[index+1] except: pass try: index = sys.argv.index("-i") or sys.argv.index("--server-id") if index >= 1: server_id = sys.argv[index+1] except: pass # Use $FRESCO_DISPLAY if the argument list is empty if export_ref == "" and ior_file_path == "" and server_id == "": if os.environ.has_key("FRESCO_DISPLAY"): stringified_ior = os.environ["FRESCO_DISPLAY"] # Set defaults if export_ref == "": export_ref = "ior" if ior_file_path == "": ior_file_path = "/tmp/fresco" if server_id == "": server_id = "FrescoServer" # Try with $FRESCO_DISPLAY if stringified_ior != "": object = self.orb.string_to_object(stringified_ior) else: # Try with other methods if export_ref == "nameserver": object = self.orb.resolve_initial_references("NameService") context = object._narrow(CosNaming.NamingContext) try: name = [CosNaming.NameComponent(server_id, "Object")] object = context.resolve(name) except: print >> sys.stderr, \ "ERROR: Could not find specified server-id in" \ "nameservice\n" sys.exit(1) elif export_ref == "corbaloc": print "Not implemented yet" sys.exit(1) elif export_ref == "ior": ior_filename = os.path.join(ior_file_path, server_id) try: ior_file = open(ior_filename) stringified_ior = ior_file.readline().rstrip() except: print >> sys.stderr, "ERROR: Cannot open %s\n" \ "This could signify that the server is not running\n" \ "or that a server is running" \ "but with a different -I option parameter.\n" \ "If the latter, use the same option\n" \ "with this client as with the server.\n" \ "This could also signify that a server is running but\n" \ "its address is being\n" \ "published using another method; try the -R option." \ % ior_filename sys.exit(1) object = self.orb.string_to_object(stringified_ior) ior_file.close() del ior_file self.server = object._narrow(Fresco.Server) self.context = self.server.create_server_context(self.clientContext) #print "Got Server var =",self.server #print "Client Context var =",self.clientContext class KBThread (threading.Thread): """A thread that waits for the user to hit enter, and then signals an application quit. This assumes there is a global var called 'app' with an attribute called 'quit' that is a threading.Event object""" def run(self): "Run until enter" print "Hit ENTER to quit." while 1: line = sys.stdin.readline() if len(line) == 1: break self.do_quit() def do_quit(self): "Override if you want to quit some other way" app.quit.set() class App: "Base class for applications with some default useful functionality" def __init__(self): """Creates global kits and connection objects, the app.quit Event object, and a KBThread to set it.""" global app app = self self.quit = threading.Event() # set quit to.. quit :) self.kbthread = KBThread() self.kbthread.setDaemon(1) # dont wait for kb thread :) self.kbthread.start() def Label(string): "Creates a black label from the given string" return kits.tool.rgb(kits.text.chunk(US(string)),0.,0.,0.) class Callback(Fresco__POA.Command): """Small wrapper command which calls a python function with a single argument which is the Any.""" def __init__(self, callback): self.callback = callback def execute(self, any): print "Callback to",self.callback,"with",any if self.callback: self.callback(any) # vim: ts=8:sts=4:sw=4 From stefan at fresco.org Tue Feb 11 02:58:40 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Fresco-Python/config Makefile.omniorb.in,1.21,1.22 Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python/config In directory purcel:/tmp/cvs-serv5962/config Modified Files: Makefile.omniorb.in Log Message: let 'make install' use python's distutils Index: Makefile.omniorb.in =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python/config/Makefile.omniorb.in,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.omniorb.in 10 Dec 2002 05:46:19 -0000 1.21 +++ Makefile.omniorb.in 11 Feb 2003 02:58:37 -0000 1.22 @@ -51,24 +51,10 @@ PACKAGES := $(PACKAGES) $(PACKAGES:%=%__POA) PACKAGES := $(PACKAGES) Fresco/Input Fresco__POA/Input -PACKAGE_DST := $(PACKAGES:%=$(DESTDIR)$(libdir)/python/%/__init__.py) - TARGET := $(SRC) all: $(TARGET) -install_files: all - $(SHTOOL) mkdir -f -p -m 755 $(DESTDIR)$(libdir)/python - $(SHTOOL) install -C -m 755 $(TARGET) $(DESTDIR)$(libdir)/python - -$(DESTDIR)$(libdir)/python/%/__init__.py: %/__init__.py - $(SHTOOL) mkdir -f -p -m 755 $(@D) - $(SHTOOL) install -C -m 755 $< $(@D) - -install_packages: all $(PACKAGE_DST) - -install: install_files install_packages - clean: rm -rf $(SRC) $(CMP) Input Figure Fresco Layout *__POA *~ @@ -80,4 +66,7 @@ $(SRC): %_idl.py: $(idir)/Fresco/%.idl @echo generating $(@F) $(IDLPY) $(IDLPYFLAGS) $< + mv -f $(@F) $(@F).old + cat $(@F).old | sed -e "s,@Fresco_IDL_prefix@,$(prefix)," > $(@F) + rm -f $(@F).old From njs at fresco.org Wed Feb 12 03:58:55 2003 From: njs at fresco.org (Nathaniel Smith) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] web/hosts/www installing.xml,1.9,1.10 Message-ID: Update of /cvs/fresco/web/hosts/www In directory purcel:/tmp/cvs-serv7403/hosts/www Modified Files: installing.xml Log Message: Fix link to snapshots (catch thanks to David T. Pierson) Index: installing.xml =================================================================== RCS file: /cvs/fresco/web/hosts/www/installing.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- installing.xml 3 Oct 2002 04:05:55 -0000 1.9 +++ installing.xml 12 Feb 2003 03:58:52 -0000 1.10 @@ -24,7 +24,7 @@ There are currently three ways to download Fresco. You can check out the sources directly from CVS, - download a nightly snapshot, + download a nightly snapshot, or you can get release packages. Configuration From tobias at fresco.org Thu Feb 13 15:52:11 2003 From: tobias at fresco.org (Tobias Hunger) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/contrib/daVinci/src Makefile.in,1.4,1.5 Message-ID: Update of /cvs/fresco/Fresco/contrib/daVinci/src In directory purcel:/tmp/cvs-serv12121 Modified Files: Makefile.in Log Message: Clean up the generated dependency files on make clean. Index: Makefile.in =================================================================== RCS file: /cvs/fresco/Fresco/contrib/daVinci/src/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.in 10 Dec 2002 05:46:28 -0000 1.4 +++ Makefile.in 13 Feb 2003 15:52:08 -0000 1.5 @@ -72,7 +72,7 @@ clean: rm -f $(TARGET) - rm -f *.o + rm -f *.o *.d distclean: clean rm -f Makefile config.log config.status From tobias at fresco.org Sat Feb 15 20:38:34 2003 From: tobias at fresco.org (Tobias Hunger) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] web/hosts/www developing.xml,1.10,1.11 Message-ID: Update of /cvs/fresco/web/hosts/www In directory purcel:/tmp/cvs-serv22722 Modified Files: developing.xml Log Message: Add a quote. Index: developing.xml =================================================================== RCS file: /cvs/fresco/web/hosts/www/developing.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- developing.xml 28 Nov 2002 19:14:50 -0000 1.10 +++ developing.xml 15 Feb 2003 20:38:31 -0000 1.11 @@ -8,7 +8,14 @@ Joining the Development Effort - + +
+ "I mean, if 10 years from now, when you are doing something quick and + dirty, you suddenly visualize that I am looking over your shoulders and + say to yourself, 'Dijkstra would not have liked this', well that would + be enough immortality for me" --Edsger Dijkstra +
+ If you want to help develop Fresco, then you'll first need to get the version running; make sure you have the Dependencies installed, and then read how to get started on the From tobias at fresco.org Sat Feb 15 20:58:20 2003 From: tobias at fresco.org (Tobias Hunger) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] web/hosts/www docs_i.xml,1.10,1.11 Message-ID: Update of /cvs/fresco/web/hosts/www In directory purcel:/tmp/cvs-serv23284/hosts/www Modified Files: docs_i.xml Log Message: Upload slides from my presentation on FOSDEM 2003 in Brussels. I added the version with the slides and some notes quick and dirty notes of mine. Index: docs_i.xml =================================================================== RCS file: /cvs/fresco/web/hosts/www/docs_i.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- docs_i.xml 8 Nov 2002 00:11:06 -0000 1.10 +++ docs_i.xml 15 Feb 2003 20:58:17 -0000 1.11 @@ -20,7 +20,8 @@
  • (Stuttgart, Germany)
  • -
  • (Ottawa, Canada)
  • +
  • (Ottawa, Canada)
  • +
  • (Brussels, Belgium)

From tobias at fresco.org Sat Feb 15 20:58:20 2003 From: tobias at fresco.org (Tobias Hunger) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] web/data links.xml,1.42,1.43 Message-ID: Update of /cvs/fresco/web/data In directory purcel:/tmp/cvs-serv23284/data Modified Files: links.xml Log Message: Upload slides from my presentation on FOSDEM 2003 in Brussels. I added the version with the slides and some notes quick and dirty notes of mine. Index: links.xml =================================================================== RCS file: /cvs/fresco/web/data/links.xml,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- links.xml 12 Jan 2003 14:33:43 -0000 1.42 +++ links.xml 15 Feb 2003 20:58:17 -0000 1.43 @@ -235,7 +235,14 @@ LinuxTag 2000 (HTML) LinuxTag 2000 (Stuttgart, Germany) - + + + fosdem2003_notes.pdf + all + FOSDEM 2003 (PDF incl. notes) + FOSDEM 2003 (Brussels, Belgium) + + http://www.linux-magazin.de/Artikel/ausgabe/2000/12/BerlinProjekt/BerlinProjekt.html all From tobias at fresco.org Sat Feb 15 20:58:21 2003 From: tobias at fresco.org (Tobias Hunger) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] web/data/docs fosdem2003_notes.pdf,NONE,1.1 Message-ID: Update of /cvs/fresco/web/data/docs In directory purcel:/tmp/cvs-serv23284/data/docs Added Files: fosdem2003_notes.pdf Log Message: Upload slides from my presentation on FOSDEM 2003 in Brussels. I added the version with the slides and some notes quick and dirty notes of mine. --- NEW FILE: fosdem2003_notes.pdf --- (This appears to be a binary file; contents omitted.) From nicholas at fresco.org Sun Feb 16 03:47:49 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Fresco-IDL/share/idl/Fresco Font.idl,1.4,1.5 FontKit.idl,1.1,1.2 Message-ID: Update of /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco In directory purcel:/tmp/cvs-serv2948/Fresco-IDL/share/idl/Fresco Modified Files: Font.idl FontKit.idl Log Message: It compiles. It doesn't work. Index: Font.idl =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco/Font.idl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Font.idl 12 Jan 2003 02:54:09 -0000 1.4 +++ Font.idl 16 Feb 2003 03:47:46 -0000 1.5 @@ -41,7 +41,7 @@ // for horizontally reading fonts, or // horizontally to the center line of vertical // fonts. - Coord underline_offset, underline_width; + Coord underline_offset, underline_thickness; }; enum SegmentType { move, line, conic, cubic }; @@ -69,7 +69,7 @@ Coord italic_correction; }; - interface Glyph + interface Glyph : RefCountBase, Identifiable { Raster bitmap(); FontShape decompose(); @@ -79,7 +79,7 @@ interface Font : RefCountBase, Identifiable { - Glyph glyph_char(in Unichar c); + Glyph glyph_char(in Unichar c, in unsigned short xdpi, in unsigned short ydpi); // need glyph_something for composite characters. // also need to support multiple master fonts. Hm. Index: FontKit.idl =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco/FontKit.idl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- FontKit.idl 7 Jan 2003 02:20:37 -0000 1.1 +++ FontKit.idl 16 Feb 2003 03:47:46 -0000 1.2 @@ -43,6 +43,7 @@ interface FontKit : Kit { + //. supply the One True Font. Font _default(); //. inform the FontKit of a new Font Font filename(in string file, in Unistring style, in Coord size); From nicholas at fresco.org Sun Feb 16 03:47:49 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/modules/Fonts Makefile.in,NONE,1.1 Font.cc,1.2,1.3 Font.hh,1.1,1.2 FontKitImpl.cc,1.3,1.4 FontKitImpl.hh,1.4,1.5 Glyph.cc,1.2,1.3 Glyph.hh,1.2,1.3 Message-ID: Update of /cvs/fresco/Fresco/Berlin/modules/Fonts In directory purcel:/tmp/cvs-serv2948/Berlin/modules/Fonts Modified Files: Font.cc Font.hh FontKitImpl.cc FontKitImpl.hh Glyph.cc Glyph.hh Added Files: Makefile.in Log Message: It compiles. It doesn't work. --- NEW FILE: Makefile.in --- # $Id: Makefile.in,v 1.1 2003/02/16 03:47:47 nicholas Exp $ # # This source file is a part of the Fresco Project. # Copyright (C) 1999, 2000 Stefan Seefeld # http://www.fresco.org # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 675 Mass Ave, Cambridge, # MA 02139, USA. SHELL := /bin/sh abs_top_srcdir := @abs_top_srcdir@ top_builddir := @top_builddir@ srcdir := $(abs_top_srcdir)/modules/Fonts cdir := $(top_builddir)/config include $(cdir)/local.mk EXTRA_CPPFLAGS += @FREETYPE_CPPFLAGS@ EXTRA_LIBS += @FREETYPE_LIBS@ SRC := Font.cc FontKitImpl.cc Glyph.cc MODULE := FontKit include $(cdir)/module.mk Index: Font.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Font.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Font.cc 12 Jan 2003 02:54:09 -0000 1.2 +++ Font.cc 16 Feb 2003 03:47:47 -0000 1.3 @@ -24,82 +24,83 @@ namespace Berlin { -namespace Font +namespace FontKit { -Font::Font(const char *filename, int size, int xdpi, int ydpi, - FT_Library library) - : my_ftlib(library), my_size(size), my_xdpi(xdpi), my_ydpi(ydpi) +Font::Font(const char *filename, int size, FT_Library library) + : my_ftlib(library), my_size(size) { - FT_New_Face(my_ftlib, filename.c_str(), 0, &my_face); - FT_Set_Char_Size(my_face, 0, my_size*64, xdpi, ydpi); + FT_New_Face(my_ftlib, filename, 0, &my_face); + FT_Set_Char_Size(my_face, 0, my_size*64, 0, 0); } Font::~Font() {} -Glyph_ptr Font::glyph_char(Unichar c) +Fresco::Glyph_ptr Font::glyph_char(Fresco::Unichar c, short unsigned int xdpi, short unsigned int ydpi) { - return new Glyph(my_face, FT_Get_Char_Index(my_face, (FT_ULong)uc)); + FT_Set_Char_Size(my_face, 0, my_size*64, xdpi, ydpi); + GlyphImpl *glyph = new GlyphImpl(my_face, c); + return Fresco::Glyph_var(glyph->_this()); } -bool Font::has_char(Unichar c) +CORBA::Boolean Font::has_char(Fresco::Unichar c) { - return true; + return FT_Get_Char_Index(my_face, c); } -bool Font::can_display(Unichar begin, Unichar end) +CORBA::Boolean Font::can_display(Fresco::Unichar begin, Fresco::Unichar end) { return true; } -Unistring Font::encoding() +Fresco::Unistring *Font::encoding() { - // + return new Fresco::Unistring(Unicode::to_CORBA(Babylon::String("encoding NYI"))); } -Unistring Font::font_family() +Fresco::Unistring *Font::font_family() { - return new Unistring(Unicode::to_CORBA(Babylon::String(my_face->family_name))); + return new Fresco::Unistring(Unicode::to_CORBA(Babylon::String(my_face->family_name))); } -Unistring Font::font_style() +Fresco::Unistring *Font::font_style() { - return new Unistring(Unicode::to_CORBA(Babylon::String(my_face->style_name))); + return new Fresco::Unistring(Unicode::to_CORBA(Babylon::String(my_face->style_name))); } -Unistring Font::fullname() +Fresco::Unistring *Font::fullname() { - // ?? + return new Fresco::Unistring(Unicode::to_CORBA(Babylon::String("Fullname NYI"))); } -void Font::font_metrics(FontMetrics &fm) +void Font::font_metrics(Fresco::FontMetrics &fm) { fm.ascent = my_face->ascender; fm.descent = my_face->descender; fm.baseline = my_face->height; fm.underline_offset = my_face->underline_position; - fm.underline_thickness = my_face->underline_width; + fm.underline_thickness = my_face->underline_thickness; } -Coord height() const +Fresco::Coord Font::height() { return my_size; } -float angle() +CORBA::Float Font::angle() { float angle = 0.; void *htable = FT_Get_Sfnt_Table(my_face, ft_sfnt_hhea); if (htable) { - TT_HoriHeader *header = *htable; + TT_HoriHeader *header = (TT_HoriHeader*)htable; if (header->caret_Slope_Run != 0) angle = header->caret_Slope_Rise / header->caret_Slope_Run; } void *vtable = FT_Get_Sfnt_Table(my_face, ft_sfnt_vhea); if (vtable) { - TT_VertHeader *header = *vtable; + TT_VertHeader *header = (TT_VertHeader*)vtable; if (header->caret_Slope_Run != 0) angle = header->caret_Slope_Rise / header->caret_Slope_Run; } @@ -107,20 +108,20 @@ return angle; } -float caret_offset() +CORBA::Float Font::caret_offset() { float offset = 0.; void *htable = FT_Get_Sfnt_Table(my_face, ft_sfnt_hhea); if (htable) { - TT_HoriHeader *header = *htable; + TT_HoriHeader *header = (TT_HoriHeader*)htable; if (header->caret_Offset != 0) offset = header->caret_Offset; } void *vtable = FT_Get_Sfnt_Table(my_face, ft_sfnt_vhea); if (vtable) { - TT_VertHeader *header = *vtable; + TT_VertHeader *header = (TT_VertHeader*)vtable; if (header->caret_Slope_Run != 0) offset = header->caret_Offset; } Index: Font.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Font.hh,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Font.hh 8 Jan 2003 01:42:31 -0000 1.1 +++ Font.hh 16 Feb 2003 03:47:47 -0000 1.2 @@ -19,41 +19,53 @@ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * MA 02139, USA. */ -#ifndef _Font_hh -#define _Font_hh +#ifndef _FontKit_Font_hh +#define _FontKit_Font_hh #include #include -#include "Berlin/RefCountBaseImpl.hh" -#include "Berlin/IdentifiableImpl.hh" +#include +#include +#include +#include "Glyph.hh" #include #include FT_FREETYPE_H +#include FT_TRUETYPE_TABLES_H + +namespace Berlin +{ +namespace FontKit +{ class Font : public virtual POA_Fresco::Font, public virtual RefCountBaseImpl, public virtual IdentifiableImpl { public: - Font(const char *filename, int size, int xdpi, int ydpi, - FT_Library library); - virtual ~Font(); + Font(const char *filename, int size, FT_Library library); + virtual ~Font(); - virtual Glyph_ptr glyph_char(Unichar c); - virtual CORBA::Boolean has_char(Unichar c); - virtual CORBA::Boolean can_display(Unichar begin, Unichar end); - virtual Unistring* encoding(); - virtual Unistring* font_family(); - virtual void font_metrics(FontMetrics& fm); - virtual Unistring* font_style(); - virtual Unistring* fullname(); - virtual Coord height(); - virtual Vertex kerning(Unichar first, Unichar second); - virtual CORBA::Float angle(); - virtual CORBA::Float caret_offset(); + virtual Fresco::Glyph_ptr glyph_char(Fresco::Unichar c, short unsigned int xdpi, short unsigned int ydpi); + virtual CORBA::Boolean has_char(Fresco::Unichar c); + virtual CORBA::Boolean can_display(Fresco::Unichar begin, + Fresco::Unichar end); + virtual Fresco::Unistring* encoding(); + virtual Fresco::Unistring* font_family(); + virtual void font_metrics(Fresco::FontMetrics& fm); + virtual Fresco::Unistring* font_style(); + virtual Fresco::Unistring* fullname(); + virtual Fresco::Coord height(); + virtual Fresco::Vertex kerning(Fresco::Unichar first, Fresco::Unichar second); + virtual CORBA::Float angle(); + virtual CORBA::Float caret_offset(); private: - FT_Face my_face; - int my_size, my_xdpi, my_ydpi; + FT_Library my_ftlib; + FT_Face my_face; + Fresco::Coord my_size; }; + +} // namespace +} // namespace #endif // header guard Index: FontKitImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/FontKitImpl.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- FontKitImpl.cc 8 Jan 2003 01:42:31 -0000 1.3 +++ FontKitImpl.cc 16 Feb 2003 03:47:47 -0000 1.4 @@ -22,131 +22,183 @@ #include #include +#include +#include #include "FontKitImpl.hh" +#include "Font.hh" +using namespace Prague; using namespace Fresco; +using namespace Berlin::FontKit; class FontDecorator : public MonoGraphic { - public: - FontDecorator(Font f) : my_font(f) {} - virtual void - traverse(Traversal_ptr traversal) - { - traversal->visit(Graphic_var(_this())); - } - virtual void - draw(DrawTraversal_ptr traversal) - { - DrawingKit_var drawing = traversal->drawing(); - // and do... NOTHING! yet. - MonoGraphic::traverse(traversal); - } - virtual void - pick(PickTraversal_ptr traversal) - { - MonoGraphic::traverse(traversal); - } - private: - Font_ptr my_font; +public: + FontDecorator(Font_ptr f) : my_font(f) {} +#if 0 + virtual void traverse(Traversal_ptr traversal) + { + traversal->visit(Graphic_var(_this())); + } +#endif + virtual void draw(DrawTraversal_ptr traversal) + { + DrawingKit_var drawing = traversal->drawing(); + // and do... NOTHING! yet. + MonoGraphic::traverse(traversal); + } +#if 0 + virtual void pick(PickTraversal_ptr traversal) + { + MonoGraphic::traverse(traversal); + } +#endif +private: + Font_ptr my_font; }; class FontSizeDecorator : public MonoGraphic { - public: - FontSizeDecorator(Coord s) : my_size(s) {} - virtual void - traverse(Traversal_ptr traversal) - { - traversal->visit(Graphic_var(_this())); - } - virtual void - draw(DrawTraversal_ptr traversal) - { - DrawingKit_var drawing = traversal->drawing(); - // and do... NOTHING! yet. - MonoGraphic::traverse(traversal); - } - virtual void - pick(PickTraversal_ptr traversal) - { - MonoGraphic::traverse(traversal); - } - private: - Coord my_size; +public: + FontSizeDecorator(Coord s) : my_size(s) {} +#if 0 + virtual void traverse(Traversal_ptr traversal) + { + traversal->visit(Graphic_var(_this())); + } +#endif + virtual void draw(DrawTraversal_ptr traversal) + { + DrawingKit_var drawing = traversal->drawing(); + // and do... NOTHING! yet. + MonoGraphic::traverse(traversal); + } +#if 0 + virtual void pick(PickTraversal_ptr traversal) + { + MonoGraphic::traverse(traversal); + } +#endif +private: + Coord my_size; }; -class FontIterator : public virtual POA_Fresco::FontIterator, - public virtual RefCountBase +class FontIterator : public virtual POA_Fresco::FontIterator { - public: - FontIterator::FontIterator(FontKit_var fk) : - my_fk(fk) - {} - Font_ptr child() const +public: + FontIterator::FontIterator(FontKitImpl *fk) + : my_fk(fk) + { + Prague::Path path = RCManager::get_path("fontpath"); + scan(path); + } + Font_ptr child() const + { + return my_fk->_cxx_default(); + } + void next() { faces_iterator++;} + void prev() { faces_iterator--;} + void destroy() { delete this;}//deactivate();} + + void begin() { faces_iterator = faces.begin();} + void end() { faces_iterator = faces.end();} + void scan(Prague::Path path) + { + FT_Face my_face; + for (Prague::Path::iterator i = path.begin(); i != path.end(); ++i) { - return my_fk->default(); + Directory directory(*i, Directory::alpha); + for (Prague::Directory::iterator j = directory.begin(); j != directory.end(); ++j) + { + if ((*j)->name()[0] == '.') continue; + std::string file = (*j)->long_name(); + if (FT_New_Face(*(my_fk->get_ftlibrary()), file.c_str(), 0, &my_face)) + { + Logger::log(Logger::text) << "FontKit: file " << file << " is not a font." << std::endl; + continue; + } + faces.push_back(file); + } } - void next() {} - void prev() {} - void destroy() { deactivate();} - private: - FontKit_var my_fk; + } +private: + FontKitImpl *my_fk; + std::vector faces; + std::vector::iterator faces_iterator; }; -FontKitImpl::FontKitImpl(const std::string &id, const Fresco::Kit::PropertySeq &p) +FontKitImpl::FontKitImpl(const std::string &id, + const Fresco::Kit::PropertySeq &p) : KitImpl(id, p) { - FT_Init_Freetype(&my_library); + FT_Init_FreeType(&my_library); + FT_Face face; } FontKitImpl::~FontKitImpl() {} -Graphic_ptr -FontKitImpl::set_font(Graphic_ptr g, Font f) +Font_ptr FontKitImpl::_cxx_default() { - Trace trace("FontKitImpl::set_font"); - FontDecorator *decorator = new FontDecorator(f); - activate(decorator); - decorator->body(f); - return decorator->_this(); + return Font_ptr(new Font("/usr/share/fonts/truetype/commercial/arialuni.ttf", 12, my_library)); } -Graphic_ptr -FontKitImpl::size(Graphic_ptr g, Coord s) +Font_ptr FontKitImpl::filename(const char *fn, const Fresco::Unistring &style, + const Fresco::Coord size) { - Trace trace("FontKitImpl::size"); - FontSizeDecorator *decorator = new FontSizeDecorator(s); - activate(decorator); - decorator->body(f); - return decorator->_this(); + return Font_ptr(new Font(fn, size, my_library)); } -Graphic_ptr -FontKitImpl::style(Graphic_ptr g, const Unistring &style) +Font_ptr FontKitImpl::provide(const Fresco::Unistring &family, + const Fresco::Unistring &style, + const Fresco::Coord size) { - Trace trace("FontKitImpl::style"); - return Graphic::_nil(); + return _cxx_default(); + //return Font_ptr::_nil(); } -Graphic_ptr -FontKitImpl::delta_size(Graphic_ptr g, Coord ds) +Fresco::Graphic_ptr FontKitImpl::set_font(Fresco::Graphic_ptr g, Font_ptr f) +{ + Trace trace("FontKitImpl::set_font"); + return create_and_set_body(new FontDecorator(f), g); +} + +Fresco::Graphic_ptr FontKitImpl::size(Fresco::Graphic_ptr g, + const Fresco::Coord s) +{ + Trace trace("FontKitImpl::size"); + return create_and_set_body(new FontSizeDecorator(s), g); +} + +Fresco::Graphic_ptr FontKitImpl::style(Fresco::Graphic_ptr g, + const Fresco::Unistring &style) +{ + Trace trace("FontKitImpl::style"); + return Graphic::_nil(); +} + +Fresco::Graphic_ptr FontKitImpl::delta_size(Fresco::Graphic_ptr g, + const Fresco::Coord ds) { Trace trace("FontKitImpl::delta_size"); return Graphic::_nil(); } -Graphic_ptr -FontKitImpl::delta_style(Graphic_ptr g, const Unistring &style) +Fresco::Graphic_ptr FontKitImpl::delta_style(Fresco::Graphic_ptr g, + const Fresco::Unistring &style) { - Trace trace("FontKitImpl::delta_style"); - return Graphic::_nil(); + Trace trace("FontKitImpl::delta_style"); + return Graphic::_nil(); } -FontIterator_ptr -FontKitImpl::first_font() -{} +FT_Library *FontKitImpl::get_ftlibrary() +{ + return &my_library; +} -FontIterator_ptr -FontKitImpl::last_font() -{} +FontIterator_ptr FontKitImpl::first_font() +{ +} + +FontIterator_ptr FontKitImpl::last_font() +{ +} Index: FontKitImpl.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/FontKitImpl.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FontKitImpl.hh 8 Jan 2003 01:42:31 -0000 1.4 +++ FontKitImpl.hh 16 Feb 2003 03:47:47 -0000 1.5 @@ -25,15 +25,21 @@ #include #include #include +#include +#include +#include +#include #include +#include +#include +#include +#include #include #include FT_FREETYPE_H -namespace Berlin -{ -namespace FontKit -{ +namespace Berlin { +namespace FontKit { using namespace Fresco; @@ -41,28 +47,46 @@ public KitImpl { public: - FontKitImpl(const std::string &, const Fresco::Kit::PropertySeq &); - virtual ~FontKitImpl(); - virtual KitImpl *clone(const Fresco::Kit::PropertySeq &p) - { - return new FontKitImpl(repo_id(), p); - } - virtual Font_ptr _cxx_default(); - virtual Font_ptr filename(const char* file, const Fresco::Unistring& style, - Coord size); - virtual Font_ptr provide(const Unistring& family, const Unistring& style, - Coord size); - virtual Graphic_ptr set_font(Graphic_ptr g, Font_ptr f); - virtual Graphic_ptr size(Graphic_ptr g, Coord s); - virtual Graphic_ptr style(Graphic_ptr g, const Unistring& s); - virtual Graphic_ptr delta_size(Graphic_ptr g, Coord ds); - virtual Graphic_ptr delta_style(Graphic_ptr g, const Unistring& ds); + class FontIterator : public virtual POA_Fresco::FontIterator + { + public: + FontIterator::FontIterator(FontKitImpl *); + virtual Font_ptr child() const; + virtual void next(); + void prev(); + void destroy(); - virtual FontIterator_ptr first_font(); - virtual FontIterator_ptr last_font(); + void begin(); + void end(); + void scan(Prague::Path); + }; + + + FontKitImpl(const std::string &, const Fresco::Kit::PropertySeq &); + virtual ~FontKitImpl(); + KitImpl *clone(const Fresco::Kit::PropertySeq &p) + { + return new FontKitImpl(repo_id(), p); + } + + virtual Fresco::Font_ptr _cxx_default(); + virtual Fresco::Font_ptr filename(const char* file, const Fresco::Unistring& style, + Fresco::Coord size); + virtual Fresco::Font_ptr provide(const Fresco::Unistring& family, const Fresco::Unistring& style, + const Fresco::Coord size); + virtual Fresco::Graphic_ptr set_font(Fresco::Graphic_ptr g, const Fresco::Font_ptr f); + virtual Fresco::Graphic_ptr size(Fresco::Graphic_ptr g, const Fresco::Coord s); + virtual Fresco::Graphic_ptr style(Fresco::Graphic_ptr g, const Fresco::Unistring& s); + virtual Fresco::Graphic_ptr delta_size(Fresco::Graphic_ptr g, const Fresco::Coord ds); + virtual Fresco::Graphic_ptr delta_style(Fresco::Graphic_ptr g, const Fresco::Unistring& ds); + + virtual FT_Library *FontKitImpl::get_ftlibrary(); + + virtual Fresco::FontIterator_ptr first_font(); + virtual Fresco::FontIterator_ptr last_font(); private: - FT_Library my_library; + FT_Library my_library; }; } // namespace Index: Glyph.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Glyph.cc,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Glyph.cc 12 Jan 2003 02:54:09 -0000 1.2 +++ Glyph.cc 16 Feb 2003 03:47:47 -0000 1.3 @@ -24,25 +24,37 @@ #include #include "Glyph.hh" -Glyph::Glyph(FT_Face face, FT_ULong char_index) - : my_face(face) +GlyphImpl::GlyphImpl(FT_Face face, FT_ULong char_index) + : my_face(face) { + my_tr.xx = 0x10000; + my_tr.xy = 0x00000; + my_tr.yx = 0x00000; + my_tr.yy = 0x10000; FT_Load_Glyph(my_face, char_index, FT_LOAD_DEFAULT); } -Raster_ptr Glyph::bitmap() +Fresco::Raster_ptr GlyphImpl::bitmap() { RasterImpl *raster = new RasterImpl(); activate(raster); FT_Set_Transform(my_face, &my_tr, 0); + FT_Vector origin; + origin.x = 0; + origin.y = 0; + FT_Glyph glyph; FT_Get_Glyph(my_face->glyph, &glyph); FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, &origin, 1); FT_BitmapGlyph glyph_bitmap = (FT_BitmapGlyph)glyph; - Fresco::Raster::Data pixels; + unsigned char *buffer = glyph_bitmap->bitmap.buffer; + int width = glyph_bitmap->bitmap.width; + int height = glyph_bitmap->bitmap.rows; + + Fresco::Raster::ColorSeq pixels; switch (glyph_bitmap->bitmap.pixel_mode) { @@ -51,21 +63,21 @@ std::cout << "WTF;FT_PIXEL_MODE_NONE" << std::endl; break; case FT_PIXEL_MODE_MONO: // MSB 1 bpp - internal_format = GL_ALPHA; - format = GL_ALPHA; - type = GL_UNSIGNED_BYTE; for (int i = 0; i < height; i++) - for (int j = 0; j < width; j++) - pixels[i*w + j] = (buffer[i*(width/8)+(j/8)] & - (0x80 >> j%8)) ? 0xFF : 0; + for (int j = 0; j < width; j++) { + Fresco::Color c; + c.red = (buffer[i*(width/8)+(j/8)] & + (0x80 >> j%8)) ? 0xFFFFFF00 : 0; + c.green = c.red; c.blue = c.red; + } break; case FT_PIXEL_MODE_GRAY: // 8 bpp count of grey levels in num_bytes - internal_format = GL_ALPHA; - format = GL_ALPHA; - type = GL_UNSIGNED_BYTE; for (int i = 0; i < height; i++) - for (int j = 0; j < width; j++) - pixels[i*w+j] = buffer[i*width+j]; + for (int j = 0; j < width; j++) { + Fresco::Color c; + c.red = buffer[i*width+j]; + c.green = c.red; c.blue = c.red; + } break; case FT_PIXEL_MODE_GRAY2: // 2bpp (no known fonts) std::cout << "FontKit NYI: FT_PIXEL_MODE_GRAY2" << std::endl; @@ -81,26 +93,30 @@ break; default: std::cout << "FontKit unknown type : " - << glyph_bitmap->bitmap.pixel_mode << std::endl; + << glyph_bitmap->bitmap.pixel_mode << std::endl; break; } FT_Set_Transform(my_face, 0, 0); FT_Done_Glyph(glyph); - activate(pixels); - raster->store_pixels(pixels); + Fresco::Raster::Index lower; lower.x = 0; lower.y = 0; + Fresco::Raster::Index upper; upper.x = width; upper.y = height; + raster->load_pixels(lower, upper, pixels); - return raster; + return Fresco::Raster_ptr(raster); } -FontShape *Glyph::decompose() +Fresco::FontShape *GlyphImpl::decompose() { - FT_Set_Transform(that->my_face, &my_tr, 0); + FT_Set_Transform(my_face, &my_tr, 0); + Fresco::FontShape *f = new Fresco::FontShape(); f->length(0); // use FT_Outline_Decompose - FT_Set_Transform(that->my_face, 0, 0); + FT_Set_Transform(my_face, 0, 0); + + return f; } -void Glyph::char_info(GlyphMetrics *gm) +void GlyphImpl::char_info(Fresco::GlyphMetrics &gm) { double scale = 1.; gm.size.x = static_cast(my_face->glyph->metrics.width / scale); @@ -116,12 +132,12 @@ void *table = FT_Get_Sfnt_Table(my_face, ft_sfnt_hhea); if (table) { - TT_HoriHeader *header = *table; + TT_HoriHeader *header = (TT_HoriHeader*)table; gm.italic_correction = header->caret_Offset / 64.; // XXX MAYBE WRONG } } -void Glyph::transform(Fresco::Transform_var tr) +void GlyphImpl::transformation(Fresco::Transform_ptr tr) { Fresco::Vertex o = {0, 0, 0}; Fresco::Vertex e1 = {1, 0, 0}; Index: Glyph.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Glyph.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Glyph.hh 12 Jan 2003 02:54:09 -0000 1.2 +++ Glyph.hh 16 Feb 2003 03:47:47 -0000 1.3 @@ -19,31 +19,37 @@ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * MA 02139, USA. */ -#ifndef _Glyph_hh -#define _Glyph_hh +#ifndef _FontKit_Glyph_hh +#define _FontKit_Glyph_hh #include #include #include +#include +#include #include #include FT_FREETYPE_H +#include FT_GLYPH_H +#include FT_TRUETYPE_TABLES_H -class Raster; - +class Fresco::Raster; -class Glyph : public virtual POA_Fresco::Glyph, - public virtual RefCountBaseImpl, - public virtual IdentifiableImpl +class GlyphImpl : public virtual POA_Fresco::Glyph, + public virtual RefCountBaseImpl, + public virtual IdentifiableImpl { public: - Raster_ptr bitmap(); - FontShape *decompose(); - void char_info(GlyphMetrics *gm); - void transformation(Fresco::Transform_var); + GlyphImpl(FT_Face face, FT_ULong char_index); + virtual ~GlyphImpl(); + + virtual Fresco::Raster_ptr bitmap(); + virtual Fresco::FontShape *decompose(); + virtual void char_info(Fresco::GlyphMetrics &gm); + virtual void transformation(Fresco::Transform_ptr); private: - FT_Face my_face; - FT_Matrix my_tr; + FT_Face my_face; + FT_Matrix my_tr; }; #endif // header guard From nicholas at fresco.org Sun Feb 16 04:11:47 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/modules/Fonts Font.cc,1.3,1.4 FontKitImpl.cc,1.4,1.5 Glyph.cc,1.3,1.4 Glyph.hh,1.3,1.4 Message-ID: Update of /cvs/fresco/Fresco/Berlin/modules/Fonts In directory purcel:/tmp/cvs-serv3637 Modified Files: Font.cc FontKitImpl.cc Glyph.cc Glyph.hh Log Message: A little more cleanup. It now finds all its own symbols and can be loaded by the server. Index: Font.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Font.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Font.cc 16 Feb 2003 03:47:47 -0000 1.3 +++ Font.cc 16 Feb 2003 04:11:44 -0000 1.4 @@ -87,6 +87,16 @@ return my_size; } +Fresco::Vertex Font::kerning(Fresco::Unichar first, Fresco::Unichar second) +{ + // XXX this is BIDI-incorrect, of course... + FT_Vector kern; + FT_Get_Kerning(my_face, first, second, FT_KERNING_DEFAULT, &kern); + Fresco::Vertex v; + v.x = kern.x / 0x10000; + v.y = kern.y / 0x10000; +} + CORBA::Float Font::angle() { float angle = 0.; Index: FontKitImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/FontKitImpl.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- FontKitImpl.cc 16 Feb 2003 03:47:47 -0000 1.4 +++ FontKitImpl.cc 16 Feb 2003 04:11:44 -0000 1.5 @@ -202,3 +202,9 @@ FontIterator_ptr FontKitImpl::last_font() { } + +extern "C" KitImpl *load() +{ + static std::string properties[] = {"implementation", "FontKitImpl"}; + return create_kit ("IDL:fresco.org/Fresco/FontKit:1.0", properties, 2); +} Index: Glyph.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Glyph.cc,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Glyph.cc 16 Feb 2003 03:47:47 -0000 1.3 +++ Glyph.cc 16 Feb 2003 04:11:44 -0000 1.4 @@ -24,6 +24,11 @@ #include #include "Glyph.hh" +namespace Berlin +{ +namespace FontKit +{ + GlyphImpl::GlyphImpl(FT_Face face, FT_ULong char_index) : my_face(face) { @@ -34,6 +39,8 @@ FT_Load_Glyph(my_face, char_index, FT_LOAD_DEFAULT); } +GlyphImpl::~GlyphImpl() {} + Fresco::Raster_ptr GlyphImpl::bitmap() { RasterImpl *raster = new RasterImpl(); @@ -152,3 +159,6 @@ my_tr.yx = (e2.x-o.x)*0x10000; my_tr.yy = (e2.y-o.y)*0x10000; } + +} // namespace +} // namespace Index: Glyph.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Glyph.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- Glyph.hh 16 Feb 2003 03:47:47 -0000 1.3 +++ Glyph.hh 16 Feb 2003 04:11:44 -0000 1.4 @@ -35,6 +35,11 @@ class Fresco::Raster; +namespace Berlin +{ +namespace FontKit +{ + class GlyphImpl : public virtual POA_Fresco::Glyph, public virtual RefCountBaseImpl, public virtual IdentifiableImpl @@ -51,5 +56,8 @@ FT_Face my_face; FT_Matrix my_tr; }; + +} // namespace +} // namespace #endif // header guard From nicholas at fresco.org Mon Feb 17 02:05:36 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:09 2005 Subject: [Fresco-changes] Fresco/Berlin/src PNG.cc,1.6,1.7 RasterImpl.cc,1.5,1.6 Message-ID: Update of /cvs/fresco/Fresco/Berlin/src In directory purcel:/tmp/cvs-serv24544/Berlin/src Modified Files: PNG.cc RasterImpl.cc Log Message: Implement RasterImpl::load_pixels() Index: PNG.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/PNG.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- PNG.cc 9 Feb 2003 19:03:54 -0000 1.6 +++ PNG.cc 17 Feb 2003 02:05:33 -0000 1.7 @@ -341,10 +341,39 @@ return colors; } -void PNG::pixels(unsigned long xlower, unsigned long ylower, unsigned long xupper, unsigned long yupper, - const Raster::ColorSeq &pixels, unsigned char **rows) +unsigned char **PNG::pixels(unsigned long xlower, unsigned long ylower, + unsigned long xupper, unsigned long yupper, + const Raster::ColorSeq &pixels) { - std::cerr << "sorry, PNG::pixels not yet implemented" << std::endl; + png_uint_32 width = xupper - xlower; + png_uint_32 height = yupper - ylower; + + clear(); + + _rinfo->color_type = rgbalpha; + _rinfo->bit_depth = 8; + _rinfo->width = width; + _rinfo->height = height; + _rinfo->rowbytes = width*4; + //_rinfo->compression_type = 0; + //_rinfo->filter = + //_rinfo->interlace + + unsigned char **rows = new unsigned char *[height]; + for (png_uint_32 y = ylower, i = 0; y != yupper; y++, i++) + { + rows[y] = new unsigned char[_rinfo->rowbytes]; + for (png_uint_32 x = xlower, j = 0; x != xupper; x++, j++) + { + Color color = pixels[i*width + j]; + rows[y][4*x] = static_cast(color.red * 255); + rows[y][4*x+1] = static_cast(color.green * 255); + rows[y][4*x+2] = static_cast(color.blue * 255); + rows[y][4*x+3] = static_cast(color.alpha * 255); + } + } + + return rows; } unsigned char **PNG::read(const std::string &file) Index: RasterImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/RasterImpl.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- RasterImpl.cc 9 Feb 2003 19:03:54 -0000 1.5 +++ RasterImpl.cc 17 Feb 2003 02:05:33 -0000 1.6 @@ -103,7 +103,7 @@ void RasterImpl::load_pixels(const Fresco::Raster::Index &lower, const Fresco::Raster::Index &upper, const Fresco::Raster::ColorSeq &pixels) { Trace trace("RasterImpl::load_pixels"); - _png.pixels(lower.x, lower.y, upper.x, upper.y, pixels, _rows); + _rows = _png.pixels(lower.x, lower.y, upper.x, upper.y, pixels); } void RasterImpl::write(const char *file) From nicholas at fresco.org Mon Feb 17 02:05:37 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Berlin/include/Berlin PNG.hh,1.3,1.4 Message-ID: Update of /cvs/fresco/Fresco/Berlin/include/Berlin In directory purcel:/tmp/cvs-serv24544/Berlin/include/Berlin Modified Files: PNG.hh Log Message: Implement RasterImpl::load_pixels() Index: PNG.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/include/Berlin/PNG.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- PNG.hh 8 Feb 2003 06:46:10 -0000 1.3 +++ PNG.hh 17 Feb 2003 02:05:34 -0000 1.4 @@ -57,8 +57,8 @@ unsigned char **); Fresco::Raster::ColorSeq *pixels(unsigned long, unsigned long, unsigned long, unsigned long, unsigned char *const *); - void pixels(unsigned long, unsigned long, unsigned long, unsigned long, - const Fresco::Raster::ColorSeq &, unsigned char **); + unsigned char **pixels(unsigned long, unsigned long, unsigned long, + unsigned long, const Fresco::Raster::ColorSeq &); unsigned char **read(const std::string &); void write(const std::string &, unsigned char *const *); private: From nicholas at fresco.org Mon Feb 17 02:10:35 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Fresco-IDL/share/idl/Fresco Font.idl,1.5,1.6 Message-ID: Update of /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco In directory purcel:/tmp/cvs-serv24779/Fresco-IDL/share/idl/Fresco Modified Files: Font.idl Log Message: Move the dpi from Font::glyph_char to Glyph::bitmap where it belongs. The FontKit can now return a Raster containing the glyph at a given dpi! Index: Font.idl =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-IDL/share/idl/Fresco/Font.idl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Font.idl 16 Feb 2003 03:47:46 -0000 1.5 +++ Font.idl 17 Feb 2003 02:10:33 -0000 1.6 @@ -71,7 +71,7 @@ interface Glyph : RefCountBase, Identifiable { - Raster bitmap(); + Raster bitmap(in unsigned short xdpi, in unsigned short ydpi); FontShape decompose(); void char_info(out GlyphMetrics gm); void transformation(in Transform t); @@ -79,7 +79,7 @@ interface Font : RefCountBase, Identifiable { - Glyph glyph_char(in Unichar c, in unsigned short xdpi, in unsigned short ydpi); + Glyph glyph_char(in Unichar c); // need glyph_something for composite characters. // also need to support multiple master fonts. Hm. From nicholas at fresco.org Mon Feb 17 02:10:36 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Berlin/modules/Fonts Font.cc,1.4,1.5 Font.hh,1.2,1.3 FontKitImpl.cc,1.5,1.6 FontKitImpl.hh,1.5,1.6 Glyph.cc,1.4,1.5 Glyph.hh,1.4,1.5 Message-ID: Update of /cvs/fresco/Fresco/Berlin/modules/Fonts In directory purcel:/tmp/cvs-serv24779/Berlin/modules/Fonts Modified Files: Font.cc Font.hh FontKitImpl.cc FontKitImpl.hh Glyph.cc Glyph.hh Log Message: Move the dpi from Font::glyph_char to Glyph::bitmap where it belongs. The FontKit can now return a Raster containing the glyph at a given dpi! Index: Font.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Font.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Font.cc 16 Feb 2003 04:11:44 -0000 1.4 +++ Font.cc 17 Feb 2003 02:10:33 -0000 1.5 @@ -30,17 +30,17 @@ Font::Font(const char *filename, int size, FT_Library library) : my_ftlib(library), my_size(size) { - FT_New_Face(my_ftlib, filename, 0, &my_face); + if (FT_New_Face(my_ftlib, filename, 0, &my_face) != 0) + { throw Fresco::CreationFailureException(); } FT_Set_Char_Size(my_face, 0, my_size*64, 0, 0); } Font::~Font() {} -Fresco::Glyph_ptr Font::glyph_char(Fresco::Unichar c, short unsigned int xdpi, short unsigned int ydpi) +Fresco::Glyph_ptr Font::glyph_char(Fresco::Unichar c) { - FT_Set_Char_Size(my_face, 0, my_size*64, xdpi, ydpi); - GlyphImpl *glyph = new GlyphImpl(my_face, c); - return Fresco::Glyph_var(glyph->_this()); + GlyphImpl *glyph = new GlyphImpl(my_face, my_size, c); + return glyph->_this(); } CORBA::Boolean Font::has_char(Fresco::Unichar c) @@ -95,6 +95,7 @@ Fresco::Vertex v; v.x = kern.x / 0x10000; v.y = kern.y / 0x10000; + return v; } CORBA::Float Font::angle() Index: Font.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Font.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Font.hh 16 Feb 2003 03:47:47 -0000 1.2 +++ Font.hh 17 Feb 2003 02:10:33 -0000 1.3 @@ -19,8 +19,8 @@ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * MA 02139, USA. */ -#ifndef _FontKit_Font_hh -#define _FontKit_Font_hh +#ifndef _Fonts_Font_hh +#define _Fonts_Font_hh #include #include @@ -46,7 +46,7 @@ Font(const char *filename, int size, FT_Library library); virtual ~Font(); - virtual Fresco::Glyph_ptr glyph_char(Fresco::Unichar c, short unsigned int xdpi, short unsigned int ydpi); + virtual Fresco::Glyph_ptr glyph_char(Fresco::Unichar c); virtual CORBA::Boolean has_char(Fresco::Unichar c); virtual CORBA::Boolean can_display(Fresco::Unichar begin, Fresco::Unichar end); Index: FontKitImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/FontKitImpl.cc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- FontKitImpl.cc 16 Feb 2003 04:11:44 -0000 1.5 +++ FontKitImpl.cc 17 Feb 2003 02:10:33 -0000 1.6 @@ -22,6 +22,7 @@ #include #include +#include #include #include #include "FontKitImpl.hh" @@ -31,28 +32,29 @@ using namespace Fresco; using namespace Berlin::FontKit; +namespace Berlin +{ +namespace FontKit +{ + class FontDecorator : public MonoGraphic { public: FontDecorator(Font_ptr f) : my_font(f) {} -#if 0 virtual void traverse(Traversal_ptr traversal) { traversal->visit(Graphic_var(_this())); } -#endif virtual void draw(DrawTraversal_ptr traversal) { DrawingKit_var drawing = traversal->drawing(); // and do... NOTHING! yet. MonoGraphic::traverse(traversal); } -#if 0 virtual void pick(PickTraversal_ptr traversal) { MonoGraphic::traverse(traversal); } -#endif private: Font_ptr my_font; }; @@ -61,99 +63,90 @@ { public: FontSizeDecorator(Coord s) : my_size(s) {} -#if 0 virtual void traverse(Traversal_ptr traversal) { traversal->visit(Graphic_var(_this())); } -#endif virtual void draw(DrawTraversal_ptr traversal) { DrawingKit_var drawing = traversal->drawing(); // and do... NOTHING! yet. MonoGraphic::traverse(traversal); } -#if 0 virtual void pick(PickTraversal_ptr traversal) { MonoGraphic::traverse(traversal); } -#endif private: Coord my_size; }; -class FontIterator : public virtual POA_Fresco::FontIterator +FontKitImpl::FontIterator::FontIterator(FontKitImpl *fk) + : my_fk(fk) { -public: - FontIterator::FontIterator(FontKitImpl *fk) - : my_fk(fk) - { - Prague::Path path = RCManager::get_path("fontpath"); - scan(path); - } - Font_ptr child() const - { - return my_fk->_cxx_default(); - } - void next() { faces_iterator++;} - void prev() { faces_iterator--;} - void destroy() { delete this;}//deactivate();} + Prague::Path path = RCManager::get_path("fontpath"); + scan(path); +} - void begin() { faces_iterator = faces.begin();} - void end() { faces_iterator = faces.end();} - void scan(Prague::Path path) - { - FT_Face my_face; - for (Prague::Path::iterator i = path.begin(); i != path.end(); ++i) +FontKitImpl::FontIterator::~FontIterator() {} + +Font_ptr FontKitImpl::FontIterator::child() +{ + return my_fk->_cxx_default(); +} +void FontKitImpl::FontIterator::next() { faces_iterator++;} +void FontKitImpl::FontIterator::prev() { faces_iterator--;} +void FontKitImpl::FontIterator::destroy() { delete this;}//deactivate();} + +void FontKitImpl::FontIterator::begin() { faces_iterator = faces.begin();} +void FontKitImpl::FontIterator::end() { faces_iterator = faces.end();} +void FontKitImpl::FontIterator::scan(Prague::Path path) +{ + FT_Face my_face; + for (Prague::Path::iterator i = path.begin(); i != path.end(); ++i) { Directory directory(*i, Directory::alpha); for (Prague::Directory::iterator j = directory.begin(); j != directory.end(); ++j) - { - if ((*j)->name()[0] == '.') continue; - std::string file = (*j)->long_name(); - if (FT_New_Face(*(my_fk->get_ftlibrary()), file.c_str(), 0, &my_face)) - { - Logger::log(Logger::text) << "FontKit: file " << file << " is not a font." << std::endl; - continue; - } - faces.push_back(file); - } + { + if ((*j)->name()[0] == '.') continue; + std::string file = (*j)->long_name(); + if (FT_New_Face(*(my_fk->get_ftlibrary()), file.c_str(), 0, &my_face)) + { + Logger::log(Logger::text) << "FontKit: file " << file << " is not a font." << std::endl; + continue; + } + faces.push_back(file); + } } - } -private: - FontKitImpl *my_fk; - std::vector faces; - std::vector::iterator faces_iterator; -}; +} FontKitImpl::FontKitImpl(const std::string &id, const Fresco::Kit::PropertySeq &p) : KitImpl(id, p) { FT_Init_FreeType(&my_library); - FT_Face face; } FontKitImpl::~FontKitImpl() {} Font_ptr FontKitImpl::_cxx_default() { - return Font_ptr(new Font("/usr/share/fonts/truetype/commercial/arialuni.ttf", 12, my_library)); + Font *f = new Font("/usr/share/fonts/truetype/commercial/arialuni.ttf", 12, my_library); + return f->_this(); } Font_ptr FontKitImpl::filename(const char *fn, const Fresco::Unistring &style, const Fresco::Coord size) { - return Font_ptr(new Font(fn, size, my_library)); + Font *f = new Font(fn, size, my_library); + return f->_this(); } Font_ptr FontKitImpl::provide(const Fresco::Unistring &family, const Fresco::Unistring &style, const Fresco::Coord size) { - return _cxx_default(); - //return Font_ptr::_nil(); + return _cxx_default(); // XXX } Fresco::Graphic_ptr FontKitImpl::set_font(Fresco::Graphic_ptr g, Font_ptr f) @@ -197,10 +190,16 @@ FontIterator_ptr FontKitImpl::first_font() { + FontIterator *fi = new FontIterator(this); + fi->begin(); + return fi->_this(); } FontIterator_ptr FontKitImpl::last_font() { + FontIterator *fi = new FontIterator(this); + fi->end(); + return fi->_this(); } extern "C" KitImpl *load() @@ -208,3 +207,6 @@ static std::string properties[] = {"implementation", "FontKitImpl"}; return create_kit ("IDL:fresco.org/Fresco/FontKit:1.0", properties, 2); } + +} // namespace +} // namespace Index: FontKitImpl.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/FontKitImpl.hh,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- FontKitImpl.hh 16 Feb 2003 03:47:47 -0000 1.5 +++ FontKitImpl.hh 17 Feb 2003 02:10:33 -0000 1.6 @@ -19,8 +19,8 @@ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * MA 02139, USA. */ -#ifndef _FontKitImpl_hh -#define _FontKitImpl_hh +#ifndef _Fonts_FontKitImpl_hh +#define _Fonts_FontKitImpl_hh #include #include @@ -38,8 +38,10 @@ #include #include FT_FREETYPE_H -namespace Berlin { -namespace FontKit { +namespace Berlin +{ +namespace FontKit +{ using namespace Fresco; @@ -51,17 +53,21 @@ class FontIterator : public virtual POA_Fresco::FontIterator { public: - FontIterator::FontIterator(FontKitImpl *); - virtual Font_ptr child() const; + FontIterator(FontKitImpl *); + virtual ~FontIterator(); + virtual Font_ptr child(); virtual void next(); - void prev(); - void destroy(); + virtual void prev(); + virtual void destroy(); - void begin(); - void end(); - void scan(Prague::Path); + virtual void begin(); + virtual void end(); + virtual void scan(Prague::Path); + private: + FontKitImpl *my_fk; + std::vector faces; + std::vector::iterator faces_iterator; }; - FontKitImpl(const std::string &, const Fresco::Kit::PropertySeq &); virtual ~FontKitImpl(); Index: Glyph.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Glyph.cc,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Glyph.cc 16 Feb 2003 04:11:44 -0000 1.4 +++ Glyph.cc 17 Feb 2003 02:10:33 -0000 1.5 @@ -29,32 +29,35 @@ namespace FontKit { -GlyphImpl::GlyphImpl(FT_Face face, FT_ULong char_index) - : my_face(face) +GlyphImpl::GlyphImpl(FT_Face face, Fresco::Coord size, FT_ULong char_index) + : my_face(face), my_size(size), my_uc(char_index) { my_tr.xx = 0x10000; my_tr.xy = 0x00000; my_tr.yx = 0x00000; my_tr.yy = 0x10000; - FT_Load_Glyph(my_face, char_index, FT_LOAD_DEFAULT); } GlyphImpl::~GlyphImpl() {} -Fresco::Raster_ptr GlyphImpl::bitmap() +Fresco::Raster_ptr GlyphImpl::bitmap(short unsigned int xdpi, short unsigned int ydpi) { RasterImpl *raster = new RasterImpl(); activate(raster); + if (FT_Set_Char_Size(my_face, 0, my_size*64, xdpi, ydpi) != 0) + std::cerr << "set char size failed." << std::endl; FT_Set_Transform(my_face, &my_tr, 0); - FT_Vector origin; - origin.x = 0; - origin.y = 0; + if (FT_Load_Glyph(my_face, FT_Get_Char_Index(my_face, my_uc), + FT_LOAD_DEFAULT) != 0) + std::cerr << "load glyph failed." << std::endl; FT_Glyph glyph; - FT_Get_Glyph(my_face->glyph, &glyph); - FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, &origin, 1); + if (FT_Get_Glyph(my_face->glyph, &glyph) != 0) + std::cerr << "get glyph failed." << std::endl; + if (FT_Glyph_To_Bitmap(&glyph, ft_render_mode_normal, 0, 1) != 0) + std::cerr << "glyph to bitmap failed." << std::endl; FT_BitmapGlyph glyph_bitmap = (FT_BitmapGlyph)glyph; unsigned char *buffer = glyph_bitmap->bitmap.buffer; @@ -62,29 +65,31 @@ int height = glyph_bitmap->bitmap.rows; Fresco::Raster::ColorSeq pixels; + pixels.length(width*height); switch (glyph_bitmap->bitmap.pixel_mode) { case FT_PIXEL_MODE_NONE: // should never happen - std::cout << "WTF;FT_PIXEL_MODE_NONE" << std::endl; + std::cout << "FontKit confused: FT_PIXEL_MODE_NONE?" << std::endl; break; case FT_PIXEL_MODE_MONO: // MSB 1 bpp for (int i = 0; i < height; i++) for (int j = 0; j < width; j++) { Fresco::Color c; - c.red = (buffer[i*(width/8)+(j/8)] & - (0x80 >> j%8)) ? 0xFFFFFF00 : 0; - c.green = c.red; c.blue = c.red; + c.red = 1.; c.green = 1.; c.blue = 1.; + c.alpha = (buffer[i*(width/8)+(j/8)] & (0x80 >> j%8)) ? 1. : 0.; + pixels[i*width+j] = c; } break; case FT_PIXEL_MODE_GRAY: // 8 bpp count of grey levels in num_bytes for (int i = 0; i < height; i++) for (int j = 0; j < width; j++) { Fresco::Color c; - c.red = buffer[i*width+j]; - c.green = c.red; c.blue = c.red; - } + c.red = 1.; c.green = 1.; c.blue = 1.; + c.alpha = buffer[i*width+j] / 255.; + pixels[i*width+j] = c; + } break; case FT_PIXEL_MODE_GRAY2: // 2bpp (no known fonts) std::cout << "FontKit NYI: FT_PIXEL_MODE_GRAY2" << std::endl; @@ -99,23 +104,27 @@ std::cout << "FontKit NYI: FT_PIXEL_MODE_LCD_V" << std::endl; break; default: - std::cout << "FontKit unknown type : " + std::cout << "FontKit unknown type: " << glyph_bitmap->bitmap.pixel_mode << std::endl; break; } - FT_Set_Transform(my_face, 0, 0); FT_Done_Glyph(glyph); + FT_Set_Transform(my_face, 0, 0); Fresco::Raster::Index lower; lower.x = 0; lower.y = 0; Fresco::Raster::Index upper; upper.x = width; upper.y = height; raster->load_pixels(lower, upper, pixels); - return Fresco::Raster_ptr(raster); + return raster->_this(); } Fresco::FontShape *GlyphImpl::decompose() { + FT_Set_Char_Size(my_face, 0, my_size*64, 0, 0); FT_Set_Transform(my_face, &my_tr, 0); + if (FT_Load_Glyph(my_face, FT_Get_Char_Index(my_face, my_uc), + FT_LOAD_DEFAULT & FT_LOAD_IGNORE_TRANSFORM) != 0) + std::cerr << "load glyph failed." << std::endl; Fresco::FontShape *f = new Fresco::FontShape(); f->length(0); // use FT_Outline_Decompose FT_Set_Transform(my_face, 0, 0); @@ -126,6 +135,7 @@ void GlyphImpl::char_info(Fresco::GlyphMetrics &gm) { double scale = 1.; + // this isn't safe enough. We need to keep our own copy of the glyph. gm.size.x = static_cast(my_face->glyph->metrics.width / scale); gm.size.y = static_cast(my_face->glyph->metrics.height / scale); gm.hori_bearing.x = static_cast(my_face->glyph->metrics.horiBearingX / scale); Index: Glyph.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Fonts/Glyph.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Glyph.hh 16 Feb 2003 04:11:44 -0000 1.4 +++ Glyph.hh 17 Feb 2003 02:10:33 -0000 1.5 @@ -19,12 +19,13 @@ * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, * MA 02139, USA. */ -#ifndef _FontKit_Glyph_hh -#define _FontKit_Glyph_hh +#ifndef _Fonts_Glyph_hh +#define _Fonts_Glyph_hh #include #include #include +#include #include #include @@ -45,16 +46,19 @@ public virtual IdentifiableImpl { public: - GlyphImpl(FT_Face face, FT_ULong char_index); + GlyphImpl(FT_Face face, Fresco::Coord size, FT_ULong char_index); virtual ~GlyphImpl(); - virtual Fresco::Raster_ptr bitmap(); + virtual Fresco::Raster_ptr bitmap(short unsigned int xdpi, + short unsigned int ydpi); virtual Fresco::FontShape *decompose(); virtual void char_info(Fresco::GlyphMetrics &gm); virtual void transformation(Fresco::Transform_ptr); private: FT_Face my_face; FT_Matrix my_tr; + Fresco::Coord my_size; + Fresco::Unichar my_uc; }; } // namespace From nicholas at fresco.org Mon Feb 17 03:01:03 2003 From: nicholas at fresco.org (Nick Lewycky) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Berlin/src PNG.cc,1.7,1.8 RasterImpl.cc,1.6,1.7 Message-ID: Update of /cvs/fresco/Fresco/Berlin/src In directory purcel:/tmp/cvs-serv26214/Berlin/src Modified Files: PNG.cc RasterImpl.cc Log Message: Plug a memory leak I added. Index: PNG.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/PNG.cc,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- PNG.cc 17 Feb 2003 02:05:33 -0000 1.7 +++ PNG.cc 17 Feb 2003 03:01:00 -0000 1.8 @@ -348,8 +348,6 @@ png_uint_32 width = xupper - xlower; png_uint_32 height = yupper - ylower; - clear(); - _rinfo->color_type = rgbalpha; _rinfo->bit_depth = 8; _rinfo->width = width; Index: RasterImpl.cc =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/src/RasterImpl.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- RasterImpl.cc 17 Feb 2003 02:05:33 -0000 1.6 +++ RasterImpl.cc 17 Feb 2003 03:01:00 -0000 1.7 @@ -103,6 +103,7 @@ void RasterImpl::load_pixels(const Fresco::Raster::Index &lower, const Fresco::Raster::Index &upper, const Fresco::Raster::ColorSeq &pixels) { Trace trace("RasterImpl::load_pixels"); + clear(); _rows = _png.pixels(lower.x, lower.y, upper.x, upper.y, pixels); } From stefan at fresco.org Tue Feb 18 01:09:49 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Fresco-Python Makefile.in,1.11,1.12 Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python In directory purcel:/tmp/cvs-serv8499 Modified Files: Makefile.in Log Message: more fixes for Fresco module Index: Makefile.in =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python/Makefile.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Makefile.in 11 Feb 2003 02:58:37 -0000 1.11 +++ Makefile.in 18 Feb 2003 01:09:46 -0000 1.12 @@ -50,8 +50,7 @@ install-doc: #do nothing here -uninstall: - rm -rf `./setup.py packagedir` +uninstall: #do nothing here clean: $(MAKE) action="clean" From stefan at fresco.org Tue Feb 18 01:09:49 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Fresco-Python/Fresco __init__.py,1.1,1.2 App.py,1.1,NONE Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python/Fresco In directory purcel:/tmp/cvs-serv8499/Fresco Modified Files: __init__.py Removed Files: App.py Log Message: more fixes for Fresco module Index: __init__.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python/Fresco/__init__.py,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- __init__.py 11 Feb 2003 02:58:37 -0000 1.1 +++ __init__.py 18 Feb 2003 01:09:47 -0000 1.2 @@ -1,11 +1,27 @@ -# Python Berlin client library -# Copyright (c) 2000 by Stephen Davies -# This file is licensed for use under the GPL +# +# This source file is a part of the Fresco Project. +# Copyright (C) 2000 by Stephen Davies +# http://www.fresco.org +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Library General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public +# License along with this library; if not, write to the +# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, +# MA 02139, USA. # # Tabstop is 8, SoftTabStop is 4, ShiftWidth is 4 (as per last line) # """ -Import from this module to connect to the Berlin server and access +Import from this module to connect to the Fresco server and access the kits therein. Use the get_kits() and get_connection() functions to access instances of the Kits and Connection objects. """ --- App.py DELETED --- From stefan at fresco.org Tue Feb 18 01:52:06 2003 From: stefan at fresco.org (Stefan Seefeld) Date: Fri Feb 25 22:16:10 2005 Subject: [Fresco-changes] Fresco/Fresco-Python-demos/src demo.py,1.15,1.16 frame.py,1.10,1.11 graphictest,1.7,1.8 menutest,1.17,1.18 primitivetest,1.7,1.8 refcount.py,1.4,1.5 terminal.py,1.5,1.6 transform.py,1.9,1.10 unicode.py,1.2,1.3 unidraw,1.5,1.6 viewport,1.4,1.5 Message-ID: Update of /cvs/fresco/Fresco/Fresco-Python-demos/src In directory purcel:/tmp/cvs-serv9638 Modified Files: demo.py frame.py graphictest menutest primitivetest refcount.py terminal.py transform.py unicode.py unidraw viewport Log Message: cleanup Index: demo.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/demo.py,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- demo.py 28 Jan 2003 03:34:31 -0000 1.15 +++ demo.py 18 Feb 2003 01:52:03 -0000 1.16 @@ -3,11 +3,11 @@ import sys, time import string -# Import berlin client lib -import berlin, Fresco -from berlin import Label, Callback, nullAny +# Import Fresco client lib +import Fresco +from Fresco import Label, Callback, nullAny -class DemoApp (berlin.App): +class DemoApp (Fresco.App): def run(self): # Create a pixmap pixmap = kits.figure.pixmap(kits.image.create_raster("berlin-128.png")) @@ -22,8 +22,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = DemoApp() app.run() Index: frame.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/frame.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- frame.py 10 Oct 2002 06:36:56 -0000 1.10 +++ frame.py 18 Feb 2003 01:52:03 -0000 1.11 @@ -3,14 +3,10 @@ import sys, time import string -# Import the Fresco stubs +# Import Fresco stubs and client lib import Fresco -# Import berlin client lib -import berlin -from berlin import Label, Callback, nullAny - -class DemoApp (berlin.App): +class DemoApp (Fresco.App): def mk_frame(self, color): spec = Fresco.ToolKit.FrameSpec( Fresco.ToolKit.colored, apply(Fresco.Color, color)) @@ -89,8 +85,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = DemoApp() app.run() Index: graphictest =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/graphictest,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- graphictest 6 Nov 2002 01:38:51 -0000 1.7 +++ graphictest 18 Feb 2003 01:52:03 -0000 1.8 @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Python Berlin client that implements a client-side Graphic +# Python Fresco client that implements a client-side Graphic # Copyright (c) 2000 by Stephen Davies # This file is licensed for use under the GPL. # @@ -9,13 +9,10 @@ import sys, string, time, math, thread, threading from omniORB import CORBA -# Import berlin client lib -import berlin -from berlin import Label, Callback, nullAny - -# Import the Fresco stubs +# Import the Fresco stubs and client lib import Fresco, Unidraw import Fresco__POA +from Fresco import Label, Callback, nullAny # Import Fresco lib import pyfresco @@ -136,7 +133,7 @@ self._curr_rot = 0. print "ClockController started." print "Drag the clock face around its middle!" - print "Press a key (in the berlin window) to reset the angle" + print "Press a key (in the Fresco window) to reset the angle" def traverse(self, traversal): pyfresco.PyController.traverse(self, traversal) @@ -184,7 +181,7 @@ self.clock.need_redraw() self.clock._lock.release() -class GraphicApp (berlin.App): +class GraphicApp (Fresco.App): def run(self): clock = ClockController()._this() clock_group = kits.tool.group(clock) @@ -197,8 +194,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = GraphicApp() app.run() Index: menutest =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/menutest,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- menutest 6 Nov 2002 01:38:51 -0000 1.17 +++ menutest 18 Feb 2003 01:52:03 -0000 1.18 @@ -1,24 +1,21 @@ #!/usr/bin/env python -# Python Berlin client that implements a client-side menu +# Python Fresco client that implements a client-side menu # Copyright (c) 2000 by Stephen Davies # This file is licensed for use under the GPL. # # Tabstop is 8, SoftTabStop is 4, ShiftWidth is 4 (as per last line) # # Note that the menu api implemented here resembles more traditional -# state-heavy guis, rather than berlin's lightweight graphic model. +# state-heavy guis, rather than Fresco's lightweight graphic model. # Disclaimer: This is just an experiment :) import sys, string, os from omniORB import CORBA, PortableServer -# Import Berlin module -import berlin -from berlin import Label, Callback, nullAny - -# Import the Fresco stubs +# Import the Fresco stubs and client lib import Fresco, Layout import Fresco__POA +from Fresco import Label, Callback, nullAny # Import Python client lib import pyfresco @@ -348,7 +345,7 @@ print "Failed" sys.exit(0) -class MenuApp (berlin.App): +class MenuApp (Fresco.App): def run(self): def add(menu, items): for item in items: @@ -421,8 +418,8 @@ def main(): # Create the singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = MenuApp() app.run() Index: primitivetest =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/primitivetest,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- primitivetest 6 Nov 2002 01:38:51 -0000 1.7 +++ primitivetest 18 Feb 2003 01:52:03 -0000 1.8 @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Python Berlin client that implements a client-side Graphic +# Python Fresco client that implements a client-side Graphic # Copyright (c) 2000 by Stephen Davies # This file is licensed for use under the GPL. # @@ -9,13 +9,10 @@ import sys, string, time, math, thread, threading from omniORB import CORBA -# Import berlin client lib -import berlin -from berlin import Label, Callback, nullAny - -# Import the Fresco stubs +# Import the Fresco stubs and client lib import Fresco, Unidraw import Fresco__POA +from Fresco import Label, Callback, nullAny # Import Fresco lib import pyfresco @@ -91,7 +88,7 @@ dk.draw_mesh(self.__mesh) dk.restore() -class GraphicApp (berlin.App): +class GraphicApp (Fresco.App): def run(self): vbox = kits.layout.vbox() phi = kits.command.bvalue(0., 360., 0., 1., 10.) @@ -138,8 +135,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = GraphicApp() app.run() Index: refcount.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/refcount.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- refcount.py 7 Apr 2001 07:44:42 -0000 1.4 +++ refcount.py 18 Feb 2003 01:52:03 -0000 1.5 @@ -3,14 +3,14 @@ import sys, time import string -# Import berlin client lib -import berlin -from berlin import Label, Callback, nullAny +# Import Fresco client lib +import Fresco +from Fresco import Label, Callback, nullAny -class RefCountApp (berlin.App): +class RefCountApp (Fresco.App): def run(self): # Create a pixmap - raster = kits.image.create("../etc/PNG/berlin-48.png") + raster = kits.image.create("berlin-48.png") pixmap = kits.figure.pixmap(raster) wrapper1 = kits.layout.margin(pixmap, 50) pixmap.decrement() @@ -28,8 +28,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = RefCountApp() app.run() Index: terminal.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/terminal.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- terminal.py 10 Oct 2002 06:36:56 -0000 1.5 +++ terminal.py 18 Feb 2003 01:52:03 -0000 1.6 @@ -3,14 +3,10 @@ import sys, time import string -# Import Fresco generated stuff +# Import Fresco client lib import Fresco -# Import berlin client lib -import berlin -from berlin import Label, Callback, nullAny - -class DemoApp (berlin.App): +class DemoApp (Fresco.App): def run(self): terminal = kits.widget.terminal() scrollable = kits.widget.scrollable(kits.tool.rgb(terminal, 0., 0., 0.)) @@ -26,8 +22,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = DemoApp() app.run() Index: transform.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/transform.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- transform.py 10 Oct 2002 06:36:56 -0000 1.9 +++ transform.py 18 Feb 2003 01:52:03 -0000 1.10 @@ -3,15 +3,11 @@ import sys, time import string -# Import Fresco generated interface -import Fresco -import Figure - -# Import berlin client lib -import berlin -from berlin import Label, Callback, nullAny +# Import Fresco generated interface and client lib +import Fresco, Figure +from Fresco import Label, Callback, nullAny -class DemoApp (berlin.App): +class DemoApp (Fresco.App): def run(self): vbox = kits.layout.vbox(); adjustable1 = kits.command.bvalue(0., 90., 0., 10., 10.) @@ -43,8 +39,8 @@ def main(): # Create singletons global app, kits, connection - connection = berlin.get_connection() - kits = berlin.get_kits() + connection = Fresco.get_connection() + kits = Fresco.get_kits() app = DemoApp() app.run() Index: unicode.py =================================================================== RCS file: /cvs/fresco/Fresco/Fresco-Python-demos/src/unicode.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- unicode.py 10 Oct 2002 06:36:56 -0000 1.2 +++ unicode.py 18 Feb 2003 01:52:03 -0000 1.3 @@ -4,13 +4,10 @@ import string import curses -# Import Fresco Stubs +# Import Fr