|
From: <ted...@us...> - 2011-11-01 18:19:58
|
Revision: 1837
http://frontierkernel.svn.sourceforge.net/frontierkernel/?rev=1837&view=rev
Author: tedchoward
Date: 2011-11-01 18:19:52 +0000 (Tue, 01 Nov 2011)
Log Message:
-----------
Added code to search the ODB for nodeType data.
Specifically, for a given nodeType, we search users.tools.nodeTypes and
Frontier.tools.data.nodeTypes for the nodeType data structure which
contains the icon data. If an entry exists, we load the icon data from
that location and draw it (Mac only right now).
Signed-off-by: Ted C. Howard <te...@te...>
Modified Paths:
--------------
Frontier/trunk/Common/headers/opicons.h
Frontier/trunk/Common/source/opicons.c
Modified: Frontier/trunk/Common/headers/opicons.h
===================================================================
--- Frontier/trunk/Common/headers/opicons.h 2011-11-01 18:19:37 UTC (rev 1836)
+++ Frontier/trunk/Common/headers/opicons.h 2011-11-01 18:19:52 UTC (rev 1837)
@@ -49,4 +49,6 @@
boolean opdrawheadiconcustom (bigstring bsiconname, const Rect *r, boolean flselected);
+boolean opdrawheadiconcustomfromodb (bigstring bsadricon, const Rect *r, boolean flselected);
+boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath);
\ No newline at end of file
Modified: Frontier/trunk/Common/source/opicons.c
===================================================================
--- Frontier/trunk/Common/source/opicons.c 2011-11-01 18:19:37 UTC (rev 1836)
+++ Frontier/trunk/Common/source/opicons.c 2011-11-01 18:19:52 UTC (rev 1837)
@@ -34,8 +34,8 @@
#include "opicons.h"
#include "opdisplay.h"
#include "strings.h" /*7.0b9 PBS*/
+#include "tablestructure.h"
-
#define canexpandicon 475
#define cantexpandicon 476
#define canexpandcommenticon 477
@@ -126,7 +126,60 @@
return (ploticoncustom (r, 0, transform, bsiconname));
} /*opdrawheadiconcustom*/
+boolean opdrawheadiconcustomfromodb (bigstring bsadricon, const Rect *r, boolean flselected) {
+
+ short transform = 0;
+
+ if (flselected)
+ transform = kTransformSelected;
+
+ operaserect (*r);
+
+ return (ploticonfromodb (r, 0, transform, bsadricon));
+} /*opdrawheadiconcustom*/
+boolean opgetnodetypetableadr(bigstring bsnodetype, bigstring bsadrnodepath) {
+ //user.tools.nodeTypes.[type]
+ //Frontier.tools.data.nodeTypes.[type]
+
+ bigstring bsname;
+ copystring(BIGSTRING("\x15" "user.tools.nodeTypes."), bsadrnodepath);
+ pushstring(bsnodetype, bsadrnodepath);
+
+ hdlhashtable ht;
+ hdlhashnode hn;
+ tyvaluerecord iconvalue;
+ boolean flexpanded = false;
+ boolean fllookup = false;
+
+ pushhashtable (roottable);
+
+ disablelangerror ();
+
+ flexpanded = langexpandtodotparams (bsadrnodepath, &ht, bsname);
+ enablelangerror ();
+ pophashtable ();
+
+ fllookup = hashtablelookup (ht, bsnodetype, &iconvalue, &hn);
+
+ if (!fllookup) {
+ copystring(BIGSTRING("\x1E" "Frontier.tools.data.nodeTypes."), bsadrnodepath);
+ pushstring(bsnodetype, bsadrnodepath);
+
+ pushhashtable (roottable);
+
+ disablelangerror ();
+
+ flexpanded = langexpandtodotparams (bsadrnodepath, &ht, bsname);
+ enablelangerror ();
+ pophashtable ();
+
+ fllookup = hashtablelookup (ht, bsnodetype, &iconvalue, &hn);
+ }
+
+ return fllookup;
+}
+
boolean opdefaultdrawicon (hdlheadrecord hnode, const Rect *iconrect, boolean flselected, boolean flinverted) {
#pragma unused(flselected, flinverted)
@@ -159,15 +212,30 @@
setemptystring (bsheadlinetype);
- #if (defined(MACVERSION) && defined(__ppc__)) || defined (WIN95VERSION)
-
if (opattributesgettypestring (hnode, bsheadlinetype)) { /*is there a type att?*/
+ /* Look up a custom icon in the odb and draw it if there is one. */
+
+ #if defined (MACVERSION)
+
+ bigstring bsadrnodepath;
+
+ if (stringlength(bsheadlinetype) > 0 && opgetnodetypetableadr(bsheadlinetype, bsadrnodepath)) {
+ pushstring(BIGSTRING("\x09" ".icon.mac"), bsadrnodepath);
+ flcustomicondrawn = opdrawheadiconcustomfromodb (bsadrnodepath, iconrect, false);
+ }
+
+ #endif
+
+ #if (defined(MACVERSION) && defined(__ppc__)) || defined (WIN95VERSION)
+
/*Draw a custom icon. If it returns false, there was no custom icon.*/
-
- flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
+ if (!flcustomicondrawn) {
+ flcustomicondrawn = opdrawheadiconcustom (bsheadlinetype, iconrect, false);
+ }
+
+ #endif
} /*if*/
- #endif
} /*if*/
} /*if*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|