|
From: <cre...@us...> - 2007-01-17 19:44:47
|
Revision: 1606
http://svn.sourceforge.net/frontierkernel/?rev=1606&view=rev
Author: creecode
Date: 2007-01-17 11:44:42 -0800 (Wed, 17 Jan 2007)
Log Message:
-----------
support for long odb item names and file paths
formatting tweaks
Modified Paths:
--------------
Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowser.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserexpand.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h
Frontier/branches/Frontier_Long_File_Paths/Common/headers/claycallbacks.h
Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonverbs.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/claylinelayout.c
Frontier/branches/Frontier_Long_File_Paths/Common/source/command.c
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowser.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowser.h 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowser.h 2007-01-17 19:44:42 UTC (rev 1606)
@@ -54,12 +54,13 @@
typedef hdlhashtable tybrowserdir;
typedef struct tybrowserspec {
-
+
tybrowservol vRefNum;
tybrowserdir parID;
- bigstring name;
+ Handle name;
+
} tybrowserspec, *ptrbrowserspec;
#endif
@@ -118,47 +119,48 @@
tyfolderview folderview; /*for folders, view-by-name, date, etc.*/
#endif
+
} tybrowserinfo;
-typedef boolean (*tyclayfileloopcallback) (bigstring, tybrowserinfo *, long);
+typedef boolean ( *tyclayfileloopcallback ) ( const Handle, tybrowserinfo *, long );
-boolean browserinitrecord (hdltableformats);
+boolean browserinitrecord ( hdltableformats );
boolean clayinitializeoutline (void);
-boolean claymakespec (tybrowservol vnum, tybrowserdir dirid, bigstring fname, tybrowserspec *fs);
+boolean claymakespec ( tybrowservol, tybrowserdir, const Handle, tybrowserspec * );
-boolean claygetfilespec (hdlheadrecord, tybrowserspec *);
+boolean claygetfilespec ( hdlheadrecord, tybrowserspec * );
-boolean claygetfileinfo (const tybrowserspec *fs, tybrowserinfo *);
+boolean claygetfileinfo ( const tybrowserspec *, tybrowserinfo * );
-boolean clayfolderloop (const tybrowserspec *, boolean, tyclayfileloopcallback, long);
+boolean clayfolderloop (const tybrowserspec *, boolean, tyclayfileloopcallback, long );
-boolean clayrenamefile (tybrowserspec *fs, hdlheadrecord headnode); /*6.2b16 AR: headnode instead of bsnew*/
+boolean clayrenamefile ( tybrowserspec *, hdlheadrecord ); // 6.2b16 AR: headnode instead of bsnew
-boolean claygetfilename (const tybrowserspec *pfs, bigstring name);
+boolean claygetfilename ( const tybrowserspec *, Handle * );
-boolean browserexpand (hdlheadrecord, long);
+boolean browserexpand ( hdlheadrecord, long );
boolean browserselectfile (ptrfilespec, boolean, hdlheadrecord *);
-boolean browserexpandtofile (ptrfilespec);
+boolean browserexpandtofile ( ptrfilespec );
-boolean browserfollowalias (hdlheadrecord);
+boolean browserfollowalias ( hdlheadrecord );
-boolean browsernodeexists (hdlheadrecord, const tybrowserspec *);
+boolean browsernodeexists ( hdlheadrecord, const tybrowserspec * );
-boolean browsernewfolder (void);
+boolean browsernewfolder ( void );
-boolean browsernewtextfile (void);
+boolean browsernewtextfile ( void );
-boolean browsernewscript (void);
+boolean browsernewscript ( void );
-boolean browsernewoutline (void);
+boolean browsernewoutline ( void );
-boolean browsernewcopy (tybrowserspec *, bigstring);
+boolean browsernewcopy ( tybrowserspec *, bigstring );
boolean browsergetrefcon (hdlheadrecord, tybrowserinfo *);
@@ -174,7 +176,7 @@
// void browserupdatemsg (const tybrowserspec *, tyfileinfo *);
-boolean browserfileadded (hdlheadrecord, const tybrowserspec *, hdlheadrecord *);
+boolean browserfileadded ( hdlheadrecord, const tybrowserspec *, hdlheadrecord * );
boolean browserloadnode (hdlheadrecord);
@@ -182,15 +184,15 @@
void browserdrawnodeicon (const Rect *, boolean, hdlheadrecord);
-boolean browsersymbolchanged (hdlhashtable, const bigstring, boolean);
+boolean browsersymbolchanged ( hdlhashtable, const bigstring, boolean );
-boolean browsersymbolinserted (hdlhashtable, const bigstring);
+boolean browsersymbolinserted ( hdlhashtable, const bigstring );
-boolean browsersymboldeleted (hdlhashtable, const bigstring);
+boolean browsersymboldeleted ( hdlhashtable, const bigstring );
-void browserupdate (void);
+void browserupdate ( void );
-boolean browserstart (void);
+boolean browserstart ( void );
#endif
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserexpand.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserexpand.h 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserexpand.h 2007-01-17 19:44:42 UTC (rev 1606)
@@ -40,11 +40,10 @@
} tyexpandinfo;
+void browserfindinsertionpoint ( hdlheadrecord, const Handle, tybrowserinfo *, hdlheadrecord *, tydirection * );
-void browserfindinsertionpoint (hdlheadrecord, bigstring, tybrowserinfo *, hdlheadrecord *, tydirection *);
+boolean browserexpandvisit ( const Handle, tybrowserinfo *, long );
-boolean browserexpandvisit (bigstring, tybrowserinfo *, long);
-
boolean browserpreexpand (hdlheadrecord, short, boolean);
boolean browsercanexpand (hdlheadrecord);
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/claybrowserstruc.h 2007-01-17 19:44:42 UTC (rev 1606)
@@ -67,4 +67,5 @@
extern boolean browserdeletedummyvalues (hdlheadrecord);
-#endif
\ No newline at end of file
+#endif
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/headers/claycallbacks.h
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/headers/claycallbacks.h 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/headers/claycallbacks.h 2007-01-17 19:44:42 UTC (rev 1606)
@@ -37,28 +37,29 @@
#ifdef odbbrowser
-#define clayfileexists(fs,isfolder) hashtablesymbolexists ((hdlhashtable) (*fs).parID, (*fs).name)
+ boolean claycopyfile (const tybrowserspec *, const tybrowserspec *);
-boolean claycopyfile (const tybrowserspec *, const tybrowserspec *);
+ boolean claydeletefile (const tybrowserspec *);
-boolean claydeletefile (const tybrowserspec *);
+ boolean claymovefile (const tybrowserspec *, const tybrowserspec *);
-boolean claymovefile (const tybrowserspec *, const tybrowserspec *);
+ boolean claylookupvalue (const tybrowserspec *, tyvaluerecord *, hdlhashnode *);
-boolean claylookupvalue (const tybrowserspec *, tyvaluerecord *, hdlhashnode *);
+ boolean claycreatefile (const tybrowserspec *);
-boolean claycreatefile (const tybrowserspec *);
-
+ boolean clayfileexists ( tybrowserspec *, boolean * );
+
#endif
-boolean claygetspecialfolder (void *, boolean, tybrowserspec *);
+boolean claygetspecialfolder ( const Handle, boolean, tybrowserspec * );
-boolean clayemptyfilefolder (tybrowserspec *);
+boolean clayemptyfilefolder ( tybrowserspec * );
boolean claygetdirid (const tybrowserspec * , tybrowserdir *);
boolean claygetinmemorydirid (const tybrowserspec *, tybrowserdir *);
-boolean claygetsubitemspec (tybrowserspec *, bigstring fname, tybrowserspec *);
+boolean claygetsubitemspec ( tybrowserspec *, const Handle, tybrowserspec * );
-boolean browsertextchanged (hdlheadrecord, bigstring);
+boolean browsertextchanged ( hdlheadrecord, const Handle );
+
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonverbs.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonverbs.c 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/cancoonverbs.c 2007-01-17 19:44:42 UTC (rev 1606)
@@ -129,27 +129,43 @@
} /*ccshowbuttonsverb*/
-static boolean ccmsgverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
+static boolean ccmsgverb ( hdltreenode hparam1, tyvaluerecord *vreturned ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+
+ Handle h;
+ bigstring bs;
+ long length;
- bigstring bsmsg;
-
flnextparamislast = true;
- if (!getstringvalue (hparam1, 1, bsmsg))
- return (false);
+ if ( ! getexempttextvalue ( hparam1, 1, &h ) )
+ return ( false );
+
+ length = gethandlesize ( h );
- if (shellwindow != nil)
- shellpushrootglobals (shellwindow);
+ if ( length > 255 ) // trim from the middle
+ pullfromhandle ( h, 128, length - 255, NULL );
+
+ texthandletostring ( h, bs );
+
+ disposehandle ( h );
+
+ if ( shellwindow != nil )
+
+ shellpushrootglobals ( shellwindow );
else
- shellpushfrontrootglobals ();
+ shellpushfrontrootglobals ( );
+
+ ccmsg ( bs, ! processisoneshot ( true ) );
- ccmsg (bsmsg, !processisoneshot (true));
+ shellpopglobals ( );
- shellpopglobals ();
+ return ( setbooleanvalue ( true, vreturned ) );
- return (setbooleanvalue (true, vreturned));
-
- } /*ccmsgverb*/
+ } // ccmsgverb
static boolean ccfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
@@ -249,6 +265,7 @@
getstringlist (cancoonerrorlist, errornum, bserror);
return (false);
+
} /*ccfunctionvalue*/
@@ -257,8 +274,6 @@
langcallbacks.msgverbcallback = &ccmsgverb;
return (loadfunctionprocessor (idcancoonverbs, &ccfunctionvalue));
+
} /*ccinitverbs*/
-
-
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserexpand.c 2007-01-17 19:44:42 UTC (rev 1606)
@@ -86,35 +86,45 @@
} /*browsercalcinsertionpoint*/
-void browserfindinsertionpoint (hdlheadrecord hparent, bigstring bsnewhead, tybrowserinfo *newfileinfo, hdlheadrecord *hpre, tydirection *dir) {
+void browserfindinsertionpoint (hdlheadrecord hparent, const Handle handleNewHead, tybrowserinfo *newfileinfo, hdlheadrecord *hpre, tydirection *dir) {
+
+ //
+ // using whatever sorting options we have, determine the insertion point
+ // for the new line. we return the info that opaddheadline needs, a handle
+ // to the "pre" node and the direction relative to that node to create the
+ // new headline.
+ //
+ // special case: if hparent == nil, we do it at the summit level.
+ //
+ // possible view settings: name, date, kind, size, label.
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 1993-09-22 dmb: added cases for remaining possible view settings,
+ // treating them all as viewbyname. also viewbyname sort
+ // order is unicase.
+ //
- /*
- using whatever sorting options we have, determine the insertion point for the
- new line. we return the info that opaddheadline needs, a handle to the "pre"
- node and the direction relative to that node to create the new headline.
+ hdlheadrecord nomad;
+ tyfolderview folderview;
- special case: if hparent == nil, we do it at the summit level.
+ #if filebrowser
- possible view settings: name, date, kind, size, label.
+ unsigned long time1, time2;
+ unsigned long size1, size2;
+ short label1, label2;
+ bigstring bsnew;
+
+ #endif
- 9/22/93 dmb: added cases for remaining possible view settings, treating
- them all as viewbyname. also viewbyname sort order is unicase.
- */
+ #if odbbrowser
- hdlheadrecord nomad;
- tyfolderview folderview;
-#if filebrowser
- unsigned long time1, time2;
- unsigned long size1, size2;
- short label1, label2;
- bigstring bsnew;
-#endif
-#if odbbrowser
- hdlhashtable ht;
- hdlhashnode hnode, hnext;
- bigstring bsnext;
- hdlheadrecord hmatch;
-#endif
+ Handle handleNext;
+ hdlhashnode hnode, hnext;
+ hdlhashtable ht;
+ hdlheadrecord hmatch;
+
+ #endif
if (hparent == nil) {
@@ -129,11 +139,13 @@
else {
#if filebrowser
+
tybrowserinfo browserinfo;
browsergetrefcon (hparent, &browserinfo);
folderview = browserinfo.folderview;
+
#endif
nomad = hparent;
@@ -150,174 +162,180 @@
ht = (*newfileinfo).dirid;
- if (hashtablelookupnode (ht, bsnewhead, &hnode)) { // should not fail
+ if (hashtablelookupnode (ht, handleNewHead, &hnode)) { // should not fail
hnext = (**hnode).sortedlink;
if (hnext != nil) { // we're not last
- gethashkey (hnext, bsnext);
+ gethashkey ( hnext, &handleNext );
- if (opfindhead (nomad, bsnext, &hmatch)) { // shouldn't fail
+ if ( opFindHeadHandle ( nomad, handleNext, &hmatch ) ) { // shouldn't fail
*hpre = hmatch;
*dir = up;
return;
- }
- }
- }
+
+ } // if
+ } // if
+ } // if
// default: insert at end of list
- *hpre = oprepeatedbump (down, longinfinity, nomad, true);
+ *hpre = oprepeatedbump ( down, longinfinity, nomad, true );
*dir = down;
return;
#endif
-
-
+
#if filebrowser
- folderview = -1;
-
- switch (folderview) { /*initialize the things we compare against*/
+ folderview = -1;
- case viewbyname:
- case viewbyicon:
- case viewbysmallicon:
- case viewbycomment:
- case viewbyversion:
- copystring (bsnewhead, bsnew);
+ switch (folderview) { /*initialize the things we compare against*/
- alllower (bsnew);
-
- break;
-
- case viewbykind:
- setstringlength (bsnew, 4);
-
- moveleft (&(*newfileinfo).filecreator, &bsnew [1], 4);
-
- break;
-
- case viewbydate:
- time1 = (unsigned long) (*newfileinfo).timemodified;
-
- break;
-
- case viewbysize:
- size1 = (*newfileinfo).filesize;
-
- break;
-
- case viewbycolor:
- label1 = (*newfileinfo).ixlabel;
-
- break;
- } /*switch*/
-
- while (true) {
-
- switch (folderview) {
-
case viewbyname:
case viewbyicon:
case viewbysmallicon:
case viewbycomment:
- case viewbyversion: {
- bigstring bs;
+ case viewbyversion:
+ copystring (bsnewhead, bsnew);
- opgetheadstring (nomad, bs);
+ alllower (bsnew);
- alllower (bs);
+ break;
- if (comparestrings (bsnew, bs) == -1) /*bsnewhead is < bs*/
- return;
+ case viewbykind:
+ setstringlength (bsnew, 4);
+ moveleft (&(*newfileinfo).filecreator, &bsnew [1], 4);
+
break;
- }
-
- case viewbykind: {
- tybrowserinfo nomadinfo;
- bigstring bs;
-
- browsergetrefcon (nomad, &nomadinfo);
-
- setstringlength (bs, 4);
-
- moveleft (&nomadinfo.filecreator, &bs [1], 4);
- if (comparestrings (bsnew, bs) == -1) /*bsnew is < bs*/
- return;
-
+ case viewbydate:
+ time1 = (unsigned long) (*newfileinfo).timemodified;
+
break;
- }
- case viewbydate: {
- tybrowserinfo nomadinfo;
-
- browsergetrefcon (nomad, &nomadinfo);
-
- time2 = (unsigned long) nomadinfo.timemodified;
-
- if (time1 >= time2)
- return;
-
+ case viewbysize:
+ size1 = (*newfileinfo).filesize;
+
break;
- }
- case viewbysize: {
- tybrowserinfo nomadinfo;
+ case viewbycolor:
+ label1 = (*newfileinfo).ixlabel;
+
+ break;
+ } /*switch*/
- browsergetrefcon (nomad, &nomadinfo);
+ while (true) {
- size2 = nomadinfo.filesize;
+ switch (folderview) {
- if (size1 >= size2)
- return;
+ case viewbyname:
+ case viewbyicon:
+ case viewbysmallicon:
+ case viewbycomment:
+ case viewbyversion: {
+ bigstring bs;
- break;
- }
+ opgetheadstring (nomad, bs);
+
+ alllower (bs);
+
+ if (comparestrings (bsnew, bs) == -1) /*bsnewhead is < bs*/
+ return;
+
+ break;
+ }
- case viewbycolor: {
- tybrowserinfo nomadinfo;
+ case viewbykind: {
+ tybrowserinfo nomadinfo;
+ bigstring bs;
+
+ browsergetrefcon (nomad, &nomadinfo);
+
+ setstringlength (bs, 4);
+
+ moveleft (&nomadinfo.filecreator, &bs [1], 4);
+
+ if (comparestrings (bsnew, bs) == -1) /*bsnew is < bs*/
+ return;
+
+ break;
+ }
+
+ case viewbydate: {
+ tybrowserinfo nomadinfo;
+
+ browsergetrefcon (nomad, &nomadinfo);
+
+ time2 = (unsigned long) nomadinfo.timemodified;
+
+ if (time1 >= time2)
+ return;
+
+ break;
+ }
+
+ case viewbysize: {
+ tybrowserinfo nomadinfo;
+
+ browsergetrefcon (nomad, &nomadinfo);
+
+ size2 = nomadinfo.filesize;
+
+ if (size1 >= size2)
+ return;
+
+ break;
+ }
+
+ case viewbycolor: {
+ tybrowserinfo nomadinfo;
+
+ browsergetrefcon (nomad, &nomadinfo);
+
+ label2 = nomadinfo.ixlabel;
+
+ if (label1 >= label2)
+ return;
+
+ break;
+ }
+ } /*switch*/
- browsergetrefcon (nomad, &nomadinfo);
+ *hpre = nomad;
- label2 = nomadinfo.ixlabel;
+ *dir = down;
- if (label1 >= label2)
- return;
-
- break;
- }
- } /*switch*/
-
- *hpre = nomad;
-
- *dir = down;
-
- if (!opchasedown (&nomad)) /*it's the last guy in the list*/
- return;
- } /*while*/
+ if (!opchasedown (&nomad)) /*it's the last guy in the list*/
+ return;
+ } /*while*/
#endif
+
} /*browserfindinsertionpoint*/
-boolean browserexpandvisit (bigstring bsitem, tybrowserinfo *info, long refcon) {
+boolean browserexpandvisit ( const Handle handleItem, tybrowserinfo *info, long refcon ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 1993-09-23 dmb: call opstart/endinternalchange around opaddheadline.
+ // this turns off the lineinsertedcallback and prevents an
+ // undo from being built -- which would otherwise delete
+ // the file! these calls used to be in browserpreexpand,
+ // but that was when this visit routine wasn't directly
+ // callable.
+ //
- /*
- dmb 9/23/93: call opstart/endinternalchange around opaddheadline. this turns
- off the lineinsertedcallback and prevents an undo from being built -- which
- would otherwise delete the file! these calls used to be in browserpreexpand,
- but that was when this visit routine wasn't directly callable.
- */
+ register tyexpandinfo *expandinfo = (tyexpandinfo *) refcon;
- register tyexpandinfo *expandinfo = (tyexpandinfo *) refcon;
hdlheadrecord hnew;
if (!testheapspace (512)) /*512 bytes should be plenty*/
@@ -344,15 +362,16 @@
tydirection dir;
if ((*expandinfo).flsortnodes)
- browserfindinsertionpoint ((*expandinfo).hparent, bsitem, info, &hpre, &dir);
+ browserfindinsertionpoint ( ( *expandinfo ).hparent, handleItem, info, &hpre, &dir );
else
- browsercalcinsertionpoint ((*expandinfo).hparent, &hpre, &dir);
+ browsercalcinsertionpoint ( ( *expandinfo ).hparent, &hpre, &dir );
opstartinternalchange (); /*this operation is not undo-able, and mustn't trigger callbacks*/
- opaddheadline (hpre, dir, bsitem, &hnew);
+ opdepositnewheadline (hpre, dir, handleItem, &hnew);
opendinternalchange ();
+
}
browsercopyfileinfo (hnew, info);
@@ -370,18 +389,25 @@
return (false);
}
}
-
+
(*expandinfo).hnewnode = hnew; /*some callers need this*/
return (true);
+
} /*browserexpandvisit*/
boolean browserexpand (hdlheadrecord hnode, long ctlevels) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
tyexpandinfo expandinfo;
tybrowserspec fs;
+ clearbytes ( &fs, sizeof ( fs ) );
+
if (opsubheadsexpanded (hnode)) { /*special case for a node that's already expanded*/
hdlheadrecord nomad = (**hnode).headlinkright;
@@ -513,18 +539,27 @@
boolean browserselectfile (ptrfilespec pfs, boolean flexpand, hdlheadrecord *hnode) {
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+
bigstring filepath;
hdlheadrecord nomad;
boolean flsomethingexpanded = false;
boolean flreturn = false;
boolean fldisplaywasenabled;
+ Handle handlePath;
*hnode = nil;
- compoundexpand = true; opcleartmpbits ();
+ compoundexpand = true;
- filespectopath (pfs, filepath);
+ opcleartmpbits ();
+ filespectopath ( pfs, &handlePath );
+
+ texthandletostring ( handlePath, filepath );
+
fldisplaywasenabled = opdisabledisplay ();
nomad = (**outlinedata).hsummit;
@@ -626,38 +661,27 @@
boolean browserpostcollapse (hdlheadrecord hnode) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 5.1.4 dmb: after deleting an auto-created node, we still need to delete
+ // subs
+ //
+ // 5.0a25 dmb: auto-delete auto-created node
+ //
- /*
- 5.0a25 dmb: auto-delete auto-created node
-
- 5.1.4 dmb: after deleting an auto-created node, we still need to delete subs
- */
-
hdloutlinerecord ho = outlinedata;
boolean fldisplaywasenabled;
killundo ();
/*toss auto-created nodes, if present*/ {
+
hdlheadrecord hsub = (**hnode).headlinkright;
browserdeletedummyvalues (hsub);
- /*
- tybrowserspec fs;
- tyvaluerecord val;
-
- if ((**hsub).tmpbit2 && opislastsubhead (hsub)) {
-
- if (claygetfilespec (hsub, &fs) && claylookupvalue (&fs, &val))
- if (val.valuetype == novaluetype) {
-
- hashtabledelete (fs.parID, fs.name);
-
- //return (true);
- }
- }
- */
}
fldisplaywasenabled = opdisabledisplay (); /*keep the cursor line from flashing*/
@@ -681,6 +705,6 @@
opendinternalchange ();
return (true);
+
} /*browserpostcollapse*/
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claybrowserstruc.c 2007-01-17 19:44:42 UTC (rev 1606)
@@ -47,17 +47,18 @@
#include "claybrowserexpand.h"
#include "claybrowservalidate.h"
#include "claybrowserstruc.h"
+
#if odbbrowser
+
#include "shell.rsrc.h"
#include "shellundo.h"
#include "tableinternal.h"
#include "tableverbs.h"
#include "wpengine.h"
+
#endif
-
-
boolean browsergetrefcon (hdlheadrecord hnode, tybrowserinfo *info) {
return (opgetrefcon (hnode, info, sizeof (tybrowserinfo)));
@@ -88,89 +89,101 @@
} /*browsercopyfileinfo*/
-static void filepushsuffixnumber (short suffixnum, bigstring name) {
+static void filepushsuffixnumber ( short suffixnum, Handle *name ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
- if (suffixnum > 0) {
+ if ( suffixnum > 0 ) {
- pushstring (BIGSTRING ("\x02" " #"), name);
+ pushtexthandle ( BIGSTRING ( "\x02" " #" ), *name );
- pushint (suffixnum, name);
+ pushIntHandle ( suffixnum, *name );
+
}
- } /*filepushsuffixnumber*/
+
+ } // filepushsuffixnumber
-static void filepopsuffixnumber (short suffixnum, bigstring name) {
+static void filepopsuffixnumber ( short suffixnum, Handle *name ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
- byte bssuffix [32];
+ Handle h;
+ byte bssuffix [ 32 ];
short ixsuffix;
+ long length = gethandlesize ( *name );
- if (suffixnum > 0) {
+ if ( suffixnum > 0 ) {
- copystring (BIGSTRING ("\x02" " #"), bssuffix);
+ copystring ( BIGSTRING ( "\x02" " #" ), bssuffix );
- pushint (suffixnum, bssuffix);
+ pushint ( suffixnum, bssuffix );
- ixsuffix = patternmatch (bssuffix, name) - 1;
-
- if (ixsuffix == stringlength (name) - stringlength (bssuffix))
- setstringlength (name, ixsuffix);
+ newtexthandle ( bssuffix, &h );
+
+ ixsuffix = searchhandle ( *name, h, 0, length );
+
+ if ( ixsuffix == length - stringlength ( bssuffix ) )
+ sethandlesize ( *name, ixsuffix );
}
- } /*filepushsuffixnumber*/
+ } // filepushsuffixnumber
+
boolean claygetfilespec (hdlheadrecord hnode, tybrowserspec *fs) {
- /*
- turn a headrecord into a filespec.
+ //
+ // turn a headrecord into a filespec.
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 5.1.4 dmb: on failure, clear fs
+ //
+ // 1993-09-21 dmb: don't need special case for volumes anymore. Think Ref's
+ // recommendation is fine for specifying volumes, but it's
+ // event better to specify the root directory of the
+ // volume, removing any special cases.
+ //
+ // 1993-08-30 DW: rewrite.
+ //
+ // 1993-06-27 DW: per recommendation of Think Reference, if it's a volume,
+ // just set the vRefNum field of the filespec.
+ //
- 6/27/93 DW: per recommendation of Think Reference, if it's a
- volume, just set the vRefNum field of the filespec.
-
- 8/30/93 DW: rewrite.
-
- 9/21/93 dmb: don't need special case for volumes anymore. Think Ref's
- recommendation is fine for specifying volumes, but it's event better
- to specify the root directory of the volume, removing any special cases.
-
- 5.1.4 dmb: on failure, clear fs
- */
-
+ Handle name;
+ boolean fl;
tybrowserinfo info;
- bigstring name;
if (!browsergetrefcon (hnode, &info)) {
-
+
clearbytes (fs, sizeof (tybrowserspec));
return (false);
+
}
-
- /*
- if (info.flvolume) { /%special case%/
- (*fs).vRefNum = info.vnum;
-
- (*fs).parID = 0;
-
- setstringlength ((*fs).name, 0);
-
- return (true);
- }
- */
+ opGetHeadTextHandle ( hnode, &name );
- opgetheadstring (hnode, name);
+ fl = claymakespec ( info.vnum, info.dirid, name, fs ); // dmb 5.0b9 - was: filepushsuffixnumber (info.suffixnum, name);
- // dmb 5.0b9 - was: filepushsuffixnumber (info.suffixnum, name);
+ disposehandle ( name );
- return (claymakespec (info.vnum, info.dirid, name, fs));
- } /*claygetfilespec*/
+ return ( fl );
+
+ } // claygetfilespec
boolean browserloadnode (hdlheadrecord hnode) {
+ tybrowserinfo fileinfo;
tybrowserspec fs;
- tybrowserinfo fileinfo;
+ clearbytes ( &fs, sizeof ( fs ) );
+
(**hnode).fldirty = true; /*force update to reflect new info*/
claygetfilespec (hnode, &fs);
@@ -181,6 +194,7 @@
(**hnode).flnodeisfolder = fileinfo.flfolder;
return (browsercopyfileinfo (hnode, &fileinfo));
+
} /*browserloadnode*/
@@ -213,53 +227,31 @@
return (false);
} /*browserchecklinelength*/
-#if 0
-static boolean browserupdatefileinfo (hdlheadrecord hnode) {
+boolean browserfileadded (hdlheadrecord hnodeparent, const tybrowserspec *fsnew, hdlheadrecord *hnew) {
- /*
- change the in-memory info to reflect what's on disk
- */
+ //
+ // a new item has been added to a folder, our job is to add the file to the
+ // display.
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 1993-09-23 dmb: removed setting/clearing of
+ // lineinsertedcallbackdisabled. browserexpandvisit now
+ // calls opstart/endinternalchange to handle this.
+ //
- tybrowserspec fs;
- tybrowserinfo info;
-
- if (hnode == nil) /*defensive driving*/
- return (false);
-
- claygetfilespec (hnode, &fs);
-
- claygetfileinfo (&fs, &info);
-
- browsercopyfileinfo (hnode, &info);
-
- return (true);
- } /*browserupdatefileinfo*/
-
-#endif
-
-
-boolean browserfileadded (hdlheadrecord hnodeparent, const tybrowserspec *fsnew, hdlheadrecord *hnew) {
-
- /*
- a new item has been added to a folder, our job is to add the file
- to the display.
-
- dmb 9/23/93: removed setting/clearing of lineinsertedcallbackdisabled.
- browserexpandvisit now calls opstart/endinternalchange to handle this.
- */
-
+ Handle name;
+ boolean fl;
+ tybrowserinfo newfileinfo;
tyexpandinfo expandinfo;
- tybrowserinfo newfileinfo;
- bigstring fname;
- boolean fl;
claygetfileinfo (fsnew, &newfileinfo);
-
- claygetfilename (fsnew, fname);
+ claygetfilename ( fsnew, &name );
+
expandinfo.hparent = hnodeparent;
-
+
expandinfo.ctlevels = 1;
expandinfo.flsortnodes = true;
@@ -270,7 +262,7 @@
lineinsertedcallbackdisabled = true;
*/
- fl = browserexpandvisit (fname, &newfileinfo, (long) &expandinfo);
+ fl = browserexpandvisit ( name, &newfileinfo, ( long ) &expandinfo );
/*
lineinsertedcallbackdisabled = false;
@@ -278,13 +270,14 @@
if (!fl)
return (false);
+
+ opexpandupdate (expandinfo.hnewnode);
- opexpandupdate (expandinfo.hnewnode);
-
*hnew = expandinfo.hnewnode;
return (fl);
- } /*browserfileadded*/
+
+ } // browserfileadded
#if 0
@@ -337,52 +330,74 @@
} /*foldercontainsfile*/
-static boolean claygetuniquefilename (tybrowserspec *fs, short *suffixnum) {
+static boolean claygetuniquefilename ( tybrowserspec *fs, short *suffixnum ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 5.0b9 dmb: we now expect suffixnum to have a meaningingful initial
+ // value. if it's non-zero, and the headstring ends in that
+ // suffix, remove the existing suffix before comparing
+ //
- /*
- 5.0b9 dmb: we now expect suffixnum to have a meaningingful initial value.
+ Handle name, origname;
+ boolean flfolder, flmustsuffixize = false; // Timothy Paustian Sunday, May 7, 2000 8:42:22 PM - flfolder unused
- if it's non-zero, and the headstring ends in that suffix, remove the
- existing suffix before comparing
- */
-
- bigstring origname, name;
- ////Code change by Timothy Paustian Sunday, May 7, 2000 8:42:22 PM
- //This isn't used
- //boolean flfolder;
- boolean flmustsuffixize = false;
+ filepopsuffixnumber ( *suffixnum, &( *fs ).name );
- filepopsuffixnumber (*suffixnum, (*fs).name);
+ copyhandle ( ( *fs ).name, &origname );
- copystring ((*fs).name, origname);
-
*suffixnum = 0;
- if (isemptystring (origname)) {
+ if ( isemptyhandle ( origname ) ) {
+
#if filebrowser
- return (false);
+
+ disposehandle ( origname );
+
+ return ( false );
+
#else
- copystring (BIGSTRING ("\x04" "item"), origname);
+
+ disposehandle ( origname );
+
+ if ( ! newtexthandle ( BIGSTRING ( "\x04" "item" ), &origname ) )
+ return ( false );
+
flmustsuffixize = true;
+
#endif
+
}
- while (flmustsuffixize || clayfileexists (fs, &flfolder)) {
+ while ( flmustsuffixize || clayfileexists ( fs, &flfolder ) ) {
flmustsuffixize = false; // reset
- copystring (origname, name);
+ copyhandle ( origname, &name );
- (*suffixnum)++;
+ ( *suffixnum )++;
- filepushsuffixnumber (*suffixnum, name);
+ filepushsuffixnumber ( *suffixnum, &name );
- if (!claymakespec ((*fs).vRefNum, (*fs).parID, name, fs))
+ if ( ! claymakespec ( ( *fs ).vRefNum, ( *fs ).parID, name, fs ) ) {
+
+ disposehandle ( name );
+ disposehandle ( origname );
+
return (false);
- } /*while*/
+
+ }
+
+ disposehandle ( name );
+
+ } // while
+ disposehandle ( origname );
+
return (true);
- } /*claygetuniquefilename*/
+
+ } // claygetuniquefilename
static tybrowserspec undofolderspec;
@@ -396,29 +411,49 @@
static hdlheadrecord hdeletednode = nil; /*last node deleted (unlinked) -- may yet be re-inserted*/
-static boolean getundofolderspec (void) {
+static boolean getundofolderspec ( void ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ Handle h;
static boolean folderfound = false;
-
- if (folderfound)
- return (true);
- folderfound = claygetspecialfolder (BIGSTRING ("\x04" "Undo"), true, &undofolderspec);
+ if ( folderfound )
+ return ( true );
- return (folderfound);
- } /*getundofolderspec*/
+ if ( ! newtexthandle ( BIGSTRING ( "\x04" "Undo" ), &h ) )
+ return ( false );
+
+ folderfound = claygetspecialfolder ( h, true, &undofolderspec );
+ disposehandle ( h );
-static boolean getclipfolderspec (void) {
+ return ( folderfound );
+ } // getundofolderspec
+
+
+static boolean getclipfolderspec ( void ) {
+
+ Handle h;
static boolean folderfound = false;
-
+
+ clearbytes ( &undofolderspec, sizeof ( clipfolderspec ) );
+
if (folderfound)
return (true);
+
+ if ( ! newtexthandle ( BIGSTRING ( "\x09" "Clipboard" ), &h ) )
+ return ( false );
+
+ folderfound = claygetspecialfolder ( h, true, &clipfolderspec );
- folderfound = claygetspecialfolder (BIGSTRING ("\x09" "Clipboard"), true, &clipfolderspec);
+ disposehandle ( h );
return (folderfound);
+
} /*getclipfolderspec*/
@@ -427,6 +462,7 @@
getundofolderspec ();
return (clayemptyfilefolder (&undofolderspec));
+
} /*browserclearundo*/
@@ -456,76 +492,55 @@
} /*browserdeletenodeswithtmpbitset*/
-/*
-static boolean browsercreatefile (hdlheadrecord hnode, tybrowserspec *fsfolder) {
-
- bigstring bs;
- tybrowserspec fsdest;
-
- opgetheadstring (hnode, bs);
-
- claygetsubitemspec (fsfolder, bs, &fsdest);
-
- if (claycreatefile (&fsdest)) {
-
- /%update the node's refcon to reflect the new file's position & attributes%/
-
- tybrowserinfo browserinfo;
-
- claygetfileinfo (&fsdest, &browserinfo);
-
- browsersetrefcon (hnode, &browserinfo);
- }
-
- return (true);
- } /%browsercreatefile%/
-*/
-
static boolean browsermoveto (hdlheadrecord hnode, tybrowserspec *fsfolder) {
-
- /*
- move or copy the file or folder connected to hnode to the
- indicated folder.
-
- if a file with that name already exists, append a suffix
- to the name.
-
- the "flnodeonscrap" attribute of a node indicates whether or
- not it owns the file described by the refcon. it can be false
- when a node is on the outline scrap, for example.
-
- dmb 9/20/93: 1) since undo & clip folders are always on sys volume now, we
- can't assume vRefNum of source & dest are the same; 2) fixed suffixnum
- updating; was assigning to info instead of browserinfo; 3) fsdest must not
- take suffixnum into account. suffixnum is essential for determining fssource
- from the node, but the dest should correspond to the headline name.
- 5.0b13 dmb: with the new meaning of suffixnum -- that the node/value name
- has been modified to be unique in it's new location -- we shouldn't consider
- and intially-unique name like "item #1" to be suffixized
+ // move or copy the file or folder connected to hnode to the indicated
+ // folder.
+ //
+ // if a file with that name already exists, append a suffix to the name.
+ //
+ // the "flnodeonscrap" attribute of a node indicates whether or not it
+ // owns the file described by the refcon. it can be false when a node is on
+ // the outline scrap, for example.
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 5.1.4 dmb: don't ignore return value of claygetsubitemspec
+ //
+ // 5.0.2b20 dmb: don't do copy/delete if source or dest vnum is zero
+ //
+ // 5.0b13 dmb: with the new meaning of suffixnum -- that the node/value
+ // name has been modified to be unique in it's new location --
+ // we shouldn't consider and intially-unique name like
+ // "item #1" to be suffixized
+ //
+ // 1993-09-20 dmb: 1) since undo & clip folders are always on sys volume
+ // now, we can't assume vRefNum of source & dest are the
+ // same; 2) fixed suffixnum updating; was assigning to info
+ // instead of browserinfo; 3) fsdest must not take
+ // suffixnum into account. suffixnum is essential for
+ // determining fssource from the node, but the dest should
+ // correspond to the headline name.
+ //
- 5.0.2b20 dmb: don't do copy/delete if source or dest vnum is zero
+ Handle h;
+ boolean flsourceexists;
+ short suffixnum;
+ tybrowserinfo info;
+ tybrowserspec fsdest, fssource;
- 5.1.4 dmb: don't ignore return value of claygetsubitemspec
- */
+ clearbytes ( &fsdest, sizeof ( fsdest ) );
+ clearbytes ( &fssource, sizeof ( fssource ) );
- tybrowserspec fssource, fsdest;
- tybrowserinfo info;
- short suffixnum;
- bigstring bs;
- boolean flsourceexists;
-
flsourceexists = claygetfilespec (hnode, &fssource);
- if (flsourceexists) { // hnode is associated with a file
-
+ if (flsourceexists) // hnode is associated with a file
if (foldercontainsfile (fsfolder, &fssource)) // already in the folder*/
return (true);
- }
- opgetheadstring (hnode, bs);
+ opGetHeadTextHandle ( hnode, &h );
- if (!claygetsubitemspec (fsfolder, bs, &fsdest))
+ if ( ! claygetsubitemspec ( fsfolder, h, &fsdest ) )
return (false);
if (!browsergetrefcon (hnode, &info)) // 5.0b9 dmb
@@ -543,7 +558,8 @@
else {
if (!(**hnode).flnodeonscrap) { /*we own this file -- move it*/
- if (((fssource.vRefNum == fsdest.vRefNum) || (fssource.vRefNum == 0) || (fsdest.vRefNum == 0)) && equalidentifiers (fssource.name, fsdest.name)) {
+ if ( ( ( fssource.vRefNum == fsdest.vRefNum ) || ( fssource.vRefNum == 0 ) || ( fsdest.vRefNum == 0 ) ) &&
+ equaltextidentifiers ( *fssource.name, *fsdest.name, gethandlesize ( fssource.name ) ) ) {
if (!claymovefile (&fssource, fsfolder))
return (false);
@@ -554,16 +570,17 @@
return (false);
claydeletefile (&fssource);
+
}
}
- else { /*file not owned -- make a copy*/
-
+ else { // file not owned -- make a copy
+
if (!claycopyfile (&fssource, &fsdest))
return (false);
}
}
- /*update the node's refcon to reflect the new file's position & attributes*/ {
+ /* update the node's refcon to reflect the new file's position & attributes */ {
tybrowserinfo browserinfo;
@@ -575,40 +592,46 @@
browserinfo.suffixnum = suffixnum; // dmb 5.0b9: new
if (suffixnum != info.suffixnum) { // suffix was added or removed
-
+
opstartinternalchange ();
- opsetactualheadstring (hnode, fsdest.name);
+ sethandlecontents ( *fsdest.name, gethandlesize ( fsdest.name ), ( **hnode ).headstring );
opendinternalchange ();
+
}
#endif
- if (!flsourceexists && isemptystring (bs)) { // a new insertion
-
+ if ( ! flsourceexists && isemptyhandle ( h ) ) { // a new insertion
+
(**hnode).tmpbit2 = true;
- langexternaldontsave (fsdest.parID, fsdest.name); // 5.1.4
+ langexternaldontsave ( fsdest.parID, fsdest.name ); // 5.1.4
browserinfo.suffixnum = 0; // we made up the name, it's real w/whatever suffix
+
}
browsersetrefcon (hnode, &browserinfo);
+
}
(**hnode).flnodeonscrap = false;
return (true);
- } /*browsermoveto*/
+
+ } // browsermoveto
boolean browsergetparentspec (hdlheadrecord hnode, tybrowserspec *fsparent) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 5.0.2b21 dmb: use new shellgetdatabase to get parent of summit
+ //
+ // 1997-05-13 dmb: fixed summit (root table) case
+ //
- /*
- 5.13.97 dmb: fixed summit (root table) case
-
- 5.0.2b21 dmb: use new shellgetdatabase to get parent of summit
- */
-
hdlheadrecord hparent = (**hnode).headlinkleft;
hdltableformats hformats;
@@ -620,12 +643,12 @@
(*fsparent).parID = (**hformats).htable; // 5.0d18 dmb: this is as clean as it gets for now
- setemptystring ((*fsparent).name);
-
return (true);
+
}
+
+ return (claygetfilespec (hparent, fsparent));
- return (claygetfilespec (hparent, fsparent));
} /*browsergetparentspec*/
@@ -735,20 +758,24 @@
tybrowserspec fapp, fdoc;
+ clearbytes ( &fapp, sizeof ( fapp ) );
+ clearbytes ( &fdoc, sizeof ( fdoc ) );
+
claygetfilespec (htarget, &fapp);
claygetfilespec ((**outlinedata).hbarcursor, &fdoc);
claylaunchappwithdoc (&fapp, &fdoc, true);
+
}
-
+
#endif
} /*browserpredrag*/
boolean browserdragcopy (hdlheadrecord hmove, hdlheadrecord hdest) {
-
+
/*
we're moving hmove down or to the right of hdest. if they're
not both from the same volume, we need to move a copy, not the
@@ -757,6 +784,9 @@
tybrowserspec fs1, fs2;
+ clearbytes ( &fs1, sizeof ( fs1 ) );
+ clearbytes ( &fs2, sizeof ( fs2 ) );
+
claygetfilespec (hmove, &fs1);
claygetfilespec (hdest, &fs2);
@@ -779,19 +809,19 @@
void browsersortfolder (hdlheadrecord hnode) {
+
+ //
+ // hnode is a folder whose sort order has changed. unlink all its subnodes
+ // and reinsert them into the list sorted according to the new order.
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
- /*
- hnode is a folder whose sort order has changed. unlink all its
- subnodes and reinsert them into the list sorted according to the
- new order.
- */
-
- hdlheadrecord nomad = (**hnode).headlinkright, nextnomad;
+ Handle h;
+ hdlheadrecord hpre, nextnomad, nomad = (**hnode).headlinkright;
+ hdlscreenmap hmap;
tybrowserinfo browserinfo;
- bigstring bs;
- hdlheadrecord hpre;
tydirection dir;
- hdlscreenmap hmap;
if (nomad == hnode) /*no subs expanded, nothing to do*/
return;
@@ -812,9 +842,9 @@
browsergetrefcon (nomad, &browserinfo);
- opgetheadstring (nomad, bs);
+ opGetHeadTextHandle ( nomad, &h );
- browserfindinsertionpoint (hnode, bs, &browserinfo, &hpre, &dir);
+ browserfindinsertionpoint (hnode, h, &browserinfo, &hpre, &dir);
opdeposit (hpre, dir, nomad);
@@ -837,29 +867,31 @@
#ifdef fldebug
opvalidate (outlinedata);
#endif
+
} /*browsersortfolder*/
void browserinsertagain (hdlheadrecord hnode) {
- /*
- the node's text or other info has been changed, it might sort
- to a different place in its parent folder's list. we unlink it
- from the structure, and link it back in where it belongs.
+ //
+ // the node's text or other info has been changed, it might sort to a
+ // different place in its parent folder's list. we unlink it from the
+ // structure, and link it back in where it belongs.
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 5.0d14 dmb: do nothing when hnode is the only node at its level.
+ // particularly imporant when hnode is an only summit.
+ //
+ // 1993-09-24 dmb: don't want an undo built for this operation, since it's
+ // a passive reordering going on here.
+ //
- 9/24/93 dmb: don't want an undo built for this operation, since
- it's a passive reordering going on here.
-
- 5.0d14 dmb: do nothing when hnode is the only node at its level.
- particularly imporant when hnode is an only summit.
- */
-
- hdlheadrecord hparent;
- bigstring bs;
+ Handle h;
+ hdlheadrecord hparent, hpre;
+ hdlscreenmap hmap;
tybrowserinfo browserinfo;
- hdlheadrecord hpre;
tydirection dir;
- hdlscreenmap hmap;
if (opcountatlevel (hnode) == 1) /*has no siblings, can't change order*/
return;
@@ -871,7 +903,7 @@
opstartinternalchange (); /*don't want this to trigger callbacks or add to undo stack*/
- opgetheadstring (hnode, bs);
+ opGetHeadTextHandle ( hnode, &h );
opnewscreenmap (&hmap);
@@ -879,17 +911,18 @@
browsergetrefcon (hnode, &browserinfo);
- browserfindinsertionpoint (hparent, bs, &browserinfo, &hpre, &dir);
+ browserfindinsertionpoint (hparent, h, &browserinfo, &hpre, &dir);
opdeposit (hpre, dir, hnode);
(**outlinedata).hbarcursor = hnode;
-// 2/20/97 dmb: shouldn't need this: opsetctexpanded ();
+ // 2/20/97 dmb: shouldn't need this: opsetctexpanded ();
opinvalscreenmap (hmap);
opendinternalchange ();
+
} /*browserinsertagain*/
@@ -912,9 +945,11 @@
static boolean browsergetnodevalue (hdlheadrecord hnode, tyvaluerecord *val) {
+ hdlhashnode hhashnode;
tybrowserspec fs;
- hdlhashnode hhashnode;
+ clearbytes ( &fs, sizeof ( fs ) );
+
if (!claygetfilespec (hnode, &fs))
return (false);
@@ -943,27 +978,33 @@
flinternalchange is true, for example, when you collapse a folder. the
nodes are deleted, but the files must not be.
+
*/
if (!opinternalchange () && fldisk && (!(**hnode).flnodeonscrap)) {
tybrowserspec fs;
+ clearbytes ( &fs, sizeof ( fs ) );
+
claygetfilespec (hnode, &fs);
claydeletefile (&fs);
+
}
if (hnode == hdeletednode)
hdeletednode = nil;
return (true);
+
} /*browserreleaserefcon*/
static boolean lineinsertvisit (hdlheadrecord hnode, ptrvoid refcon) {
-#pragma unused (refcon)
+ #pragma unused (refcon)
+
/*
set the node's refcon info to reflect its current position in
the outline hierarchy.
@@ -972,6 +1013,8 @@
tybrowserinfo info;
tybrowserspec fsparent;
+ clearbytes ( &fsparent, sizeof ( fsparent ) );
+
browsergetparentspec (hnode, &fsparent);
if (browsergetrefcon (hnode, &info)) {
@@ -986,6 +1029,7 @@
(**hnode).flnodeonscrap = false;
return (true);
+
} /*lineinsertvisit*/
@@ -999,10 +1043,7 @@
tybrowserspec fsparent;
- /*
- if (lineinsertedcallbackdisabled)
- return (true);
- */
+ clearbytes ( &fsparent, sizeof ( fsparent ) );
if (hnode == hdeletednode) /*finishing a move operation*/
hdeletednode = nil;
@@ -1024,6 +1065,7 @@
oprecursivelyvisit (hnode, infinity, &lineinsertvisit, nil);
return (true);
+
} /*browserlineinserted*/
@@ -1077,7 +1119,7 @@
static boolean closeownedwindows (hdlheadrecord hnode) {
-
+
/*
hnode has been deleted, but with undo. so the external value nodes
aren't being disposed to trigger window closing. tablesymboldeleted
@@ -1088,17 +1130,20 @@
tableexternal.c
*/
+ hdlhashnode hn;
tybrowserspec fs;
- hdlhashnode hn;
+ clearbytes ( &fs, sizeof ( fs ) );
+
if (!claygetfilespec (hnode, &fs))
return (false);
- if (!hashtablelookupnode (fs.parID, fs.name, &hn))
- return (false);
+ if ( ! hashtablelookupnode ( fs.parID, fs.name, &hn ) )
+ return ( false );
+
+ return ( closeownedwindowsvisit ( hn, nil ) );
- return (closeownedwindowsvisit (hn, nil));
- } /*notownrefconvisit*/
+ } // notownrefconvisit
boolean browsercommitchanges (void) {
@@ -1119,33 +1164,10 @@
hdeletednode = nil;
return (fl);
+
} /*browsercommitchanges*/
-#if 0
-
-static boolean xxxbrowserexportscrap (hdloutlinerecord hscrap) {
-
- hdlheadrecord nomad = (**hscrap).hsummit;
-
- if (!getclipfolderspec ())
- return (false);
-
- while (true) {
-
- if (!browsermoveto (nomad, &clipfolderspec))
- return (false);
-
- oprecursivelyvisit (nomad, infinity, ¬ownrefconvisit, nil);
-
- if (!opchasedown (&nomad))
- return (true);
- } /*while*/
- } /*browserexportscrap*/
-
-#endif
-
-
static void tabledisposescrap (hdloutlinerecord houtline) {
opdisposeoutline (houtline, false);
@@ -1260,25 +1282,23 @@
return true if no errors occur
*/
+ hdlhashnode hhashnode;
tybrowserspec fs;
tyvaluerecord val;
- hdlhashnode hhashnode;
+ clearbytes ( &fs, sizeof ( fs ) );
+
while (true) {
- if ((**hnode).tmpbit2) {
-
- if (claygetfilespec (hnode, &fs) && claylookupvalue (&fs, &val, &hhashnode)) {
-
+ if ((**hnode).tmpbit2)
+ if (claygetfilespec (hnode, &fs) && claylookupvalue (&fs, &val, &hhashnode))
if (val.valuetype == novaluetype)
- if (!hashtabledelete (fs.parID, fs.name))
- return (false);
- }
- }
-
+ if ( ! hashtabledelete ( fs.parID, fs.name ) )
+ return ( false );
+
if (!opchasedown (&hnode))
return (true);
}
+
} /*browserdeletedummyvalues*/
-
Modified: Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c
===================================================================
--- Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c 2007-01-17 18:10:34 UTC (rev 1605)
+++ Frontier/branches/Frontier_Long_File_Paths/Common/source/claycallbacks.c 2007-01-17 19:44:42 UTC (rev 1606)
@@ -52,37 +52,60 @@
-#if filebrowser
+typedef struct tycallbackinfo {
-boolean claymakespec (tybrowservol vnum, tybrowserdir dirid, bigstring fname, tybrowserspec *pfs) {
+ #if odbbrowser
+
+ hdldatabaserecord hdatabase;
+
+ hdlhashtable hparenttable;
+
+ #endif
+
+ tyclayfileloopcallback callback;
+
+ long refcon;
+
+ } tycallbackinfo;
- return (filemakespec (vnum, dirid, fname, pfs));
- } /*claymakespec*/
-#endif
+boolean claymakespec ( tybrowservol vnum, tybrowserdir dirid, const Handle name, tybrowserspec *pfs ) {
-#if odbbrowser
+ #if filebrowser
-boolean claymakespec (tybrowservol vnum, tybrowserdir dirid, bigstring fname, tybrowserspec *pfs) {
-
- (*pfs).vRefNum = vnum;
+ return ( filemakespec ( vnum, dirid, name, pfs ) );
- (*pfs).parID = dirid;
-
- copystring (fname, (*pfs).name);
-
- return (dirid != 0L);
- } /*claymakespec*/
+ #endif
-#endif
+ #if odbbrowser
+ (*pfs).vRefNum = vnum;
+
+ (*pfs).parID = dirid;
+
+ if ( ( *pfs ).name == NULL )
+ copyhandle ( name, &( *pfs ).name );
+ else
+ sethandlecontents ( *name, gethandlesize ( name ), ( *pfs ).name );
+
+ return ( dirid != 0L );
+
+ #endif
+
+ } // claymakespec
+
#if odbbrowser
-boolean claylookupvalue (const tybrowserspec *fs, tyvaluerecord *val, hdlhashnode * hnode) {
+boolean claylookupvalue ( const tybrowserspec *fs, tyvaluerecord *val, hdlhashnode * hnode ) {
- return (hashtablelookup ((*fs).parID, (*fs).name, val, hnode));
- } /*claylookupvalue*/
+ boolean fl;
+
+ fl = hashtablelookup ( ( *fs ).parID, ( *fs ).name, val, hnode );
+
+ return ( fl );
+
+ } // claylookupvalue
boolean claycopyfile (const tybrowserspec *fsource, const tybrowserspec *fdest) {
@@ -140,11 +163,11 @@
opstartinternalchange ();
if (fl) {
+
+ fl = hashtableassign ( ( *fdest ).parID, (*fdest).name, val );
- fl = hashtableassign ((*fdest).parID, (*fdest).name, val);
-
- if (!fl)
- disposevaluerecord (val, true);
+ if ( ! fl )
+ disposevaluerecord ( val, true );
}
opendinternalchange ();
@@ -164,7 +187,7 @@
boolean claycreatefile (const tybrowserspec *fs) {
-
+
tyvaluerecord val;
boolean fl;
@@ -172,154 +195,147 @@
opstartinternalchange ();
- fl = hashtableassign ((*fs).parID, (*fs).name, val);
+ fl = hashtableassign ( ( *fs ).parID, ( *fs ).name, val );
opendinternalchange ();
return (fl);
- } /*claycreatefile*/
+
+ } // claycreatefile
-boolean claydeletefile (const tybrowserspec *fs) {
-
+boolean claydeletefile ( const tybrowserspec *fs ) {
+
boolean fl;
opstartinternalchange ();
- fl = hashtabledelete ((*fs).parID, (ptrstring) (*fs).name);
+ fl = hashtabledelete ( ( *fs ).parID, ( *fs ).name );
opendinternalchange ();
return (fl);
- } /*claydeletefile*/
+
+ } // claydeletefile
-boolean claymovefile (const tybrowserspec *fs, const tybrowserspec *fsto) {
+boolean claymovefile ( const tybrowserspec *fs, const tybrowserspec *fsto ) {
- tyvaluerecord val;
- hdlhashtable hdest;
boolean fl;
hdlhashnode hnode;
+ hdlhashtable hdest;
+ tyvaluerecord val;
if (!claygetdirid (fsto, &hdest)) {
langerrormessage (BIGSTRING ("\x1b" "destination must be a table"));
return (false);
+
}
opstartinternalchange ();
pushhashtable ((*fs).parID);
- fl = hashlookup ((*fs).name, &val, &hnode);
+ fl = hashlookup ( ( *fs ).name, &val, &hnode );
- if (fl) {
+ if (fl)
+ hashdelete ( ( *fs ).name, false, false ); // don't toss the value
- // if ((*fs).parID == agentstable)
-
- hashdelete ((*fs).name, false, false); /*don't toss the value*/
- }
-
-
pophashtable ();
- if (fl) {
+ if (fl)
+ fl = hashtableassign ( hdest, ( *fs ).name, val );
- fl = hashtableassign (hdest, (*fs).name, val);
-
- /*
- if (fl && (hdest == agentstable) {
-
- hashtablelookupnode (hdest, (*fs).name, &hnode);
-
- scriptinstallagent (hnode);
- }
- */
- }
-
opendinternalchange ();
return (true);
- } /*claymovefile*/
+ } // claymovefile
-#endif
-#if filebrowswer
+boolean clayfileexists ( tybrowserspec *fs, boolean *isfolder ) {
-static boolean filedeletevisit (bigstring bsitem, tyfileinfo *info, long refcon) {
+ //
+ // 2006-12-14 creedon: created, cribbed from macro
+ //
- tybrowserspec fs;
+ return ( hashtablesymbolexists ( ( hdlhashtable ) ( *fs ).parID, ( *fs ).name ) );
-// if (stringlength (fs.name) == 0) /*defensive driving -- if you turn this off -- it could delete C source code in the program you're testing*/
-// return (false);
-
- claymakespec ((*info).vnum, (*info).dirid, bsitem, &fs);
-
- return (filedelete (&fs));
- } /*filedeletevisit*/
+ } // clayfileexists
-
-boolean clayemptyfilefolder (tybrowserspec *fsfolder) {
-
- return (folderloop (fsfolder, true, &filedeletevisit, 0));
- } /*clayemptyfilefolder*/
-
#endif
-#if odbbrowser
-boolean clayemptyfilefolder (tybrowserspec *fsfolder) {
+#if filebrowswer
- return (emptyhashtable ((*fsfolder).parID, true) > 0);
- } /*clayemptyfilefolder*/
-
-
+ static boolean filedeletevisit (bigstring bsitem, tyfileinfo *info, long refcon) {
+
+ tybrowserspec fs;
+
+ clearbytes ( &fs, sizeof ( fs ) );
+
+ claymakespec ((*info).vnum, (*info).dirid, bsitem, &fs);
+
+ return (filedelete (&fs));
+
+ } /*filedeletevisit*/
+
#endif
-#if filebrowser
-
-boolean claygetdirid (const tybrowserspec * fsfolder, tybrowserdir *dirid) {
-
- //
- // 2006-06-23 creedon: FSRef-ized
- //
+boolean clayemptyfilefolder ( tybrowserspec *fsfolder ) {
- FSRefParam pb;
-
- if (!getmacfileinfo (fsfolder, &pb))
- return (false);
+ #if filebrowswer
+
+ return ( folderloop ( fsfolder, true, &filedeletevisit, 0 ) );
- *dirid = pb.dirInfo.ioDrDirID;
+ #endif
- return (true);
- } // claygetdirid
+ #if odbbrowser
+
+ return ( emptyhashtable ( ( *fsfolder).parID, true ) > 0 );
+
+ #endif
+
+ } // clayemptyfilefolder
-#endif
#if odbbrowser
-static boolean claygetfolder (const tybrowserspec * fsfolder, tybrowserdir *dirid, boolean flinmemory) {
+static boolean claygetfolder ( const tybrowserspec *fsfolder, tybrowserdir *dirid, boolean flinmemory ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
- tyvaluerecord val;
hdlhashnode hnode;
+ tyvaluerecord val;
if ((*fsfolder).parID == nil) {
- assert (equalstrings ((*fsfolder).name, nameroottable));
+ Handle h;
+ if ( ! newtexthandle ( nameroottable, &h ) )
+ return ( false );
+
+ assert ( equalhandles ( (*fsfolder).name, h ) );
+
+ disposehandle ( h );
+
*dirid = roottable;
goto tagandexit;
+
}
-
- if (isemptystring ((*fsfolder).name)) {
+ if ( ( *fsfolder ).name == NULL ) {
+
*dirid = (*fsfolder).parID;
goto tagandexit;
+
}
if (!claylookupvalue (fsfolder, &val, &hnode))
@@ -336,28 +352,50 @@
if (!tablevaltotable (val, dirid, hnode))
return (false);
-tagandexit:
-
-// (***dirid).flmayaffectdisplay = true; // let tablesymbol calls know we may care
-
- return (true);
+ tagandexit:
+
+ return (true);
+
} /*claygetfolder*/
-boolean claygetdirid (const tybrowserspec * fsfolder, tybrowserdir *dirid) {
+boolean claygetinmemorydirid ( const tybrowserspec *fsfolder, tybrowserdir *dirid ) {
- return (claygetfolder (fsfolder, dirid, false));
- } /*claygetdirid*/
-
-
-boolean claygetinmemorydirid (const tybrowserspec * fsfolder, tybrowserdir *dirid) {
-
return (claygetfolder (fsfolder, dirid, true));
+
} /*claygetinmemorydirid*/
#endif
+boolean claygetdirid ( const tybrowserspec *fsfolder, tybrowserdir *dirid ) {
+
+ //
+ // 2006-06-23 creedon: for file browser, FSRef-ized
+ //
+
+ #if filebrowser
+
+ FSRefParam pb;
+
+ if ( ! getmacfileinfo ( fsfolder, &pb ) )
+ return ( false );
+
+ *dirid = pb.dirInfo.ioDrDirID;
+
+ return ( true );
+
+ #endif
+
+ #if odbbrowser
+
+ return ( claygetfolder ( fsfolder, dirid, false ) );
+
+ #endif
+
+ } // claygetdirid
+
+
#if filebrowser
static boolean filegetprefsspec (bigstring fname, tybrowserspec *fsprefs) {
@@ -374,24 +412,7 @@
claymakespec (vnum, dirid, fname, fsprefs);
return (true);
- } /*filegetprefsspec*/
-
-#endif
-
-#if 0 //odbbrowser
-
-static boolean xxxfilegetprefsspec (bigstring fname, tybrowserspec *fsprefs) {
- tybrowservol vnum;
- tybrowserdir dirid;
-
- vnum = databasedata; // we really should use a different record, not an fsspec
-
- dirid = internaltable;
-
- claymakespec (vnum, dirid, fname, fsprefs);
-
- return (true);
} /*filegetprefsspec*/
#endif
@@ -414,30 +435,34 @@
#if odbbrowser
static boolean filecreatefolder (tybrowserspec * fsfolder) {
-
+
tybrowserdir folderid;
- return (tablenewsystemtable ((*fsfolder).parID, (*fsfolder).name, (tybrowserdir *) &folderid));
- } /*filecreatefolder*/
+ return ( tablenewsystemtable ( ( *fsfolder ).parID, ( *fsfolder ).name, ( tybrowserdir * ) &folderid ) );
+
+ } // filecreatefolder
#endif
-boolean claygetsubitemspec (tybrowserspec *fsfolder, bigstring fname, tybrowserspec *fssubitem) {
+boolean claygetsubitemspec ( tybrowserspec *fsfolder, const Handle name, tybrowserspec *fssubitem ) {
+
+ //
+ // 2007-01-17 creedon: support for long odb item names and file paths
+ //
+ // 1993-09-20 dmb: must return false if claymakespec returns false
+ //
- /*
- dmb 9/20/93: must return false if claymakespec returns false
- */
-
tybrowserdir dirid;
if (!claygetdirid (fsfolder, &dirid))
return (false);
- return (claymakespec ((*fsfolder).vRefNum, dirid, fname, fssubitem));
- } /*claygetsubitemspec*/
+ return ( claymakespec ( ( *fsfolder ).vRefNum, dirid, name, fssubitem ) );
+
+ } // claygetsubitemspec
-boolean claygetspecialfolder (void *foldername, boolean flcreate, tybrowserspec *fsspecialfolder) {
+boolean claygetspecialfolder ( const Handle foldername, boolean flcreate, tybrowserspec *fsspecialfolder ) {
/*
a bottleneck for finding special Clay Basket folders. it actually works
@@ -449,9 +474,15 @@
the UserLand folder.
*/
+ boolean flfolder;
+
#if filebrowser
- tybrowserspec fsuserland, fsfolder;
+
+ tybrowserspec fsfolder, fsuserland;
+ clearbytes ( &fsfolder, sizeof ( fsfolder ) );
+ clearbytes ( &fsuserland, sizeof ( fsuserland ) );
+
if (!filegetprefsspec (BIGSTRING ("\x08" "UserLand"), &fsuserland))
return (false);
@@ -475,6 +506,7 @@
#endif
#if odbbrowser
+
static hdlhashtable hclaybaskettable = nil;
if (hclaybaskettable == nil) { // first time called
@@ -484,6 +516,7 @@
}
claymakespec (nil, hclaybaskettable, foldername, fsspecialfolder);
+
#endif
if (!flcreate)
@@ -493,8 +526,10 @@
return (filecreatefolder (fsspecialfolder));
return (true);
+
} /*claygetspecialfolder*/
+
#if filebrowser
void fileinfotobrowserinfo (tyfileinfo *fileinfo, tybrowserinfo *browserinfo) {
@@ -548,15 +583,6 @@
#if filebrowser
-
-typedef struct tycallbackinfo {
-
- tyclayfileloopcallback callback;
-
- long refcon;
- } tycallbackinfo;
-
-
static boolean clayfolderexpandvisit (bigstring bsitem, tyfileinfo *info, long refcon) {
tycallbackinfo *cb = (tycallbackinfo *) refcon;
@@ -570,185 +596,187 @@
return ((*(*cb).callback) (bsitem, &browserinfo, (*cb).refcon));
} /*clayfolderexpandvisit*/
-boolean clayfolderloop (const tybrowserspec *pfs, boolean flreverse, tyclayfileloopcallback filecallback, long refcon) {
-
- tycallbackinfo callbackinfo;
-
- callbackinfo.callback = filecallback;
- callbackinfo.refcon = refcon;
-
- return (folderloop (pfs, flreverse, clayfolderexpandvisit, (long) &callbackinfo));
- } /*clayfolderloop*/
-
#endif
#if odbbrowser
-typedef struct tycallbackinfo {
-
- hdldatabaserecord hdatabase;
-
- hdlhashtable hparenttable;
-
- tyclayfileloopcallback callback;
-
- long refcon;
- } tycallbackinfo;
+static boolean clayfolderloopvisit ( const Handle handleName, hdlhashnode hnode, tyvaluerecord val, ptrvoid refcon ) {
-
-static boolean clayfolderloopvisit (bigstring bsname, hdlhashnode hnode, tyvaluerec...
[truncated message content] |