[interfacekit] patch for Globals.cpp: _init_interface_kit()

Hi all.
I started implementing _init_interface_kit(), I have a patch.
Here it is:

Index: src/kits/interface/Globals.cpp
===================================================================
RCS file: /cvsroot/open-beos/current/src/kits/interface/Globals.cpp,v
retrieving revision 1.10
diff -u -r1.10 Globals.cpp
--- src/kits/interface/Globals.cpp      4 Oct 2003 19:08:06 -0000       1.10
+++ src/kits/interface/Globals.cpp      17 Dec 2003 07:33:51 -0000
@@ -28,11 +28,14 @@
 #include <AppServerLink.h>
 #include <GraphicsDefs.h>
 #include <InterfaceDefs.h>
+#include <Menu.h>
 #include <ServerProtocol.h>
 #include <Screen.h>
 #include <PortMessage.h>
 #include <Roster.h>
+#include <TextView.h>
 
+//#include <WidthBuffer.h>
 
 // Private definitions not placed in public headers
 extern "C" void _init_global_fonts();
@@ -410,14 +413,30 @@
 extern "C" status_t
 _init_interface_kit_()
 {
-       // TODO: Find out what this does and when it's called
+       //BTextView::sWidths = new _BWidthBuffer_;
+       
+       sem_id widthSem = create_sem(1, "TextView WidthBuffer Sem");
+       if (widthSem < 0)
+               return widthSem;
+       BTextView::sWidthSem = widthSem;
+       BTextView::sWidthAtom = 0;
+       status_t result = get_menu_info(&BMenu::sMenuInfo);
+       if (result != B_OK)  
+               return result;
+       
+       //TODO: fill the other static members
+               
+       return B_OK;
 }
 
 
 extern "C" status_t
 _fini_interface_kit_()
 {
-       // TODO: Find out what this does and when it's called
+       // TODO: Implement me.
+       // XXX: How can this method delete what _init_interface_kit() created,
+       // since we are not a friend of BTextView, etc. ?
+       return B_OK;
 }
 
 

Can I apply it ?

For the XXX in _fini_interface_kit(), here's the idea: We can keep some globals 
(static in the Globals.cpp file, and filled by _init_interface_kit()) which 
_fini_interface_kit() will operate on, since it can't do anything to those 
class members, since it's not a friend of them.

WidthBuffer constructor is commented, for now, because I need to move its 
header to ../private/interface.



Other related posts: