1
0
mirror of https://github.com/rricharz/Tek4010.git synced 2026-04-15 08:01:35 +00:00

version 1.2.1, see versions.txt

This commit is contained in:
¨Rene Richarz
2019-04-15 10:30:37 +02:00
parent 6c6b423e59
commit 512e2031f0
7 changed files with 57 additions and 57 deletions

17
ards.c
View File

@@ -84,21 +84,8 @@ void ards_draw(cairo_t *cr, cairo_t *cr2, int first)
if (first) {
first = 0;
int actualWidth;
if (argFull) {
efactor = windowHeight / 780.0;
actualWidth = (int)(efactor * 1024.0);
eoffx = (windowWidth - actualWidth) / 2;
refresh_interval = (int)(30.0 * efactor * efactor);
}
else {
efactor = 1.0;
actualWidth = windowWidth;
eoffx = 0;
refresh_interval = 30;
}
windowWidth = actualWidth;
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (10.0 * efactor));
refresh_interval = 30;
tube_changeCharacterSize(cr, cr2, 74, 35, 10);
}
startPaintTime = tube_mSeconds(); // start to measure time for this draw operation

36
main.c
View File

@@ -57,6 +57,8 @@ extern int argARDS;
int windowWidth;
int windowHeight;
static int windowHeightOffset = 0;
static int windowWidthOffset = 0;
extern int tube_doClearPersistent;
@@ -96,7 +98,7 @@ static void do_drawing(cairo_t *cr, GtkWidget *widget)
if (global_firstcall) {
permanent_surface = cairo_surface_create_similar(cairo_get_target(cr),
CAIRO_CONTENT_COLOR_ALPHA, windowWidth, windowHeight);
CAIRO_CONTENT_COLOR, windowWidth, windowHeight);
temporary_surface = cairo_surface_create_similar(cairo_get_target(cr),
CAIRO_CONTENT_COLOR_ALPHA, windowWidth, windowHeight);
}
@@ -113,11 +115,11 @@ static void do_drawing(cairo_t *cr, GtkWidget *widget)
tek4010_draw(permanent_cr, temporary_cr, global_firstcall);
global_firstcall = FALSE;
cairo_set_source_surface(cr, permanent_surface, 0, 0);
cairo_set_source_surface(cr, permanent_surface, windowWidthOffset, windowHeightOffset);
cairo_paint(cr);
cairo_set_source_surface(cr, temporary_surface, 0, 0);
cairo_set_source_surface(cr, temporary_surface, windowWidthOffset, windowHeightOffset);
cairo_paint(cr);
cairo_destroy(permanent_cr);
cairo_destroy(temporary_cr);
}
@@ -125,7 +127,7 @@ static void do_drawing(cairo_t *cr, GtkWidget *widget)
static void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
int ch;
printf("key pressed, state =%04X, keyval=%04X\r\n", event->state, event->keyval);
// printf("key pressed, state =%04X, keyval=%04X\r\n", event->state, event->keyval);
if ((event->keyval == 0xFF50) || // "home" key
(event->keyval == 0xFF55) || // "page up" key
@@ -140,7 +142,6 @@ static void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_da
else if ((event->keyval >= 0xFF00) && (event->keyval <= 0xFF1F))
ch = event->keyval & 0x1F;
else if (event->state & GDK_CONTROL_MASK) {
printf("control\n");
if ((event->keyval == 0xFF51) || // "<ctrl>left arrow" key
(event->keyval == 0xFF52)) { // "<ctrl>up arrow" key
tube_doClearPersistent = 1;
@@ -152,7 +153,6 @@ static void on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer user_da
return;
}
else if (event->keyval == 0x0071) { // "<ctrl>q" quits tek4010
printf("calling quit\n");
on_quit_event();
return;
}
@@ -179,6 +179,7 @@ int main (int argc, char *argv[])
int askWindowWidth;
int askWindowHeight;
double aspectRatio;
tube_init(argc, argv);
@@ -194,13 +195,21 @@ int main (int argc, char *argv[])
else {
askWindowWidth = 1024;
askWindowHeight = 780;
}
}
aspectRatio = (double)askWindowWidth/(double)askWindowHeight;
gtk_init(&argc, &argv);
global_firstcall = TRUE;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
// set the background color
GdkColor color;
color.red = 0;
color.green = 0;
color.blue = 0;
gtk_widget_modify_bg(window, GTK_STATE_NORMAL, &color);
darea = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(window), darea);
@@ -217,13 +226,22 @@ int main (int argc, char *argv[])
int screenHeight = gdk_screen_get_height(screen);
printf("Screen dimensions: %d x %d\n", screenWidth, screenHeight);
if (argFull && !argARDS) {
if (argFull) {
// DISPLAY UNDECORATED FULL SCREEN WINDOW
gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
gtk_window_fullscreen(GTK_WINDOW(window));
gtk_window_set_keep_above(GTK_WINDOW(window), FALSE);
windowWidth = screenWidth;
windowHeight = screenHeight;
// force aspect ratio
if (windowWidth > (int)((double)windowHeight * aspectRatio)) {
windowWidthOffset = (windowWidth - (int)((double)windowHeight * aspectRatio)) / 2;
windowWidth = (int)((double)windowHeight * aspectRatio);
}
if (windowHeight > (int)((double)windowWidth / aspectRatio)) {
windowHeightOffset = (windowHeight - (int)((double)windowWidth / aspectRatio)) / 2;
windowHeight = (int)((double)windowWidth / aspectRatio);
}
}
else {

BIN
tek4010

Binary file not shown.

View File

@@ -72,6 +72,7 @@ extern int leftmargin;
static long startPaintTime;
static int xh,xl,yh,yl,xy4014;
static long todo;
static double efactor;
// table for special plot point mode
// 4014 manual page F-9
@@ -158,7 +159,7 @@ void tek4010_escapeCodeHandler(cairo_t *cr, cairo_t *cr2, int ch)
// modes 27 and 29 - 31 are identical in all modes
case 28: // record separator
/*if (DEBUG)*/ printf("Special point plot mode, mode=%d\n",savemode);
if (DEBUG) printf("Special point plot mode, mode=%d\n",savemode);
mode = 50; // for the intensity/focus character
specialPlotMode = 1;
double intensity = 1.0;
@@ -245,23 +246,15 @@ void tek4010_draw(cairo_t *cr, cairo_t *cr2, int first)
if (first) {
first = 0;
int actualWidth;
if (argFull) {
efactor = windowHeight / 780.0;
actualWidth = (int)(efactor * 1024.0);
eoffx = (windowWidth - actualWidth) / 2;
refresh_interval = (int)(30.0 * efactor * efactor);
}
else {
efactor = 1.0;
actualWidth = windowWidth;
eoffx = 0;
refresh_interval = 30;
}
windowWidth = actualWidth;
refresh_interval = 30;
tube_changeCharacterSize(cr, cr2, 74, 35, (int) (18.0 * efactor));
// printf("Scaling: %0.2f\n", efactor);
// printf("Offset: %d\n",eoffx);
printf("Scaling: %0.3f\n", efactor / 4.0);
// printf("Refresh interval: %d\n",refresh_interval);
}

35
tube.c
View File

@@ -84,9 +84,6 @@ int tube_x0, tube_x2,tube_y0, tube_y2;
static int debugCount = 0;
double efactor;
int eoffx;
long refreshCount = 0; // variables for baud rate and refresh rate measurements
static long charCount = 0;
@@ -181,7 +178,7 @@ void tube_init(int argc, char* argv[])
char *argv2[20];
size_t bufsize = 127;
int firstArg = 1;
printf("tek4010 version 1.2\n");
printf("tek4010 version 1.2.1\n");
windowName = "Tektronix 4010/4014 emulator";
if ((argc<2) || (argc>19)) {
printf("Error:number of arguments\n");
@@ -394,7 +391,7 @@ void tube_doCursor(cairo_t *cr2)
{
cairo_set_source_rgb(cr2, 0, CURSOR_INTENSITY, 0);
cairo_set_line_width (cr2, 1);
cairo_rectangle(cr2, tube_x0 + eoffx, windowHeight - tube_y0 - vDotsPerChar + 8,
cairo_rectangle(cr2, tube_x0, windowHeight - tube_y0 - vDotsPerChar + 8,
hDotsPerChar - 3, vDotsPerChar - 3);
cairo_fill(cr2);
cairo_stroke (cr2);
@@ -476,19 +473,19 @@ void tube_drawCharacter(cairo_t *cr, cairo_t *cr2, char ch)
if (writeThroughMode) { // draw the write-through character
cairo_set_source_rgb(cr2, 0, WRITE_TROUGH_INTENSITY, 0);
cairo_move_to(cr2, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_move_to(cr2, tube_x0, windowHeight - tube_y0);
cairo_show_text(cr2, s);
}
else {
// draw the character
cairo_set_source_rgb(cr, 0, (NORMAL_INTENSITY * intensity) / 100, 0);
cairo_move_to(cr, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_move_to(cr, tube_x0, windowHeight - tube_y0);
cairo_show_text(cr, s);
// draw the bright spot
cairo_set_source_rgb(cr2, BRIGHT_SPOT_COLOR, BRIGHT_SPOT_COLOR, BRIGHT_SPOT_COLOR);
cairo_move_to(cr2, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_move_to(cr2, tube_x0, windowHeight - tube_y0);
cairo_show_text(cr2, s);
}
@@ -513,8 +510,8 @@ void tube_drawPoint(cairo_t *cr, cairo_t *cr2)
#define PI2 6.283185307
cairo_set_line_width (cr, 1 + defocussed);
cairo_set_source_rgb(cr, 0, (NORMAL_INTENSITY * intensity) / 100, 0);
cairo_move_to(cr, tube_x2 + eoffx, windowHeight - tube_y2);
cairo_line_to(cr, tube_x2 + 1 + eoffx, windowHeight - tube_y2);
cairo_move_to(cr, tube_x2, windowHeight - tube_y2);
cairo_line_to(cr, tube_x2 + 1, windowHeight - tube_y2);
cairo_stroke (cr);
// speed is a problem here
@@ -527,7 +524,7 @@ void tube_drawPoint(cairo_t *cr, cairo_t *cr2)
cairo_set_line_width (cr2, 0.1);
double bsc = (BRIGHT_SPOT_COLOR * intensity) / 100;
cairo_set_source_rgb(cr2, bsc, bsc, bsc);
cairo_arc(cr2, tube_x2 + eoffx, windowHeight - tube_y2, 2 + defocussed, 0, PI2);
cairo_arc(cr2, tube_x2, windowHeight - tube_y2, 2 + defocussed, 0, PI2);
cairo_fill(cr2);
xlast = tube_x2;
@@ -551,8 +548,8 @@ void tube_drawVector(cairo_t *cr, cairo_t *cr2)
if (writeThroughMode) {
cairo_set_line_width (cr2, 2);
cairo_set_source_rgb(cr2, 0.0, WRITE_TROUGH_INTENSITY, 0.0);
cairo_move_to(cr2, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_line_to(cr2, tube_x2 + eoffx, windowHeight - tube_y2);
cairo_move_to(cr2, tube_x0, windowHeight - tube_y0);
cairo_line_to(cr2, tube_x2, windowHeight - tube_y2);
cairo_stroke (cr2);
}
@@ -561,24 +558,24 @@ void tube_drawVector(cairo_t *cr, cairo_t *cr2)
cairo_set_line_width (cr, 1 + defocussed);
cairo_set_source_rgb(cr, 0, (NORMAL_INTENSITY * intensity) / 100, 0);
tube_line_type(cr, cr2, ltype);
cairo_move_to(cr, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_line_to(cr, tube_x2 + eoffx, windowHeight - tube_y2);
cairo_move_to(cr, tube_x0, windowHeight - tube_y0);
cairo_line_to(cr, tube_x2, windowHeight - tube_y2);
cairo_stroke (cr);
//draw the bright spot, half intensity
cairo_set_line_width (cr2, 6 + 2 * defocussed);
double bsc = (BRIGHT_SPOT_COLOR_HALF * intensity) / 100;
cairo_set_source_rgb(cr2, bsc, bsc, bsc);
cairo_move_to(cr2, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_line_to(cr2, tube_x2 + eoffx, windowHeight - tube_y2);
cairo_move_to(cr2, tube_x0, windowHeight - tube_y0);
cairo_line_to(cr2, tube_x2, windowHeight - tube_y2);
cairo_stroke (cr2);
// draw the bright spot, high intensity
cairo_set_line_width (cr2, 3 + 2 * defocussed);
bsc = (BRIGHT_SPOT_COLOR * intensity) / 100;
cairo_set_source_rgb(cr2, bsc, bsc, bsc);
cairo_move_to(cr2, tube_x0 + eoffx, windowHeight - tube_y0);
cairo_line_to(cr2, tube_x2 + eoffx, windowHeight - tube_y2);
cairo_move_to(cr2, tube_x0, windowHeight - tube_y0);
cairo_line_to(cr2, tube_x2, windowHeight - tube_y2);
cairo_stroke(cr2);
}

3
tube.h
View File

@@ -27,9 +27,6 @@ extern int intensity;
extern int plotPointMode;
extern int writeThroughMode;
extern double efactor;
extern int eoffx;
extern int tube_x0, tube_x2, tube_y0, tube_y2;
extern long tube_mSeconds();

View File

@@ -1,3 +1,11 @@
Version 1.2.1 April 15, 2019
============================
New features
- full screen mode for ARDS (variable scaling not yet implemented)
Bug fixes
- substantial speed increase on high resolution screens
- removed some debug messages
Version 1.2 April 14, 2019
==========================
New features