ioapicture.c

Go to the documentation of this file.
00001 
00002 /*  $Id: ioapicture.c 1197 2006-04-05 22:01:22Z karstenw $    */
00003 
00004 /******************************************************************************
00005 
00006     UserLand Frontier(tm) -- High performance Web content management,
00007     object database, system-level and Internet scripting environment,
00008     including source code editing and debugging.
00009 
00010     Copyright (C) 1992-2004 UserLand Software, Inc.
00011 
00012     This program is free software; you can redistribute it and/or modify
00013     it under the terms of the GNU General Public License as published by
00014     the Free Software Foundation; either version 2 of the License, or
00015     (at your option) any later version.
00016 
00017     This program is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020     GNU General Public License for more details.
00021 
00022     You should have received a copy of the GNU General Public License
00023     along with this program; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 
00026 ******************************************************************************/
00027 
00028 #include "frontier.h"
00029 #include "standard.h"
00030 
00031 #include <ioa.h>
00032 
00033 
00034 #define dummystring "\p(paste picture here)"
00035 
00036 
00037 
00038 static boolean cleanpicture (hdlobject h, short height, short width, Rect *r) {
00039 
00040     PicHandle hpict = (PicHandle) (**h).objectdata;
00041     
00042     if (hpict == nil) {
00043         
00044         hdlcard hc = (**h).owningcard;
00045         short gridunits = (**hc).gridunits;
00046         
00047         width = IOAmakemultiple (StringWidth (dummystring) + 4, gridunits);
00048         
00049         height = IOAmakemultiple ((*r).bottom - (*r).top, gridunits);
00050         }
00051     else {
00052         Rect rframe = (**hpict).picFrame;
00053         
00054         width = rframe.right - rframe.left;
00055         
00056         height = (rframe.bottom - rframe.top);
00057         }
00058     
00059     (*r).right = (*r).left + width;
00060     
00061     (*r).bottom = (*r).top + height;
00062     
00063     return (true);
00064     } /*cleanpicture*/
00065     
00066 
00067 static boolean canreplicatepicture (hdlobject h) {
00068 #pragma unused(h)
00069 
00070     return (true); /*it can be replicated*/
00071     } /*canreplicatepicture*/
00072     
00073 
00074 static boolean getpictureeditrect (hdlobject h, Rect *r) {
00075 #pragma unused(h, r)
00076 
00077     return (false); /*text of object can't be edited*/
00078     } /*getpictureeditrect*/
00079     
00080 
00081 static boolean getpicturevalue (hdlobject h, Handle *hvalue) {
00082 #pragma unused(h, hvalue)
00083 
00084     return (false); /*picture doesn't have a value for a script*/
00085     } /*getpicturevalue*/
00086     
00087 
00088 static boolean debugpicture (hdlobject h, bigstring errorstring) {
00089 #pragma unused(h)
00090 
00091     setstringlength (errorstring, 0);
00092     
00093     return (true);
00094     } /*debugpicture*/
00095     
00096 
00097 static boolean drawpicture (hdlobject h) {
00098     
00099     Rect robject;
00100     PicHandle hpict;
00101     
00102     robject = (**h).objectrect;
00103     
00104     if (!(**h).objecttransparent)       
00105         EraseRect (&robject);
00106     
00107     hpict = (PicHandle) (**h).objectdata;
00108     
00109     if (hpict == nil) {
00110         
00111         bigstring bs;
00112         
00113         IOAcopystring (dummystring, bs);
00114         
00115         IOAcenterstring (robject, bs);
00116         }
00117     else {
00118         Rect rdraw = (**hpict).picFrame;
00119     
00120         IOAcenterrect (&rdraw, robject);
00121     
00122         DrawPicture (hpict, &rdraw);
00123         }
00124     
00125     return (true);
00126     } /*drawpicture*/
00127     
00128 
00129 static boolean initpicture (tyobject *obj) {
00130     
00131     (*obj).objecthasframe = true;
00132     
00133     (*obj).objectfont = geneva;
00134 
00135     (*obj).objectfontsize = 9;
00136 
00137     (*obj).objectstyle = bold;
00138 
00139     return (false); /*we do not want to edit it*/
00140     } /*initpicture*/
00141     
00142     
00143 void setuppicture (tyioaconfigrecord *);
00144 
00145 
00146 void setuppicture (tyioaconfigrecord *config) {
00147 
00148     IOAcopystring ("\pPicture", (*config).objectTypeName);
00149     
00150     (*config).objectTypeID = picturetype;
00151     
00152     (*config).frameWhenEditing = false;
00153     
00154     (*config).canEditValue = false;
00155     
00156     (*config).toggleFlagWhenHit = false;
00157     
00158     (*config).mutuallyExclusive = false;
00159     
00160     (*config).speaksForGroup = false;
00161     
00162     (*config).isFontAware = false;
00163     
00164     (*config).initObjectCallback = initpicture;
00165     
00166     (*config).drawObjectCallback = drawpicture;
00167     
00168     (*config).cleanupObjectCallback = cleanpicture;
00169     
00170     (*config).canReplicateObjectCallback = canreplicatepicture;
00171     
00172     (*config).getObjectEditRectCallback = getpictureeditrect;
00173     
00174     (*config).getValueForScriptCallback = getpicturevalue;
00175     
00176     (*config).debugObjectCallback = debugpicture;
00177     } /*setuppicture*/
00178     
00179     

Generated on Wed May 31 18:19:49 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6