tablerunbutton.c

Go to the documentation of this file.
00001 
00002 /*  $Id: tablerunbutton.c 355 2005-01-11 22:48:55Z andreradke $    */
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 "bitmaps.h"
00032 #include "icon.h"
00033 #include "memory.h"
00034 #include "quickdraw.h"
00035 #include "sounds.h"
00036 #include "strings.h"
00037 #include "shell.rsrc.h"
00038 #include "langexternal.h"
00039 #include "tableinternal.h"
00040 
00041 
00042 /*
00043 static char *iconstrings [] = {
00044     
00045     "\pZoom",           /%0%/
00046     
00047     "\pOutline",        /%1%/
00048     
00049     "\pWP-Text",        /%2%/
00050     
00051     nil,
00052     
00053     "\pTable",          /%4%/
00054     
00055     "\pScript",         /%5%/
00056     
00057     "\pMenuBar",        /%6%/
00058     
00059     "\pPicture"         /%7%/
00060     };
00061 */
00062 
00063 
00064 boolean tablecursoriszoomable (void) {
00065     
00066     hdlhashtable htable;
00067     bigstring bsname;
00068     tyvaluerecord val;
00069     hdlhashnode hnode;
00070     
00071     if (!tablegetcursorinfo (&htable, bsname, &val, &hnode))
00072         return (false);
00073     
00074     return ((val.valuetype == externalvaluetype) || (val.valuetype == novaluetype));
00075     } /*tablecursoriszoomable*/
00076 
00077 
00078 boolean tablecheckzoombutton (void) {
00079     
00080     /*
00081     2.1b6 dmb: changed checking logic. we get called by callers who need the 
00082     flag to be right, instead of when it might change. return true of it did 
00083     change.
00084     */
00085     
00086     register hdltableformats hf = tableformatsdata;
00087     register boolean flenabled;
00088     
00089     flenabled = tablecursoriszoomable ();
00090     
00091     if ((**hf).fliconenabled != flenabled) {
00092         
00093         (**hf).fliconenabled = flenabled;
00094         
00095         return (true);
00096         }
00097     
00098     return (false);
00099     
00100     /*
00101     register short ixicontitle;
00102     bigstring bs;
00103     tyvaluerecord val;
00104     
00105     ixicontitle = 0; /%default%/
00106     
00107     if (tablegetcursorinfo (bs, &val)) {
00108         
00109         if (val.valuetype == externalvaluetype)
00110             ixicontitle = langexternalgettype (val) + 1;
00111         }
00112     
00113     if ((**hi).ixicontitle != ixicontitle) {
00114         
00115         (**hi).ixicontitle = ixicontitle;
00116         
00117         (**hi).fliconenabled = flenabled;
00118         
00119         invalrect ((**hi).iconrect);
00120         }
00121     */
00122     } /*tablecheckzoombutton*/
00123 
00124 
00125 void tabledrawzoombutton (boolean flpressed) {
00126     
00127     hdltableformats hf = tableformatsdata;
00128     Rect r = (**hf).iconrect;
00129     bigstring bs;
00130     boolean flbitmap;
00131     
00132     tablecheckzoombutton (); /*check now instead of when it changes*/
00133     
00134     /*
00135     copystring (iconstrings [info.ixicontitle], bs);
00136     */
00137     
00138     if (!isemptyrect (r)) {
00139             
00140         shellgetstring (zoombuttonstring, bs);
00141         
00142         flbitmap = openbitmap (r, tableformatswindow);
00143         
00144         eraserect (r);
00145         
00146         drawlabeledwindoidicon (r, bs, (**hf).flactive && (**hf).fliconenabled, flpressed);
00147         
00148         if (flbitmap)
00149             closebitmap (tableformatswindow);
00150         }
00151     } /*tabledrawzoombutton*/
00152 
00153 
00154 boolean tablezoombuttonhit (void) {
00155     
00156     register hdltableformats hf = tableformatsdata;
00157     
00158     if (!trackicon ((**hf).iconrect, &tabledrawzoombutton))  /*user changed its mind*/
00159         return (true);
00160     
00161     return (tabledive ());
00162     } /*tablezoombuttonhit*/
00163 
00164 
00165 boolean tablecursorisrunnable (void) {
00166     
00167     /*
00168     returns true if the value pointed to by the table cursor can be run.
00169     */
00170     
00171     hdlhashtable  htable;
00172     bigstring bs;
00173     tyvaluerecord val;
00174     hdlhashnode hnode;
00175     
00176     if (!tablegetcursorinfo (&htable, bs, &val, &hnode)) 
00177         return (false);
00178         
00179     return (val.valuetype == stringvaluetype
00180             || (val.valuetype == externalvaluetype
00181                     && langexternalgettype (val) == idscriptprocessor));
00182     } /*tablecursorisrunnable*/
00183 
00184 
00185 boolean tableruncursor (void) {
00186     
00187     tyvaluerecord val;
00188     hdlhashtable htable;
00189     bigstring bs;
00190     bigstring bsscript, bsresult;
00191     Handle htext;
00192     hdlhashnode hnode;
00193     
00194     if (!tableexiteditmode ())
00195         return (false);
00196     
00197     if (!tablegetcursorinfo (&htable, bs, &val, &hnode)) {
00198         
00199         ouch ();
00200         
00201         return (false);
00202         }
00203     
00204     switch (val.valuetype) {
00205         
00206         case stringvaluetype: {
00207             if (!copyhandle (val.data.stringvalue, &htext))
00208                 return (false);
00209             
00210             return (langrunhandle (htext, bsresult)); /*consumes htext*/
00211             }
00212         
00213         case externalvaluetype:
00214             if (langexternalgettype (val) == idscriptprocessor) {
00215             
00216                 tablegetcursorpath (bsscript);
00217                 
00218                 pushstring ((ptrstring) "\x02()", bsscript);
00219                 
00220                 return (langrunstring (bsscript, bsresult));
00221                 } /*if*/
00222                 
00223             break;
00224 
00225         default:
00226             /* do nothing */
00227             break;
00228 
00229         } /*switch*/
00230     
00231     ouch ();
00232     
00233     return (false);
00234     } /*tableruncursor*/
00235 
00236 
00237 
00238 

Generated on Wed May 31 18:20:03 2006 for frontierkernel 10.1.10a by  doxygen 1.4.6