1 /*
2 * TTTTTTTTTTTTTT EEEEEEEEEEEEEE OOOOOOOOOOOOOO
3 * TTTTTTTTTTTTTT EEEEEEEEEEEEEE OOOOOOOOOOOOOO
4 * TT EE OO OO
5 * TT EE OO OO
6 * TT EE OO OO
7 * TT EEEEEEEEEE OO OO
8 * TT EEEEEEEEEE OO OO
9 * TT EE OO OO
10 * TT EE OO OO
11 * TT EE OO OO
12 * TT EEEEEEEEEEEEEE OOOOOOOOOOOOOO
13 * TT EEEEEEEEEEEEEE OOOOOOOOOOOOOO
14 *
15 * L'�mulateur Thomson TO8
16 *
17 * Copyright (C) 1997-2017 Gilles F�tis, Eric Botcazou, Alexandre Pukall,
18 * J�r�mie Guillaume, Fran�ois Mouret
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 */
34
35 /*
36 * Module : linux/udebug/udstatus.c
37 * Version : 1.8.4
38 * Cr�� par : Fran�ois Mouret 14/07/2016
39 * Modifi� par:
40 *
41 * D�bogueur 6809 - Gestion de la barre d'�tat.
42 */
43
44 #ifndef SCAN_DEPEND
45 #include <stdio.h>
46 #include <gtk/gtk.h>
47 #endif
48
49 #include "defs.h"
50 #include "teo.h"
51 #include "linux/gui.h"
52
53 static GtkWidget *label_clock;
54 static GtkWidget *label_frame;
55 static GtkWidget *label_line;
56 static GtkWidget *label_column;
57
58 static mc6809_clock_t prev_clock = 0;
59
60
61
62 /* init:
63 * Initialize the status bar.
64 */
init(void)65 static GtkWidget *init (void)
66 {
67 GtkWidget *box;
68 GtkWidget *grid;
69
70 /* Create grid */
71 grid = gtk_grid_new ();
72 gtk_grid_set_column_spacing (GTK_GRID (grid), 20);
73
74 /* Create clock label */
75 label_clock = gtk_label_new ("");
76 gtk_grid_attach (GTK_GRID(grid), label_clock, 0, 0, 1, 1);
77
78 /* Create frame label */
79 label_frame = gtk_label_new ("");
80 gtk_grid_attach (GTK_GRID(grid), label_frame, 1, 0, 1, 1);
81
82 /* Create line label */
83 label_line = gtk_label_new ("");
84 gtk_grid_attach (GTK_GRID(grid), label_line, 2, 0, 1, 1);
85
86 /* Create line label */
87 label_column = gtk_label_new ("");
88 gtk_grid_attach (GTK_GRID(grid), label_column, 3, 0, 1, 1);
89
90 /* Pack in main box */
91 box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
92 gtk_box_pack_start (GTK_BOX (box), grid, FALSE, FALSE, 0);
93
94 return box;
95 }
96
97
98
99 /* display:
100 * Update the display of the status bar.
101 */
display(void)102 static void display (void)
103 {
104 char str[40] = "";
105 mc6809_clock_t clock = mc6809_clock();
106
107 /* display the clock */
108 str[0] = '\0';
109 sprintf (str, "%s: %lld",
110 is_fr?"Horloge":"Clock",
111 clock-prev_clock);
112 gtk_label_set_text (GTK_LABEL (label_clock), str);
113 prev_clock = clock;
114
115 /* display the frame */
116 clock %= TEO_CYCLES_PER_FRAME;
117 str[0] = '\0';
118 sprintf (str, "%s: %lld", is_fr?"Frame":"Frame", clock);
119 gtk_label_set_text (GTK_LABEL (label_frame), str);
120
121 /* display the number of the line */
122
123 str[0] = '\0';
124 sprintf (str, "%s: %lld", is_fr?"Ligne":"Line", clock/FULL_LINE_CYCLES);
125 gtk_label_set_text (GTK_LABEL (label_line), str);
126
127 /* display the number of the column */
128 str[0] = '\0';
129 sprintf (str, "%s: %lld", is_fr?"Colonne":"Column", clock%FULL_LINE_CYCLES);
130 gtk_label_set_text (GTK_LABEL (label_column), str);
131 }
132
133
134 /* ------------------------------------------------------------------------- */
135
136
137 /* udstatus_Free:
138 * Free the memory used by the status bar.
139 */
udstatus_Free(void)140 void udstatus_Free (void)
141 {
142 }
143
144
145
146 /* udstatus_Init:
147 * Initialize the status bar.
148 */
udstatus_Init(void)149 GtkWidget *udstatus_Init (void)
150 {
151 return init ();
152 }
153
154
155
156 /* udstatus_Display:
157 * Update the display of the status bar.
158 */
udstatus_Display(void)159 void udstatus_Display (void)
160 {
161 display ();
162 }
163
164