|
From: creedon <icr...@us...> - 2005-09-30 15:29:35
|
Update of /cvsroot/frontierkernel/Frontier/Common/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14626 Modified Files: dialogs.c claybrowservalidate.c Log Message: for replace dialogs the Duplicate button is now the default button, default button for dialogs is safest option Index: dialogs.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/dialogs.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dialogs.c 11 Jan 2005 22:48:05 -0000 1.6 --- dialogs.c 30 Sep 2005 15:29:18 -0000 1.7 *************** *** 47,50 **** --- 47,52 ---- #include "lang.h" #include "mac.h" + #include "langinternal.h" /* 2005-09-26 creedon */ + #include "tablestructure.h" /* 2005-09-26 creedon */ #ifdef flcomponent *************** *** 1403,1411 **** /* return 1 if the user clicked on Replace, 2 if Duplicate, 3 if Cancel. */ ! register DialogPtr pdialog; ! register short itemnumber; sysbeep (); --- 1405,1415 ---- /* + 2005-09-26 creedon: changed order of buttons, default is Duplicate which is the safe option + replace use of replacedialogid with threewaydialog function, easier to maintain one dialog resource, than several + return 1 if the user clicked on Replace, 2 if Duplicate, 3 if Cancel. */ ! /* register DialogPtr pdialog; sysbeep (); *************** *** 1426,1430 **** itemnumber = runmodaldialog (); ! disposemodaldialog (pdialog); switch (itemnumber) { --- 1430,1483 ---- itemnumber = runmodaldialog (); ! disposemodaldialog (pdialog); */ ! ! register short itemnumber; ! bigstring bs, prompt; ! bigstring nobutton, yesbutton; ! boolean fl, flExpertMode = false; ! ! getstringlist (langerrorlist, replaceitemerror, prompt); ! ! parsedialogstring (prompt, bsitem, nil, nil, nil, prompt); ! ! getsystemtablescript (idreplacedialogexpertmode, bs); // "user.prefs.flReplaceDialogExpertMode" ! ! pushhashtable (roottable); ! ! disablelangerror (); ! ! fl = langrunstring (bs, bs); ! ! enablelangerror (); ! ! pophashtable (); ! ! if (fl) ! stringisboolean (bs, &flExpertMode); ! ! if (flExpertMode) { ! copystring (duplicatebuttontext, nobutton); ! copystring (replacebuttontext, yesbutton); ! } ! else { ! copystring (duplicatebuttontext, yesbutton); ! copystring (replacebuttontext, nobutton); ! } ! ! itemnumber = threewaydialog (prompt, yesbutton, nobutton, cancelbuttontext); ! ! if (!flExpertMode) ! switch (itemnumber) { ! ! case 1: ! itemnumber = 2; ! ! break; ! ! case 2: ! itemnumber = 1; ! break; ! ! } switch (itemnumber) { Index: claybrowservalidate.c =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/source/claybrowservalidate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** claybrowservalidate.c 11 Jan 2005 22:48:04 -0000 1.4 --- claybrowservalidate.c 30 Sep 2005 15:29:18 -0000 1.5 *************** *** 35,40 **** #include "claybrowserstruc.h" #include "claybrowservalidate.h" ! ! #define collidewithequal 0x0001 --- 35,40 ---- #include "claybrowserstruc.h" #include "claybrowservalidate.h" ! #include "langinternal.h" /* 2005-09-26 creedon */ ! #include "tablestructure.h" /* 2005-09-26 creedon */ #define collidewithequal 0x0001 *************** *** 212,219 **** static boolean browsercollisiondialog (hdlheadrecord hdest, ptrdraginfo draginfo) { ! bigstring prompt; short itemhit; ! bigstring bscollided; if ((*draginfo).collisiontype == nocollisions) /*no confirmation or deletions needed*/ --- 212,224 ---- static boolean browsercollisiondialog (hdlheadrecord hdest, ptrdraginfo draginfo) { + + /* + 2005-09-26 creedon: changed default order of buttons, default is Duplicate which is the safe option, checks user.prefs.flReplaceDialogExpertMode and if true Replace is the default option + */ ! bigstring bs, bscollided, prompt; ! bigstring nobutton, yesbutton; short itemhit; ! boolean fl, flExpertMode = false; if ((*draginfo).collisiontype == nocollisions) /*no confirmation or deletions needed*/ *************** *** 253,274 **** } ! #ifdef MACVERSION ! itemhit = threewaydialog (prompt, "\x07" "Replace", "\x09" "Duplicate", "\x06" "Cancel"); ! #endif ! #ifdef WIN95VERSION ! itemhit = threewaydialog (prompt, "\x08" "&Replace", "\x0a" "&Duplicate", "\x07" "&Cancel"); ! #endif switch (itemhit) { case 1: ! /*caller should delete all files with their tmpbit set*/ return (true); case 2: ! opcleartmpbits (); ! ! /*caller should rename items where conflicts occur*/ return (true); --- 258,308 ---- } ! getsystemtablescript (idreplacedialogexpertmode, bs); // "user.prefs.flReplaceDialogExpertMode" ! ! disablelangerror (); + fl = langrunstring (bs, bs); + + enablelangerror (); + + if (fl) + stringisboolean (bs, &flExpertMode); + + if (flExpertMode) { + copystring (duplicatebuttontext, nobutton); + copystring (replacebuttontext, yesbutton); + } + else { + copystring (duplicatebuttontext, yesbutton); + copystring (replacebuttontext, nobutton); + } + + itemhit = threewaydialog (prompt, yesbutton, nobutton, cancelbuttontext); + + if (flExpertMode) + switch (itemhit) { + + case 1: + itemhit = 2; + + break; + + case 2: + itemhit = 1; + break; + + } + switch (itemhit) { case 1: ! opcleartmpbits (); ! ! /*caller should rename items where conflicts occur*/ return (true); case 2: ! /*caller should delete all files with their tmpbit set*/ return (true); *************** *** 278,282 **** return (false); ! } } /*browsercollisiondialog*/ --- 312,317 ---- return (false); ! } /* switch */ ! } /*browsercollisiondialog*/ |