Subversion Repositories SvarDOS

Rev

Rev 1311 | Rev 1313 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1311 Rev 1312
Line 27... Line 27...
27
#include <fcntl.h>
27
#include <fcntl.h>
28
#include <stdlib.h>
28
#include <stdlib.h>
29
#include <string.h>
29
#include <string.h>
30
#include <malloc.h>   /* _fcalloc() */
30
#include <malloc.h>   /* _fcalloc() */
31
 
31
 
-
 
32
#include "mdr\bios.h"
32
#include "mdr\cout.h"
33
#include "mdr\cout.h"
33
#include "mdr\dos.h"
34
#include "mdr\dos.h"
34
#include "mdr\keyb.h"
35
#include "mdr\keyb.h"
35
 
36
 
36
#include "svarlang\svarlang.h"
37
#include "svarlang\svarlang.h"
Line 125... Line 126...
125
    mdr_cout_char(i, screenw - 1, SCROLL_CURSOR, scheme[COL_SCROLLBAR]);
126
    mdr_cout_char(i, screenw - 1, SCROLL_CURSOR, scheme[COL_SCROLLBAR]);
126
  }
127
  }
127
}
128
}
128
 
129
 
129
 
130
 
-
 
131
static void ui_msg(const char *msg, unsigned char screenw, unsigned char screenh, unsigned char *uidirtyfrom, unsigned char *uidirtyto) {
-
 
132
  unsigned short x, y, msglen, i;
-
 
133
  msglen = strlen(msg);
-
 
134
  y = (screenh - 4) >> 1;
-
 
135
  x = (screenw - msglen - 4) >> 1;
-
 
136
  for (i = y+2; i >= y; i--) mdr_cout_char_rep(i, x, ' ', scheme[COL_STATUSBAR1], msglen + 2);
-
 
137
  mdr_cout_str(y+1, x+1, msg, scheme[COL_STATUSBAR1], msglen);
-
 
138
 
-
 
139
  if (*uidirtyfrom > y) *uidirtyfrom = y;
-
 
140
  if (*uidirtyto < y+2) *uidirtyto = y+2;
-
 
141
}
-
 
142
 
-
 
143
 
130
static void ui_help(unsigned char screenw) {
144
static void ui_help(unsigned char screenw) {
131
#define MAXLINLEN 35
145
#define MAXLINLEN 35
132
  unsigned short i, x, offset;
146
  unsigned short i, offset;
133
  offset = (screenw - MAXLINLEN + 1) >> 1;
147
  offset = (screenw - MAXLINLEN + 1) >> 1;
134
  mdr_cout_cursor_hide();
148
  mdr_cout_cursor_hide();
135
  for (i = 2; i <= 12; i++) {
149
  for (i = 2; i <= 12; i++) {
136
    for (x = offset - 2; x < offset + MAXLINLEN; x++) mdr_cout_char(i, x, ' ', scheme[COL_STATUSBAR1]);
150
    mdr_cout_char_rep(i, offset - 2, ' ', scheme[COL_STATUSBAR1], MAXLINLEN);
137
  }
151
  }
138
 
152
 
139
  mdr_cout_str(3, offset, svarlang_str(0, 0), scheme[COL_STATUSBAR1], MAXLINLEN);
153
  mdr_cout_str(3, offset, svarlang_str(0, 0), scheme[COL_STATUSBAR1], MAXLINLEN);
140
  for (i = 0; i <= 2; i++) {
154
  for (i = 0; i <= 2; i++) {
141
    mdr_cout_str(5 + i, offset, svarlang_str(8, i), scheme[COL_STATUSBAR1], MAXLINLEN);
155
    mdr_cout_str(5 + i, offset, svarlang_str(8, i), scheme[COL_STATUSBAR1], MAXLINLEN);
Line 532... Line 546...
532
      ui_help(screenw);
546
      ui_help(screenw);
533
      uidirtyfrom = 0;
547
      uidirtyfrom = 0;
534
      uidirtyto = 0xff;
548
      uidirtyto = 0xff;
535
 
549
 
536
    } else if (k == 0x13f) { /* F5 */
550
    } else if (k == 0x13f) { /* F5 */
-
 
551
      const char *m[] = {"SAVED", "SAVING FILE FAILED"};
-
 
552
      int i;
537
      savefile(&db, fname);
553
      i = !!savefile(&db, fname);
-
 
554
      ui_msg(m[i], screenw, screenh, &uidirtyfrom, &uidirtyto);
-
 
555
      mdr_bios_tickswait(11); /* 11 ticks is about 600 ms */
538
 
556
 
539
    } else { /* UNHANDLED KEY - TODO IGNORE THIS IN PRODUCTION RELEASE */
557
    } else { /* UNHANDLED KEY - TODO IGNORE THIS IN PRODUCTION RELEASE */
540
      char buff[4];
558
      char buff[4];
541
      const char *HEX = "0123456789ABCDEF";
559
      const char *HEX = "0123456789ABCDEF";
542
      buff[0] = HEX[(k >> 8) & 15];
560
      buff[0] = HEX[(k >> 8) & 15];