Commit 6db28755193d6936021a9c9113e15ba98f0e8ac6
1 parent
1f5317a5
Exists in
master
and in
4 other branches
Starting refactory of keypads.
Showing
2 changed files
with
143 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,45 @@ | @@ -0,0 +1,45 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
2 | +<CodeBlocks_project_file> | ||
3 | + <FileVersion major="1" minor="6" /> | ||
4 | + <Project> | ||
5 | + <Option title="PW3270 Keypad module" /> | ||
6 | + <Option pch_mode="2" /> | ||
7 | + <Option compiler="gcc" /> | ||
8 | + <Build> | ||
9 | + <Target title="Debug"> | ||
10 | + <Option output=".bin/Debug/PW3270 Keypad module" prefix_auto="1" extension_auto="1" /> | ||
11 | + <Option object_output=".obj/Debug/" /> | ||
12 | + <Option type="1" /> | ||
13 | + <Option compiler="gcc" /> | ||
14 | + <Compiler> | ||
15 | + <Add option="-g" /> | ||
16 | + <Add option="-DDEBUG=1" /> | ||
17 | + </Compiler> | ||
18 | + </Target> | ||
19 | + <Target title="Release"> | ||
20 | + <Option output=".bin/Release/PW3270 Keypad module" prefix_auto="1" extension_auto="1" /> | ||
21 | + <Option object_output=".obj/Release/" /> | ||
22 | + <Option type="1" /> | ||
23 | + <Option compiler="gcc" /> | ||
24 | + <Compiler> | ||
25 | + <Add option="-O2" /> | ||
26 | + <Add option="-DNDEBUG=1" /> | ||
27 | + </Compiler> | ||
28 | + <Linker> | ||
29 | + <Add option="-s" /> | ||
30 | + </Linker> | ||
31 | + </Target> | ||
32 | + </Build> | ||
33 | + <Compiler> | ||
34 | + <Add option="-Wall" /> | ||
35 | + <Add option="`pkg-config --cflags libv3270 gtk+-3.0`" /> | ||
36 | + </Compiler> | ||
37 | + <Linker> | ||
38 | + <Add option="`pkg-config --libs libv3270 gtk+-3.0`" /> | ||
39 | + </Linker> | ||
40 | + <Unit filename="testprogram/testprogram.c"> | ||
41 | + <Option compilerVar="CC" /> | ||
42 | + </Unit> | ||
43 | + <Extensions /> | ||
44 | + </Project> | ||
45 | +</CodeBlocks_project_file> |
@@ -0,0 +1,98 @@ | @@ -0,0 +1,98 @@ | ||
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. Registro no INPI sob | ||
5 | + * o nome G3270. | ||
6 | + * | ||
7 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | ||
8 | + * | ||
9 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | ||
10 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | ||
11 | + * Free Software Foundation. | ||
12 | + * | ||
13 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | ||
14 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | ||
15 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | ||
16 | + * obter mais detalhes. | ||
17 | + * | ||
18 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | ||
19 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | ||
20 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | ||
21 | + * | ||
22 | + * Este programa está nomeado como testprogram.c e possui - linhas de código. | ||
23 | + * | ||
24 | + * Contatos: | ||
25 | + * | ||
26 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | ||
27 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | ||
28 | + * | ||
29 | + */ | ||
30 | + | ||
31 | + /** | ||
32 | + * @brief PW3270 Keypad module test program. | ||
33 | + * | ||
34 | + */ | ||
35 | + | ||
36 | + #include <lib3270/properties.h> | ||
37 | + #include <v3270.h> | ||
38 | + #include <v3270/trace.h> | ||
39 | + | ||
40 | + /*---[ Implement ]----------------------------------------------------------------------------------*/ | ||
41 | + | ||
42 | + static void activate(GtkApplication* app, G_GNUC_UNUSED gpointer user_data) { | ||
43 | + | ||
44 | + GtkWidget * window = gtk_application_window_new(app); | ||
45 | + GtkWidget * terminal = v3270_new(); | ||
46 | + GtkWidget * vBox = gtk_box_new(GTK_ORIENTATION_VERTICAL,2); | ||
47 | + GtkWidget * notebook = gtk_notebook_new(); | ||
48 | + | ||
49 | + // Hack to speed up the tests. | ||
50 | + lib3270_disable_crl_download(v3270_get_session(terminal)); | ||
51 | + | ||
52 | + gtk_box_pack_start(GTK_BOX(vBox),notebook,TRUE,TRUE,0); | ||
53 | + | ||
54 | + // Create Terminal window | ||
55 | + { | ||
56 | + gtk_widget_set_can_default(terminal,TRUE); | ||
57 | + | ||
58 | +#if GTK_CHECK_VERSION(3,20,0) | ||
59 | + gtk_widget_set_focus_on_click(terminal,TRUE); | ||
60 | +#endif // GTK 3,20,0 | ||
61 | + | ||
62 | + gtk_notebook_append_page(GTK_NOTEBOOK(notebook),terminal,gtk_label_new("Terminal")); | ||
63 | + | ||
64 | + } | ||
65 | + | ||
66 | + // Create trace window | ||
67 | + v3270_set_trace(terminal,TRUE); | ||
68 | + | ||
69 | + // Setup and show main window | ||
70 | + gtk_window_set_title(GTK_WINDOW(window),"PW3270 Keypad test"); | ||
71 | + gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER); | ||
72 | + gtk_window_set_default_size (GTK_WINDOW (window), 800, 500); | ||
73 | + gtk_container_add(GTK_CONTAINER(window),vBox); | ||
74 | + gtk_widget_show_all(window); | ||
75 | + | ||
76 | + gtk_widget_grab_focus(terminal); | ||
77 | + | ||
78 | +} | ||
79 | + | ||
80 | +int main (int argc, char **argv) { | ||
81 | + | ||
82 | + GtkApplication *app; | ||
83 | + int status; | ||
84 | + | ||
85 | + app = gtk_application_new ("br.com.bb.pw3270.keypad",G_APPLICATION_FLAGS_NONE); | ||
86 | + | ||
87 | + g_signal_connect (app, "activate", G_CALLBACK(activate), NULL); | ||
88 | + | ||
89 | + status = g_application_run (G_APPLICATION (app), argc, argv); | ||
90 | + g_object_unref (app); | ||
91 | + | ||
92 | + g_message("rc=%d",status); | ||
93 | + | ||
94 | + return 0; | ||
95 | + | ||
96 | +} | ||
97 | + | ||
98 | + |