diff --git a/Makefile b/Makefile index 293244f3a2c7b71b34d20a90b291a17143d330d3..4137051d349735e54e2d129fa540121a7f5ef43a 100644 --- a/Makefile +++ b/Makefile @@ -115,7 +115,7 @@ SIMOBJ = $(TARGET_DIR)/logcom.o $(DIGOBJ) $(ANAOBJ) TOOLOBJ = $(SIMOBJ) \ $(TARGET_DIR)/label.o $(TARGET_DIR)/wire.o \ $(TARGET_DIR)/page.o $(TARGET_DIR)/gate.o \ - $(TARGET_DIR)/screen.o $(TARGET_DIR)/node.o \ + $(TARGET_DIR)/window.o $(TARGET_DIR)/node.o \ $(TARGET_DIR)/tool.o $(TARGET_DIR)/utils.o \ $(TARGET_DIR)/pagewriter.o $(TARGET_DIR)/pagereader.o \ $(TARGET_DIR)/configreader.o $(TARGET_DIR)/attrs.o \ diff --git a/include/log_action.h b/include/log_action.h index 81523cfa02b6635aec2992b18841fdfd9c14a0fb..c8eec803d34247738eff6f69581adc07756f005e 100644 --- a/include/log_action.h +++ b/include/log_action.h @@ -89,7 +89,7 @@ typedef struct log_hooks_t void (*centerstr) (int x, int y, char *s); void (*clip) (); void (*remcursor) (); - void (*clearscreen) (); + void (*clearwindow) (); void (*setmode) (const char *s); void (*getword) (char *buf, char *wrd); void (*getint) (char *buf, long *i, long def); @@ -113,7 +113,7 @@ typedef struct log_hooks_t void (*beginerror) (); void (*enderror) (); void (*redraw) (); /*redraw drawing area*/ - void (*redrawscreen) (); /*redraw entire screen*/ + void (*redrawwindow) (); /*redraw entire window*/ void (*change) (log_page *page); void (*newgate) (log_grec **g, int gt); void (*copygate) (log_grec *old, log_grec **g); @@ -151,7 +151,7 @@ typedef struct log_hooks_t void (*newattrs) (log_gattrrec **gattr, int numattrs, log_kattrrec *kattr); void (*disposeattrs) (log_gattrrec **gattr, int numattrs, log_kattrrec *kattr); void (*copyattrs) (log_gattrrec **gattr, log_gattrrec *oldattr, int numattrs, log_kattrrec *kattr); - void (*initscreen) (); + void (*initwindow) (); void (*clearshowalpha) (); void (*setupregion) (log_regrec **r, int pagenum); void (*stamp) (long *i); diff --git a/include/screen.h b/include/window.h similarity index 92% rename from include/screen.h rename to include/window.h index 5952ed99e982d0767124aca321b45ae1e6c7cf16..6a255a97932fbfc328f0cd2ee2d1dfd1afc4b11d 100644 --- a/include/screen.h +++ b/include/window.h @@ -1,5 +1,5 @@ -#ifndef SCREEN_H -#define SCREEN_H +#ifndef WINDOW_H +#define WINDOW_H #include "logdef.h" @@ -7,9 +7,9 @@ void initcolormap(); void plainxformcoords(log_grec *g, short *x, short *y); -void initscreen(); +void initwindow(); -void initscreen2(); +void initwindow2(); void noblink(); @@ -17,11 +17,11 @@ void clearalpha(); void showalpha(); -void refrscreen1(); +void refrwindow1(); -void refrscreen(); +void refrwindow(); -void resize_screen(); +void resize_window(); void showcatalog(); @@ -49,7 +49,7 @@ void udrawgatec(int x, int y, int g, int c); void drawgatec(int x, int y, int g, int c); -void clearscreen(); +void clearwindow(); void restorecursor(); @@ -131,6 +131,6 @@ void xorcursor(); int hvline(short x1, short y1, short *x2, short *y2); -void init_X_screen(); +void init_X_window(); #endif diff --git a/src/box.c b/src/box.c index 8b74ccf06078a264e7324c88917983df985ab1a6..24ac6c4cd99af8b84c817b3a4e303fb6eb13f928 100644 --- a/src/box.c +++ b/src/box.c @@ -1,6 +1,6 @@ #include "box.h" #include "logglobals.h" -#include "screen.h" +#include "window.h" #include "log.h" #include "utils.h" #include "keyboard.h" diff --git a/src/configreader.c b/src/configreader.c index 995ed7ef24b7e57ccddee6864ae6e94dc3eab821..153231fda6aee02a4f2777c58c82b9e448b08b5e 100644 --- a/src/configreader.c +++ b/src/configreader.c @@ -4,7 +4,7 @@ #include "graphics/newcrt.h" #include "utils/strings.h" #include "log.h" -#include "screen.h" +#include "window.h" #include "utils.h" #include "tool.h" diff --git a/src/gate.c b/src/gate.c index 581bdba6b5675f5bb2a67e3cda39233c6bc462f7..420fc92f1273de0b154065c1d80076d8e99dfbce 100644 --- a/src/gate.c +++ b/src/gate.c @@ -4,7 +4,7 @@ #include "logfont.h" #include "logglobals.h" #include "logstructs.h" -#include "screen.h" +#include "window.h" #include "utils.h" #include "node.h" #include "log.h" diff --git a/src/keyboard.c b/src/keyboard.c index 8261b4b11f155bf96f78c5b28e5a76b47355e9e8..b83d9adaf3de6d0f2e12f6e929c63222cf894cd0 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -4,7 +4,7 @@ #include "logglobals.h" #include "logdef.h" #include "log.h" -#include "screen.h" +#include "window.h" #include "pen.h" /// Return TRUE if a key has been pressed (via keyboard or menu boxes). diff --git a/src/label.c b/src/label.c index 8c7326a926788aa54362ef306e87cb3b9eb11f4c..2269a34a8c37d034ee569e5ee5ac35199f8cf5eb 100644 --- a/src/label.c +++ b/src/label.c @@ -10,7 +10,7 @@ #include "logfont.h" #include "utils.h" #include "page.h" -#include "screen.h" +#include "window.h" #include "log.h" #include "keyboard.h" #include "pen.h" diff --git a/src/libraryreader.c b/src/libraryreader.c index 3721ee65e8f6825ae005a5f34563ecdc4f6b694b..63ddd350cf3b5995ea6e99849e0d6622c220fc62 100644 --- a/src/libraryreader.c +++ b/src/libraryreader.c @@ -7,7 +7,7 @@ #include "logdef.h" #include "logglobals.h" #include "log.h" -#include "screen.h" +#include "window.h" #include "swap.h" /** @brief Compare string S with template string T. diff --git a/src/log.c b/src/log.c index 90d1e0c4bf50362fd7b8496cf74892c8eb2f421e..fab2e193e52cda98bccfc3f534d30423bde6c2d7 100644 --- a/src/log.c +++ b/src/log.c @@ -65,7 +65,7 @@ #include "logglobals.h" #include "attrs.h" -#include "screen.h" +#include "window.h" #include "label.h" #include "gate.h" #include "wire.h" @@ -1967,7 +1967,7 @@ void scroll() remcursor(); gg.xoff += xoff0; gg.yoff += yoff0; - refrscreen1(); + refrwindow1(); xoff0 = 0; yoff0 = 0; TEMP = nk_testkey(0); @@ -3433,14 +3433,14 @@ static void pastecommand(long movemode) if (thepage != copybuf.pgnum) { newpage(copybuf.pgnum); - refrscreen1(); + refrwindow1(); } cutcopy(&deleted, copybuf.x1copy, copybuf.y1copy, copybuf.x2copy, copybuf.y2copy, true, false); if (thepage != copybuf.pgnum) { newpage(thepage); - refrscreen1(); + refrwindow1(); } clearbuf(&deleted); pastebuf(©buf, gg.posx, gg.posy); @@ -5579,7 +5579,7 @@ static void listlibrary() exitflag = true; } } while (!exitflag); - clearscreen(); + clearwindow(); m_graphics_on(); clearalpha(); } @@ -5764,7 +5764,7 @@ static void gatecatalog(int librmode) pen(); if (done && gg.t.depressed && !oo && !gg.t.off && flag) { - refrscreen(); + refrwindow(); addgate(y0 * catwidth + x0 + 1, 0, NULL); } } @@ -7503,14 +7503,14 @@ struct LOC_doshellescape { static void recov(struct LOC_doshellescape *LINK) { nk_settransarray(nk_ktsupplied, &curkeytrans); - initscreen2(); + initwindow2(); if (m_maxcolor != LINK->oldc) initcolormap(); m_init_pen(tabletaddr); initcolors(); - refrscreen(); + refrwindow(); } @@ -8624,7 +8624,7 @@ static void historycommand() { if (V.rflag) { - clearscreen(); + clearwindow(); movinghn = NULL; pass(); gg.showpage = log_page_history; @@ -9356,7 +9356,7 @@ if gg.t.y < 46 then y1 := 0; */ ENDTRY(try27); } clearfunc(); - refrscreen(); + refrwindow(); } #undef catsize @@ -10622,7 +10622,7 @@ void docnffunction() { initcolors(); if (gg.showpage > 0) - refrscreen(); + refrwindow(); } clearfunc(); return; @@ -10984,12 +10984,12 @@ void dofunction() else if (!strcmp(gg.func, "REFRESH")) { clearfunc(); - refrscreen(); + refrwindow(); } else if (!strcmp(gg.func, "RESIZE")) { clearfunc(); - resize_screen(); + resize_window(); } else if (!strcmp(gg.func, "REFR")) scroll(); @@ -11210,7 +11210,7 @@ static void inithooks() gg.hook.centerstr = centerstr2; gg.hook.clip = clipon; gg.hook.remcursor = remcursor; - gg.hook.clearscreen = clearscreen; + gg.hook.clearwindow = clearwindow; gg.hook.setmode = log_setmode; gg.hook.getword = getword; gg.hook.getint = pgetint; @@ -11233,8 +11233,8 @@ static void inithooks() gg.hook.endbottom = endbottom; gg.hook.beginerror = beginerror; gg.hook.enderror = enderror; - gg.hook.redraw = refrscreen1; - gg.hook.redrawscreen = refrscreen; + gg.hook.redraw = refrwindow1; + gg.hook.redrawwindow = refrwindow; gg.hook.change = chpage; gg.hook.newgate = newgate; gg.hook.copygate = copygate; @@ -11271,7 +11271,7 @@ static void inithooks() gg.hook.newattrs = newattrs; gg.hook.disposeattrs = disposeattrs; gg.hook.copyattrs = copyattrs; - gg.hook.initscreen = initscreen; + gg.hook.initwindow = initwindow; gg.hook.clearshowalpha = clearshowalpha; gg.hook.setupregion = setupregion; gg.hook.stamp = stamp; @@ -11310,7 +11310,7 @@ static void inithooks() /** @brief Initialize all variables. Read basic gates from library. - Clear catalog screen. + Clear catalog window. Initialize global data structures. */ static void initialize() @@ -11366,7 +11366,7 @@ static void initialize() tabletaddr = 0; gg.curstamp = 0; - initscreen2(); + initwindow2(); initcolormap(); libptr = 0; helpptr = 0; @@ -11876,7 +11876,7 @@ static void initialize() } } strlist_empty(&V.logmenu); - refrscreen(); + refrwindow(); clearalpha(); /*shift-right*/ @@ -11931,7 +11931,7 @@ static void shownews() /** @brief Initialize. Then Process pen: Add gates. Add wires and solder them. - Refresh screen when necessary. + Refresh window when necessary. Process keyboard and menu areas. */ int main(int argc, char * argv[]) @@ -11975,7 +11975,7 @@ int main(int argc, char * argv[]) goto _Ltry41; } if (gg.showpage <= 0) - refrscreen(); + refrwindow(); m_graphics_on(); nc_cursor_off(); while (messages != NULL) @@ -12202,7 +12202,7 @@ int main(int argc, char * argv[]) m_graphics_on(); clearalpha(); ENDTRY(try41); - refrscreen(); + refrwindow(); } while (!pigsfly); RECOVER2(try40,_Ltry40); TRY(try42); diff --git a/src/logstuff.c b/src/logstuff.c index 3c9e097fbde4e557e0dfd17878718fb99e054a07..bceeb05b4b0753847e4bea09360a445b401eff1c 100644 --- a/src/logstuff.c +++ b/src/logstuff.c @@ -124,15 +124,6 @@ void choose_log_cursor(int curs) } } - - - -void init_X_screen() -{ - setup_log_cursors(); - choose_log_cursor(0); -} - void m_bunny(int x, int y) { m_colormode(m_xor); diff --git a/src/pagereader.c b/src/pagereader.c index 00f793736ab2697c7343781765b5b4b7a91df2b7..144ac3e669e8834d90e5e89239ccf30c99d39629 100644 --- a/src/pagereader.c +++ b/src/pagereader.c @@ -7,7 +7,7 @@ #include "node.h" #include "log.h" #include "page.h" -#include "screen.h" +#include "window.h" #include "tool.h" #include "utils.h" #include "box.h" diff --git a/src/pagewriter.c b/src/pagewriter.c index 8acde3dcbe09ca52a83c13fc4990e6d6d1dba398..4ad95a0e38063e8ab80a6cfaba390fcc5b1e0fd3 100644 --- a/src/pagewriter.c +++ b/src/pagewriter.c @@ -5,7 +5,7 @@ #include <graphics/newcrt.h> #include <graphics/newci.h> #include "log.h" -#include "screen.h" +#include "window.h" #include "tool.h" #include "utils.h" #include "box.h" diff --git a/src/pen.c b/src/pen.c index 234b27d8b58f9b095f64a0fd2af9a071baf44d30..bc62e0c4cdaa9ec8aa0ae01255bf04733242f588 100644 --- a/src/pen.c +++ b/src/pen.c @@ -6,7 +6,7 @@ #include "logglobals.h" #include "keyboard.h" #include "log.h" -#include "screen.h" +#include "window.h" short rabstate = 0; ///< Rabbit recognizer state diff --git a/src/screen.c b/src/window.c similarity index 96% rename from src/screen.c rename to src/window.c index 3e093d23b5f3b93f44038d35363da9f2dfb427cd..1649469f32b5886eda3f3cd916197745372dd156 100644 --- a/src/screen.c +++ b/src/window.c @@ -38,7 +38,7 @@ #include "logfont.h" #include "logstuff.h" #include "utils.h" -#include "screen.h" +#include "window.h" #include "node.h" #include "log.h" #include "box.h" @@ -55,9 +55,9 @@ short chairy; ///< Y position of crosshair int cursorflag; ///< If cursor is displayed int prevcursorflag; ///< If cursor was displayed before operation began -int chairflag; ///< If crosshair is on screen -int chairflag2; ///< If crosshair will be on screen -int rbandflag; ///< If Rubber-band wire is on screen +int chairflag; ///< If crosshair is on window +int chairflag2; ///< If crosshair will be on window +int rbandflag; ///< If Rubber-band wire is on window static rablistrec rabtable[rabtabsize]; ///< Positions of rabbits @@ -96,7 +96,7 @@ void fixcolormap() /// Initialize color graphics, graphics tablet, low-level flags & variables. -void initscreen() +void initwindow() { cursorflag = false; m_init_screen(); @@ -104,7 +104,7 @@ void initscreen() m_setlinestyle(1L, 0xf0f0L); m_setlinestyle(2L, 0xaaaaL); m_setfont(logfont_lfont); - init_X_screen(); + init_X_window(); onescreen = nc_alphashared(); eightcolors = (m_maxcolor <= 7); @@ -112,7 +112,7 @@ void initscreen() txdown = nc_curWindow->height - 1; across = m_across; down = m_down; - baseline = down - 53; /* Position of baseline on screen */ + baseline = down - 53; /* Position of baseline on window */ line1 = down - 43; /* Position of first text line in menu */ line2 = down - 23; /* Position of second text line in menu */ histdown = down - 26; @@ -131,9 +131,9 @@ void initscreen() } -void initscreen2() +void initwindow2() { - initscreen(); + initwindow(); m_clear(); m_graphics_on(); } @@ -269,7 +269,7 @@ void centerstr2(int x, int y, char *s) } -/// Draw a single digit at the specified position (screen coordinates). +/// Draw a single digit at the specified position (window coordinates). void drawnum1(short x, short y, short n) { char s[2]; @@ -281,7 +281,7 @@ void drawnum1(short x, short y, short n) } -/// Draw a two-digit number at the specified position (screen coordinates). +/// Draw a two-digit number at the specified position (window coordinates). void drawnum2(short x, short y, short n) { char s[3]; @@ -343,7 +343,7 @@ void clipoff() m_noclip(); } -/// Erase a rectangular area of the screen using screen coordinates. +/// Erase a rectangular area of the window using window coordinates. void uerase(short x1, short y1, short x2, short y2) { m_color((long)gg.color.backgr); @@ -351,7 +351,7 @@ void uerase(short x1, short y1, short x2, short y2) } -/// Erase a rectangular area of the screen using grid coordinates. +/// Erase a rectangular area of the window using grid coordinates. void erase(short x1, short y1, short x2, short y2) { m_color((long)gg.color.backgr); @@ -359,7 +359,7 @@ void erase(short x1, short y1, short x2, short y2) } -/// Make sure there are no rabbits on the screen. +/// Make sure there are no rabbits on the window. void norabbits() { short i; @@ -377,7 +377,7 @@ void norabbits() } -/// Draw a rabbit on the screen. +/// Draw a rabbit on the window. void addrabbit() { short i, j, rx, ry; @@ -447,7 +447,7 @@ int hvline(short x1, short y1, short *x2, short *y2) return Result; } -/// Adjust screen coordinates so that they are aligned to the nearest grid point. +/// Adjust window coordinates so that they are aligned to the nearest grid point. void fixxy(short *x, short *y) { *x = (*x + gg.xoff + gg.hscale) / gg.scale * gg.scale - gg.xoff; @@ -469,10 +469,10 @@ void crosshair(short x, short y) chairflag2 = true; } -/** @brief Draw the cursor on the screen. +/** @brief Draw the cursor on the window. The exact shape drawn depends upon the current mode. - If the cursor is already on the screen, it + If the cursor is already on the window, it is removed. Possible cursors: @@ -589,7 +589,7 @@ void xorcursor() } -/// Used to remove cursor from screen while drawing graphics. +/// Used to remove cursor from window while drawing graphics. void hidecursor() { if (cursorflag) @@ -620,7 +620,7 @@ void hidecursorrect_hook(long x1, long y1, long x2, long y2) hidecursor_hook(); } -/// Position the cursor to a particular point (screen coordinates). +/// Position the cursor to a particular point (window coordinates). void drawcursor(short x, short y) { if (x != cursx || y != cursy || !cursorflag || cursortype != oldcursortype) @@ -652,7 +652,7 @@ void drawcursor(short x, short y) cursorhide = false; } -/// Take the cursor off the screen. +/// Take the cursor off the window. void remcursor() { prevcursorflag = cursorflag; @@ -670,8 +670,8 @@ void restorecursor() cursorflag = prevcursorflag; } -/// Clear the screen. -void clearscreen() +/// Clear the window. +void clearwindow() { remcursor(); m_noclip(); @@ -689,7 +689,7 @@ void clearscreen() void clearshowalpha() { if (onescreen) - clearscreen(); + clearwindow(); nc_printf("\f"); nk_gotoxy(0, 0); noblink(); @@ -1178,7 +1178,7 @@ void plaindrawgatec(short x, short y, short g, short c) hidecursor(); } -/// Draw a gate of specified color at a certain position (screen coordinates). +/// Draw a gate of specified color at a certain position (window coordinates). void udrawgatec(int x, int y, int g, int c) { short i, z, rxx, rxy, ryx, ryy; @@ -1693,14 +1693,14 @@ void drawboxc0(short x1, short y1, short x2, short y2, short c) m_linestyle(0L); } -/// Draw a dashed box on the screen. +/// Draw a dashed box on the window. void drawboxc(log_brec *b, short c) { drawboxc0(b->x1, b->y1, b->x2, b->y2, c); } -/// Draw the printing markers on the screen. +/// Draw the printing markers on the window. void drawmarkersc(short c) { clipon(); @@ -1870,7 +1870,7 @@ void refrbaseline(int always) #define rtn "REFRESH" -/// Refresh the screen (does not clear, so may be used to "clean up" existing screen). +/// Refresh the window (does not clear, so may be used to "clean up" existing window). void refresh() { long x1, y1, x2, y2; @@ -2032,7 +2032,7 @@ void refresh() #undef rtn -/// Screen is messed up, so refresh it as soon as the user stops moving around. +/// Window is messed up, so refresh it as soon as the user stops moving around. void refreshsoon() { refrtimer0 = refrdelay; @@ -2040,7 +2040,7 @@ void refreshsoon() gg.refrflag = true; } -/// Clear and redraw menu area of screen. +/// Clear and redraw menu area of window. void refrmenu() { short i, FORLIM; @@ -2106,8 +2106,8 @@ void endbottom() clearalpha(); } -/// Clear and redraw working area of screen. -void refrscreen1() +/// Clear and redraw working area of window. +void refrwindow1() { m_colormode((long)m_normal); m_noclip(); @@ -2119,8 +2119,8 @@ void refrscreen1() } -/// Clear and redraw entire screen. -void refrscreen() +/// Clear and redraw entire window. +void refrwindow() { gg.showpage = gg.curpage; bottomcount = 0; @@ -2129,24 +2129,24 @@ void refrscreen() fixcolormap(); clearalpha(); refrmenu(); - refrscreen1(); + refrwindow1(); m_graphics_on(); } -void resize_screen() +void resize_window() { - initscreen2(); - initscreen(); + initwindow2(); + initwindow(); } -//// Switch screen to catalog (TRUE) or circuit (FALSE). +//// Switch window to catalog (TRUE) or circuit (FALSE). void showcatalog() { short i; catboxrec *cb; short x1, y1, x2, y2, FORLIM; - clearscreen(); + clearwindow(); gg.showpage = log_page_cat; FORLIM = maxkinds; for (i = 1; i <= FORLIM; i++) @@ -2179,4 +2179,9 @@ void showcatalog() } } +void init_X_window() +{ + setup_log_cursors(); + choose_log_cursor(0); +} diff --git a/src/wire.c b/src/wire.c index b5738c05bcdbb71d539467eaa6af54840688eacd..a5dfc6f894c225331e555f7fc86b1a061860645f 100644 --- a/src/wire.c +++ b/src/wire.c @@ -8,7 +8,7 @@ #include "wire.h" #include "node.h" #include "log.h" -#include "screen.h" +#include "window.h" void fryhwire(log_hwrec *hw) {