5 Original GPL release version 4.12
6 Copyright 1993-2000 Jonathan Potter
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 All users of Directory Opus 4 (including versions distributed
23 under the GPL) are entitled to upgrade to the latest version of
24 Directory Opus version 5 at a reduced price. Please see
25 http://www.gpsoft.com.au for more information.
27 The release of Directory Opus 4 under the GPL in NO WAY affects
28 the existing commercial status of Directory Opus 5.
41 struct RequesterBase rename_req
={
44 0,0,0,0,NULL
,NULL
,NULL
,NULL
,
48 static char oldname_buffer
[FILEBUF_SIZE
],newname_buffer
[FILEBUF_SIZE
];
51 rename_oldname_gadget
[]={
52 {RO_Type
,OBJECT_GADGET
},
53 {RO_GadgetType
,GADGET_STRING
},
54 {RO_GadgetID
,RENAME_OLDNAME
},
60 {RO_TextNum
,STR_RENAME
},
61 {RO_TextPos
,TEXTPOS_ABOVE
},
62 {RO_StringBuf
,(IPTR
)oldname_buffer
},
63 {RO_StringLen
,FILEBUF_SIZE
+1},
64 {RO_StringUndo
,(IPTR
)str_undobuffer
},
66 rename_newname_gadget
[]={
67 {RO_Type
,OBJECT_GADGET
},
68 {RO_GadgetType
,GADGET_STRING
},
69 {RO_GadgetID
,RENAME_NEWNAME
},
76 {RO_TextPos
,TEXTPOS_ABOVE
},
77 {RO_StringBuf
,(IPTR
)newname_buffer
},
78 {RO_StringLen
,FILEBUF_SIZE
+1},
79 {RO_StringUndo
,(IPTR
)str_undobuffer
},
81 rename_okay_gadget
[]={
82 {RO_Type
,OBJECT_GADGET
},
83 {RO_GadgetType
,GADGET_BOOLEAN
},
84 {RO_GadgetID
,RENAME_OKAY
},
90 {RO_TextNum
,STR_OKAY
},
91 {RO_TextPos
,TEXTPOS_CENTER
},
94 rename_skip_gadget
[]={
95 {RO_Type
,OBJECT_GADGET
},
96 {RO_GadgetType
,GADGET_BOOLEAN
},
97 {RO_GadgetID
,RENAME_SKIP
},
105 {RO_TextNum
,STR_SKIP
},
106 {RO_TextPos
,TEXTPOS_CENTER
},
107 {RO_HighRecess
,TRUE
},
109 rename_cancel_gadget
[]={
110 {RO_Type
,OBJECT_GADGET
},
111 {RO_GadgetType
,GADGET_BOOLEAN
},
112 {RO_GadgetID
,RENAME_CANCEL
},
120 {RO_TextNum
,STR_CANCEL
},
121 {RO_TextPos
,TEXTPOS_CENTER
},
122 {RO_HighRecess
,TRUE
},
126 rename_oldname_gadget
,
127 rename_newname_gadget
,
130 rename_cancel_gadget
,
133 int getrenamedata(src
,dst
)
137 UWORD code
,gadgetid
,qual
;
138 struct Window
*rwindow
;
139 struct Gadget
*gadlist
;
141 fix_requester(&rename_req
,globstring
[STR_ENTER_NEW_NAME
]);
143 strcpy(oldname_buffer
,src
); strcpy(newname_buffer
,dst
);
145 if (!(rwindow
=OpenRequester(&rename_req
)) ||
146 !(gadlist
=addreqgadgets(&rename_req
,rename_gadgets
,0,NULL
))) {
147 CloseRequester(&rename_req
);
150 RefreshRequesterObject(&rename_req
,NULL
);
153 ActivateStrGad(gadlist
->NextGadget
,rwindow
);
156 while (IMsg
=(struct IntuiMessage
*)GetMsg(rwindow
->UserPort
)) {
157 class=IMsg
->Class
; code
=IMsg
->Code
; qual
=IMsg
->Qualifier
;
158 if (class==IDCMP_GADGETUP
)
159 gadgetid
=((struct Gadget
*) IMsg
->IAddress
)->GadgetID
;
160 ReplyMsg((struct Message
*) IMsg
);
163 case IDCMP_MOUSEBUTTONS
:
164 gadgetid
=RENAME_OLDNAME
;
169 ActivateStrGad(gadlist
->NextGadget
,rwindow
);
172 if (qual
&IEQUALIFIER_ANYSHIFT
) {
173 ActivateStrGad(gadlist
,rwindow
);
176 else if (code
==0x9) break;
177 gadgetid
=RENAME_OKAY
;
180 strcpy(src
,oldname_buffer
);
181 strcpy(dst
,newname_buffer
);
184 CloseRequester(&rename_req
);
185 return((int)gadgetid
);
190 Wait(1<<rwindow
->UserPort
->mp_SigBit
);