Commit 83b7128dc208dce39a22e949c83a61341a7596c3
1 parent
2960cfb3
Exists in
master
and in
5 other branches
Experimentando diálogo de seleção de arquivos padrão do windows.
Showing
3 changed files
with
219 additions
and
1 deletions
Show diff stats
configure.ac
@@ -149,6 +149,7 @@ case "$host" in | @@ -149,6 +149,7 @@ case "$host" in | ||
149 | PLUGINS="hllapi" | 149 | PLUGINS="hllapi" |
150 | APP_GUI_SRC="resources.rc" | 150 | APP_GUI_SRC="resources.rc" |
151 | DLLPREFIX="" | 151 | DLLPREFIX="" |
152 | + LIBS="$LIBS -lcomdlg32" | ||
152 | 153 | ||
153 | AC_CONFIG_FILES(nsi/header-$host_cpu-no-gtk.nsi) | 154 | AC_CONFIG_FILES(nsi/header-$host_cpu-no-gtk.nsi) |
154 | AC_CONFIG_FILES(nsi/header-$host_cpu.nsi) | 155 | AC_CONFIG_FILES(nsi/header-$host_cpu.nsi) |
@@ -792,7 +793,7 @@ if test "_$OFFICE_HOME" == "_" ; then | @@ -792,7 +793,7 @@ if test "_$OFFICE_HOME" == "_" ; then | ||
792 | fi | 793 | fi |
793 | 794 | ||
794 | # Find types.rdb | 795 | # Find types.rdb |
795 | -AC_CHECK_FILE($OO_SDK_URE_HOME/share/misc/types.rdb,OO_TYPES=$OO_SDK_URE_HOME/share/misc/types.rdb,app_cv_office="no") | 796 | +OO_TYPES=$OO_SDK_URE_HOME/share/misc/types.rdb |
796 | 797 | ||
797 | # Set targets | 798 | # Set targets |
798 | if test "$app_cv_office" == "yes" ; then | 799 | if test "$app_cv_office" == "yes" ; then |
@@ -0,0 +1,125 @@ | @@ -0,0 +1,125 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como browse.c e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | + #include "private.h" | ||
31 | + | ||
32 | +#ifdef WIN32 | ||
33 | + #include <gdk/gdkwin32.h> | ||
34 | +#endif // WIN32 | ||
35 | + | ||
36 | +/*---[ Implement ]----------------------------------------------------------------------------------*/ | ||
37 | + | ||
38 | +#ifdef WIN32 | ||
39 | +void browse_file(GtkButton *button,v3270FTD *parent) | ||
40 | +{ | ||
41 | + char szFile[260]; // buffer for file name | ||
42 | + GdkWindow * win = gtk_widget_get_window(GTK_WIDGET(parent)); | ||
43 | + | ||
44 | + gtk_widget_set_sensitive(GTK_WIDGET(parent),FALSE); | ||
45 | + | ||
46 | + OPENFILENAME ofn; | ||
47 | + | ||
48 | + memset(&ofn,0,sizeof(ofn)); | ||
49 | + ofn.lStructSize = sizeof(ofn); | ||
50 | + ofn.hwndOwner = GDK_WINDOW_HWND(win); | ||
51 | + ofn.lpstrFile = szFile; | ||
52 | + | ||
53 | + // Set lpstrFile[0] to '\0' so that GetOpenFileName does not | ||
54 | + // use the contents of szFile to initialize itself. | ||
55 | + ofn.lpstrFile[0] = '\0'; | ||
56 | + | ||
57 | + ofn.nMaxFile = sizeof(szFile); | ||
58 | + ofn.lpstrFilter = "All\0*.*\0Text\0*.TXT\0"; | ||
59 | + ofn.nFilterIndex = 1; | ||
60 | + ofn.nMaxFileTitle = 0; | ||
61 | + ofn.lpstrInitialDir = NULL; | ||
62 | + | ||
63 | + if(parent->options & LIB3270_FT_OPTION_RECEIVE) | ||
64 | + { | ||
65 | + // Receber arquivo | ||
66 | + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839(v=vs.85).aspx | ||
67 | + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646829(v=vs.85).aspx#open_file | ||
68 | + | ||
69 | +// ofn.lpstrFileTitle = _( "Select file to receive" ); | ||
70 | + ofn.Flags = OFN_OVERWRITEPROMPT; | ||
71 | + | ||
72 | + if(GetSaveFileName(&ofn)==TRUE) | ||
73 | + { | ||
74 | + gtk_entry_set_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL]),szFile); | ||
75 | + } | ||
76 | + | ||
77 | + } | ||
78 | + else | ||
79 | + { | ||
80 | + // Enviar arquivo | ||
81 | + // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646928(v=vs.85).aspx | ||
82 | + OPENFILENAME ofn; | ||
83 | + | ||
84 | +// ofn.lpstrFileTitle = _( "Select file to send" ); | ||
85 | + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; | ||
86 | + | ||
87 | + if(GetOpenFileName(&ofn)==TRUE) | ||
88 | + { | ||
89 | + gtk_entry_set_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL]),szFile); | ||
90 | + } | ||
91 | + } | ||
92 | + | ||
93 | + gtk_widget_set_sensitive(GTK_WIDGET(parent),TRUE); | ||
94 | + | ||
95 | +} | ||
96 | +#else | ||
97 | +void browse_file(GtkButton *button,v3270FTD *parent) | ||
98 | +{ | ||
99 | + gboolean recv = (parent->options & LIB3270_FT_OPTION_RECEIVE); | ||
100 | + GtkWidget * dialog = gtk_file_chooser_dialog_new | ||
101 | + ( | ||
102 | + recv ? _( "Select file to receive" ) : _( "Select file to send" ), | ||
103 | + GTK_WINDOW(parent), | ||
104 | + GTK_FILE_CHOOSER_ACTION_OPEN, | ||
105 | + _("_Cancel" ), GTK_RESPONSE_CANCEL, | ||
106 | + recv ? _("_Save") : _("_Send"), GTK_RESPONSE_ACCEPT, | ||
107 | + NULL | ||
108 | + ); | ||
109 | + | ||
110 | + const gchar * current = gtk_entry_get_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL])); | ||
111 | + if(current && *current) | ||
112 | + gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),current); | ||
113 | + | ||
114 | + if(gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) | ||
115 | + { | ||
116 | + gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); | ||
117 | + gtk_entry_set_text(GTK_ENTRY(parent->filename[FILENAME_LOCAL]),filename); | ||
118 | + g_free(filename); | ||
119 | + } | ||
120 | + | ||
121 | + gtk_widget_destroy(dialog); | ||
122 | + | ||
123 | + | ||
124 | +} | ||
125 | +#endif // WIN32 |
@@ -0,0 +1,92 @@ | @@ -0,0 +1,92 @@ | ||
1 | +/* | ||
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | ||
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | ||
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | ||
5 | + * | ||
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
7 | + * | ||
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
10 | + * Free Software Foundation. | ||
11 | + * | ||
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
15 | + * obter mais detalhes. | ||
16 | + * | ||
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
20 | + * | ||
21 | + * Este programa está nomeado como private.h e possui - linhas de código. | ||
22 | + * | ||
23 | + * Contatos: | ||
24 | + * | ||
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
27 | + * | ||
28 | + */ | ||
29 | + | ||
30 | +#ifndef PRIVATE_H_INCLUDED | ||
31 | + | ||
32 | + #define PRIVATE_H_INCLUDED | ||
33 | + | ||
34 | + #include "v3270ft.h" | ||
35 | + | ||
36 | +/*--[ Widget definition ]----------------------------------------------------------------------------*/ | ||
37 | + | ||
38 | + enum _filename | ||
39 | + { | ||
40 | + FILENAME_LOCAL, | ||
41 | + FILENAME_HOST, | ||
42 | + | ||
43 | + FILENAME_COUNT | ||
44 | + }; | ||
45 | + | ||
46 | + enum _value | ||
47 | + { | ||
48 | + VALUE_LRECL, | ||
49 | + VALUE_BLKSIZE, | ||
50 | + VALUE_PRIMSPACE, | ||
51 | + VALUE_SECSPACE, | ||
52 | + VALUE_DFT, | ||
53 | + | ||
54 | + VALUE_COUNT | ||
55 | + }; | ||
56 | + | ||
57 | + enum _button | ||
58 | + { | ||
59 | + BUTTON_ASCII, | ||
60 | + BUTTON_CRLF, | ||
61 | + BUTTON_APPEND, | ||
62 | + BUTTON_REMAP, | ||
63 | + | ||
64 | + BUTTON_COUNT | ||
65 | + }; | ||
66 | + | ||
67 | + struct _v3270FTD | ||
68 | + { | ||
69 | + GtkDialog parent; | ||
70 | + GtkWidget * filename[FILENAME_COUNT]; /**< Filenames for the transfer */ | ||
71 | + GtkWidget * units; /**< Units frame box */ | ||
72 | + GtkWidget * ready; /**< Send/Save button */ | ||
73 | + GtkToggleButton * button[BUTTON_COUNT]; /**< Buttons */ | ||
74 | + GtkToggleButton * recfm[4]; /**< Record format buttons */ | ||
75 | + GtkToggleButton * btnUnits[4]; /**< Unit buttons */ | ||
76 | + GtkSpinButton * value[VALUE_COUNT]; | ||
77 | + gboolean local; /**< TRUE if local filename is ok */ | ||
78 | + gboolean remote; /**< TRUE if remote filename is ok */ | ||
79 | + LIB3270_FT_OPTION options; | ||
80 | + }; | ||
81 | + | ||
82 | + struct _v3270FTDClass | ||
83 | + { | ||
84 | + GtkDialogClass parent_class; | ||
85 | + | ||
86 | + int dummy; | ||
87 | + }; | ||
88 | + | ||
89 | + G_GNUC_INTERNAL void browse_file(GtkButton *button,v3270FTD *parent); | ||
90 | + | ||
91 | + | ||
92 | +#endif // PRIVATE_H_INCLUDED |