17 |
* along with WinPT; if not, write to the Free Software Foundation, |
* along with WinPT; if not, write to the Free Software Foundation, |
18 |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
19 |
*/ |
*/ |
|
|
|
20 |
#ifdef HAVE_CONFIG_H |
#ifdef HAVE_CONFIG_H |
21 |
#include <config.h> |
#include <config.h> |
22 |
#endif |
#endif |
97 |
if (GetOpenFileName (&open)) { |
if (GetOpenFileName (&open)) { |
98 |
if( (size=get_file_size (file)) > MAX_CLIPTEXT_SIZE) { |
if( (size=get_file_size (file)) > MAX_CLIPTEXT_SIZE) { |
99 |
id = msg_box (dlg, _("The file you want to add is very large.\n" |
id = msg_box (dlg, _("The file you want to add is very large.\n" |
100 |
"Still proceed?"), _("Clipboard"), MB_INFO|MB_YESNO); |
"Still proceed?"), _("Clipboard"), |
101 |
if (id == IDNO) |
MB_INFO|MB_YESNO); |
102 |
|
if (id == IDNO) |
103 |
return -1; |
return -1; |
104 |
} |
} |
105 |
fp = fopen (file, "rb"); |
fp = fopen (file, "rb"); |
106 |
if (!fp) { |
if (!fp) { |
107 |
msg_box (dlg, winpt_strerror (WPTERR_FILE_OPEN), _("Clipboard"), MB_ERR); |
msg_box (dlg, winpt_strerror (WPTERR_FILE_OPEN), |
108 |
|
_("Clipboard"), MB_ERR); |
109 |
return FALSE; |
return FALSE; |
110 |
} |
} |
111 |
p = new char[size+1]; |
p = new char[size+1]; |
152 |
} |
} |
153 |
fp = fopen (file, "wb"); |
fp = fopen (file, "wb"); |
154 |
if (!fp) { |
if (!fp) { |
155 |
msg_box (dlg, winpt_strerror (WPTERR_FILE_CREAT), _("Clipboard"), MB_ERR); |
msg_box (dlg, winpt_strerror (WPTERR_FILE_CREAT), |
156 |
|
_("Clipboard"), MB_ERR); |
157 |
return FALSE; |
return FALSE; |
158 |
} |
} |
159 |
/* XXX: there is a NUL-byte at the end. */ |
/* XXX: there is a NUL-byte at the end. */ |
160 |
nbytes = SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, WM_GETTEXTLENGTH, 0, 0); |
nbytes = SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, |
161 |
|
WM_GETTEXTLENGTH, 0, 0); |
162 |
if (nbytes > 0) { |
if (nbytes > 0) { |
163 |
p = new char[nbytes+1]; |
p = new char[nbytes+1]; |
164 |
if (!p) |
if (!p) |
165 |
BUG (NULL); |
BUG (NULL); |
166 |
GetDlgItemText (dlg, IDC_CLIPEDIT_CLIPTEXT2, p, nbytes); |
GetDlgItemText (dlg, IDC_CLIPEDIT_CLIPTEXT2, p, nbytes); |
167 |
fwrite (p, 1, nbytes, fp); |
fwrite (p, 1, nbytes, fp); |
168 |
|
|
169 |
} |
} |
170 |
fclose (fp); |
fclose (fp); |
171 |
free_if_alloc (p); |
free_if_alloc (p); |
185 |
SetDlgItemText (dlg, IDC_CLIPEDIT_CLEAR, _("Clea&r")); |
SetDlgItemText (dlg, IDC_CLIPEDIT_CLEAR, _("Clea&r")); |
186 |
SetDlgItemText (dlg, IDC_CLIPEDIT_LOAD, _("&Load")); |
SetDlgItemText (dlg, IDC_CLIPEDIT_LOAD, _("&Load")); |
187 |
SetDlgItemText (dlg, IDC_CLIPEDIT_SAVE, _("&Save")); |
SetDlgItemText (dlg, IDC_CLIPEDIT_SAVE, _("&Save")); |
188 |
SetDlgItemText (dlg, IDC_CLIPEDIT_QUOTE, _("Add quotes")); |
SetDlgItemText (dlg, IDC_CLIPEDIT_QUOTE, _("Add quotes")); |
189 |
|
SetDlgItemText (dlg, IDOK, _("&Exit")); |
190 |
|
|
191 |
load_clipboard (dlg); |
load_clipboard (dlg); |
192 |
center_window (dlg, NULL); |
center_window (dlg, NULL); |
193 |
SetForegroundWindow (dlg); |
SetForegroundWindow (dlg); |
247 |
|
|
248 |
return FALSE; |
return FALSE; |
249 |
} |
} |
|
|
|