Subversion Repositories SvarDOS

Rev

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

Rev 1330 Rev 1331
Line 168... Line 168...
168
  mdr_cout_str(screenh - 1, helpcol, " F1=", scheme[COL_STATUSBAR2], 40);
168
  mdr_cout_str(screenh - 1, helpcol, " F1=", scheme[COL_STATUSBAR2], 40);
169
  mdr_cout_str(screenh - 1, helpcol + 4, s, scheme[COL_STATUSBAR2], 40);
169
  mdr_cout_str(screenh - 1, helpcol + 4, s, scheme[COL_STATUSBAR2], 40);
170
}
170
}
171
 
171
 
172
 
172
 
173
static void ui_msg(const char *msg, unsigned char attr) {
173
static void ui_msg(const char *msg1, const char *msg2, unsigned char attr) {
174
  unsigned short x, y, msglen, i;
174
  unsigned short x, y, msglen, i;
-
 
175
  unsigned char msg2flag = 0;
-
 
176
 
175
  msglen = strlen(msg);
177
  msglen = strlen(msg1);
-
 
178
  if (msg2) {
-
 
179
    msg2flag = 1;
-
 
180
    i = strlen(msg2);
-
 
181
    if (i > msglen) msglen = i;
-
 
182
  }
-
 
183
 
176
  y = (screenh - 4) >> 1;
184
  y = (screenh - 6) >> 1;
177
  x = (screenw - msglen - 4) >> 1;
185
  x = (screenw - msglen - 4) >> 1;
178
  for (i = y+2; i >= y; i--) mdr_cout_char_rep(i, x, ' ', attr, msglen + 2);
186
  for (i = y+2+msg2flag; i >= y; i--) mdr_cout_char_rep(i, x, ' ', attr, msglen + 2);
-
 
187
  x++;
179
  mdr_cout_str(y+1, x+1, msg, attr, msglen);
188
  mdr_cout_str(y+1, x, msg1, attr, msglen);
-
 
189
  if (msg2) mdr_cout_str(y+2, x, msg2, attr, msglen);
180
 
190
 
181
  if (uidirty.from > y) uidirty.from = y;
191
  if (uidirty.from > y) uidirty.from = y;
182
  if (uidirty.to < y+3) uidirty.to = y+3;
192
  if (uidirty.to < y+4) uidirty.to = y+4;
183
}
193
}
184
 
194
 
185
 
195
 
186
static void ui_help(void) {
196
static void ui_help(void) {
187
#define MAXLINLEN 35
197
#define MAXLINLEN 35
Line 695... Line 705...
695
 
705
 
696
    } else if (k == 0x14F) { /* end */
706
    } else if (k == 0x14F) { /* end */
697
       cursor_eol(db);
707
       cursor_eol(db);
698
 
708
 
699
    } else if (k == 0x1B) { /* ESC */
709
    } else if (k == 0x1B) { /* ESC */
700
      break;
710
      if (db->modflag == 0) break;
-
 
711
      /* if file has been modified then ask for confirmation */
-
 
712
      ui_msg(svarlang_str(0,4), svarlang_str(0,5), scheme[COL_MSG]);
-
 
713
      if (keyb_getkey() == '\r') break;
701
 
714
 
702
    } else if (k == 0x0D) { /* ENTER */
715
    } else if (k == 0x0D) { /* ENTER */
703
      unsigned short off = db->xoffset + db->cursorposx;
716
      unsigned short off = db->xoffset + db->cursorposx;
704
      /* add a new line */
717
      /* add a new line */
705
      if (line_add(db, db->cursor->payload + off, db->cursor->len - off) == 0) {
718
      if (line_add(db, db->cursor->payload + off, db->cursor->len - off) == 0) {
Line 737... Line 750...
737
      uidirty.to = 0xff;
750
      uidirty.to = 0xff;
738
 
751
 
739
    } else if (k == 0x13f) { /* F5 */
752
    } else if (k == 0x13f) { /* F5 */
740
      if (savefile(db) == 0) {
753
      if (savefile(db) == 0) {
741
        db->modflag = 0;
754
        db->modflag = 0;
742
        ui_msg(svarlang_str(0, 2), scheme[COL_MSG]);
755
        ui_msg(svarlang_str(0, 2), NULL, scheme[COL_MSG]);
743
        mdr_bios_tickswait(11); /* 11 ticks is about 600 ms */
756
        mdr_bios_tickswait(11); /* 11 ticks is about 600 ms */
744
      } else {
757
      } else {
745
        ui_msg(svarlang_str(0, 3), scheme[COL_ERR]);
758
        ui_msg(svarlang_str(0, 3), NULL, scheme[COL_ERR]);
746
        mdr_bios_tickswait(36); /* 2s */
759
        mdr_bios_tickswait(36); /* 2s */
747
      }
760
      }
748
 
761
 
749
    } else if (k == 0x144) { /* F10 */
762
    } else if (k == 0x144) { /* F10 */
750
      db->modflag = 1;
763
      db->modflag = 1;