/[winpt]/trunk/Src/wptClipEditDlg.cpp
ViewVC logotype

Diff of /trunk/Src/wptClipEditDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 88 by twoaday, Mon Nov 21 12:06:59 2005 UTC revision 121 by twoaday, Mon Dec 12 11:19:56 2005 UTC
# Line 17  Line 17 
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
# Line 33  Line 32 
32  #include "wptNLS.h"  #include "wptNLS.h"
33  #include "resource.h"  #include "resource.h"
34    
35    #ifdef _MSC_VER
36    #include "winpt_header.h"
37    
38    static DWORD help_arr[] = {
39        IDC_CLIPEDIT_SEND,  WPT_CLIPEDIT_COPY,
40        IDC_CLIPEDIT_CLEAR, WPT_CLIPEDIT_CLEAR,
41        IDC_CLIPEDIT_LOAD,  WPT_CLIPEDIT_LOAD,
42        IDC_CLIPEDIT_SAVE,  WPT_CLIPEDIT_SAVE,
43        IDC_CLIPEDIT_QUOTE, WPT_CLIPEDIT_QUOTE,
44        0, 0};
45    #endif
46    
47  /* Load the clipboard contents into the text field in @dlg.  /* Load the clipboard contents into the text field in @dlg.
48     Return value: 0 on success. */     Return value: 0 on success. */
# Line 98  load_clipboard_from_file (HWND dlg) Line 108  load_clipboard_from_file (HWND dlg)
108      if (GetOpenFileName (&open)) {      if (GetOpenFileName (&open)) {
109          if( (size=get_file_size (file)) > MAX_CLIPTEXT_SIZE) {                if( (size=get_file_size (file)) > MAX_CLIPTEXT_SIZE) {      
110              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"
111                                   "Still proceed?"), _("Clipboard"), MB_INFO|MB_YESNO);                                         "Still proceed?"), _("Clipboard"),
112              if (id == IDNO)                                MB_INFO|MB_YESNO);
113                if (id == IDNO)
114                  return -1;                  return -1;
115          }          }
116          fp = fopen (file, "rb");          fp = fopen (file, "rb");
117          if (!fp) {          if (!fp) {
118              msg_box (dlg, winpt_strerror (WPTERR_FILE_OPEN), _("Clipboard"), MB_ERR);              msg_box (dlg, winpt_strerror (WPTERR_FILE_OPEN),
119                         _("Clipboard"), MB_ERR);
120              return FALSE;              return FALSE;
121          }          }
122          p = new char[size+1];          p = new char[size+1];
# Line 151  save_clipboard_to_file (HWND dlg) Line 163  save_clipboard_to_file (HWND dlg)
163          }          }
164          fp = fopen (file, "wb");          fp = fopen (file, "wb");
165          if (!fp) {          if (!fp) {
166              msg_box (dlg, winpt_strerror (WPTERR_FILE_CREAT), _("Clipboard"), MB_ERR);              msg_box (dlg, winpt_strerror (WPTERR_FILE_CREAT),
167                         _("Clipboard"), MB_ERR);
168              return FALSE;              return FALSE;
169          }          }
170          /* XXX: there is a NUL-byte at the end. */          /* XXX: there is a NUL-byte at the end. */
171          nbytes = SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2, WM_GETTEXTLENGTH, 0, 0);          nbytes = SendDlgItemMessage (dlg, IDC_CLIPEDIT_CLIPTEXT2,
172                                         WM_GETTEXTLENGTH, 0, 0);
173          if (nbytes > 0) {          if (nbytes > 0) {
174              p = new char[nbytes+1];              p = new char[nbytes+1];
175              if (!p)              if (!p)
176                  BUG (NULL);                  BUG (NULL);
177              GetDlgItemText (dlg, IDC_CLIPEDIT_CLIPTEXT2, p, nbytes);              GetDlgItemText (dlg, IDC_CLIPEDIT_CLIPTEXT2, p, nbytes);
178              fwrite (p, 1, nbytes, fp);              fwrite (p, 1, nbytes, fp);
179                
180          }                    }          
181          fclose (fp);          fclose (fp);
182          free_if_alloc (p);          free_if_alloc (p);
# Line 174  save_clipboard_to_file (HWND dlg) Line 189  save_clipboard_to_file (HWND dlg)
189  BOOL CALLBACK  BOOL CALLBACK
190  clip_edit_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)  clip_edit_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
191  {  {
192        static DWORD cookie = 0;
193    
194      switch (msg)  {      switch (msg)  {
195      case WM_INITDIALOG:      case WM_INITDIALOG:
196          SetWindowText (dlg, _("Clipboard Editor"));          SetWindowText (dlg, _("Clipboard Editor"));
# Line 181  clip_edit_dlg_proc (HWND dlg, UINT msg, Line 198  clip_edit_dlg_proc (HWND dlg, UINT msg,
198          SetDlgItemText (dlg, IDC_CLIPEDIT_CLEAR, _("Clea&r"));          SetDlgItemText (dlg, IDC_CLIPEDIT_CLEAR, _("Clea&r"));
199          SetDlgItemText (dlg, IDC_CLIPEDIT_LOAD, _("&Load"));              SetDlgItemText (dlg, IDC_CLIPEDIT_LOAD, _("&Load"));    
200          SetDlgItemText (dlg, IDC_CLIPEDIT_SAVE, _("&Save"));          SetDlgItemText (dlg, IDC_CLIPEDIT_SAVE, _("&Save"));
201          SetDlgItemText (dlg, IDC_CLIPEDIT_QUOTE, _("Add quotes"));          SetDlgItemText (dlg, IDC_CLIPEDIT_QUOTE, _("Add quotes"));
202                    SetDlgItemText (dlg, IDOK, _("&Close"));
203    
204            html_help_init (&cookie);
205          load_clipboard (dlg);          load_clipboard (dlg);
206          center_window (dlg, NULL);          center_window (dlg, NULL);
207          SetForegroundWindow (dlg);          SetForegroundWindow (dlg);
208          return TRUE;          return TRUE;
209                    
210        case WM_DESTROY:
211            html_help_deinit ();
212            break;
213    
214        case WM_HELP:
215            html_help_dispatch (lparam, "winpt.chm::winpt_texts.txt", help_arr);
216            break;
217    
218      case WM_SYSCOMMAND:      case WM_SYSCOMMAND:
219          if (LOWORD (wparam) == SC_CLOSE)          if (LOWORD (wparam) == SC_CLOSE)
220              EndDialog (dlg, TRUE);              EndDialog (dlg, TRUE);
# Line 242  clip_edit_dlg_proc (HWND dlg, UINT msg, Line 269  clip_edit_dlg_proc (HWND dlg, UINT msg,
269            
270      return FALSE;      return FALSE;
271  }  }
   

Legend:
Removed from v.88  
changed lines
  Added in v.121

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26