summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authordas <das>2007-10-26 07:56:00 (GMT)
committerdas <das>2007-10-26 07:56:00 (GMT)
commita220ddc7b2805c63cd68bddcdba097b7f37c3372 (patch)
tree117b3bf0532b3905f95465da1304c4fdeb3c2e2c /macosx
parent2cd3d962db7f314e1251de41c7b4c100e64768d5 (diff)
downloadtk-a220ddc7b2805c63cd68bddcdba097b7f37c3372.zip
tk-a220ddc7b2805c63cd68bddcdba097b7f37c3372.tar.gz
tk-a220ddc7b2805c63cd68bddcdba097b7f37c3372.tar.bz2
* macosx/tkMacOSXDialog.c: TIP#242 cleanup.
* library/demos/filebox.tcl: demo TIP#242 -typevariable.
Diffstat (limited to 'macosx')
-rw-r--r--macosx/tkMacOSXDialog.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/macosx/tkMacOSXDialog.c b/macosx/tkMacOSXDialog.c
index a8767c3..552650d 100644
--- a/macosx/tkMacOSXDialog.c
+++ b/macosx/tkMacOSXDialog.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.31 2007/10/25 21:44:22 hobbs Exp $
+ * RCS: @(#) $Id: tkMacOSXDialog.c,v 1.32 2007/10/26 07:56:00 das Exp $
*/
#include "tkMacOSXPrivate.h"
@@ -364,10 +364,10 @@ Tk_GetOpenFileObjCmd(
title, message, initialtype, multiple, OPEN_FILE, parent);
if (typeVariablePtr) {
+ FileFilter *filterPtr = ofd.fl.filters;
int i = ofd.curType;
- FileFilter *filterPtr;
- for (filterPtr = ofd.fl.filters;
- filterPtr && i > 0; i--) {
+
+ while (filterPtr && i-- > 0) {
filterPtr = filterPtr->next;
}
Tcl_SetVar(interp, Tcl_GetString(typeVariablePtr), filterPtr->name, 0);
@@ -1015,34 +1015,33 @@ OpenEventProc(
{
NavHandlerUserData *data = (NavHandlerUserData*) callBackUD;
OpenFileData *ofd = data->ofdPtr;
+
switch (callBackSelector) {
case kNavCBStart:
- if (ofd && ofd->initialType >= 0) {
- /* Select initial filter */
- int i = ofd->initialType;
- FileFilter *filterPtr;
-
- for (filterPtr = ofd->fl.filters;
- filterPtr && i > 0; i--) {
- filterPtr = filterPtr->next;
- }
- if (filterPtr) {
- NavMenuItemSpec selectItem;
- OSStatus err;
- selectItem.version = kNavMenuItemSpecVersion;
- selectItem.menuCreator = 0;
- selectItem.menuType = ofd->initialType;
- selectItem.menuItemName[0] = strlen(filterPtr->name);
- strncpy(&selectItem.menuItemName[1], filterPtr->name, 255);
- err = NavCustomControl(callBackParams->context, kNavCtlSelectCustomType, &selectItem);
- if (err != noErr) {
- fprintf(stderr,"NavCustomControl kNavCtlSelectCustomType Failed, %d\n", (int)err );
- }
- }
- }
- break;
+ if (ofd && ofd->initialType >= 0) {
+ /* Select initial filter */
+ FileFilter *filterPtr = ofd->fl.filters;
+ int i = ofd->initialType;
+
+ while (filterPtr && i-- > 0) {
+ filterPtr = filterPtr->next;
+ }
+ if (filterPtr) {
+ NavMenuItemSpec selectItem;
+
+ selectItem.version = kNavMenuItemSpecVersion;
+ selectItem.menuCreator = 0;
+ selectItem.menuType = ofd->initialType;
+ selectItem.menuItemName[0] = strlen(filterPtr->name);
+ strncpy((char*) &selectItem.menuItemName[1],
+ filterPtr->name, 255);
+ ChkErr(NavCustomControl, callBackParams->context,
+ kNavCtlSelectCustomType, &selectItem);
+ }
+ }
+ break;
case kNavCBPopupMenuSelect:
- data->ofdPtr->curType = ((NavMenuItemSpec *)
+ ofd->curType = ((NavMenuItemSpec *)
callBackParams->eventData.eventDataParms.param)->menuType;
break;
case kNavCBAccept: