Make the keypad info display into a window

This commit is contained in:
Chris Taylor 2010-12-28 12:29:42 +08:00
parent 2fa153489c
commit f755a5e030
5 changed files with 52 additions and 28 deletions

View file

@ -3,6 +3,7 @@ D2X-Rebirth Changelog
20101228
--------
d2x-rebirth.xcodeproj/project.pbxproj, editor, include/editor, main/editor, SConstruct: Move main/editor to editor and move headers to include/editor, like d1x
editor/info.c, editor/med.c, include/editor/editor.h, include/editor/info.h: Make the keypad info display into a window
20101224
--------

View file

@ -24,7 +24,9 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <i86.h>
#include <malloc.h>
#endif
#include "inferno.h"
#include "window.h"
#include "segment.h"
#include "gr.h"
#include "ui.h"
@ -309,36 +311,53 @@ void clear_pad_display(void)
}
// ------------------------------------------------------------------------------------
void info_display_all( UI_WINDOW * wnd )
int info_display_all(window *wind, d_event *event, void *userdata)
{
static int old_padnum = -1;
int padnum,show_all = 0;
static int old_padnum = -1;
int padnum,show_all = 0;
grs_canvas *save_canvas = grd_curcanv;
wnd++; //kill warning
switch (event->type)
{
case EVENT_WINDOW_DRAW:
userdata++; //kill warning
grd_curcanv = Pad_text_canvas;
gr_set_current_canvas(window_get_canvas(wind));
padnum = ui_pad_get_current();
Assert(padnum <= MAX_PAD_ID);
padnum = ui_pad_get_current();
Assert(padnum <= MAX_PAD_ID);
if (padnum != old_padnum) {
clear_pad_display();
old_padnum = padnum;
show_all = 1;
}
if (padnum != old_padnum) {
clear_pad_display();
old_padnum = padnum;
show_all = 1;
}
switch (padnum) {
case OBJECT_PAD_ID: // Object placement
info_display_object_placement(show_all);
break;
case SEGSIZE_PAD_ID: // Segment sizing
info_display_segsize(show_all);
break;
switch (padnum) {
case OBJECT_PAD_ID: // Object placement
info_display_object_placement(show_all);
break;
case SEGSIZE_PAD_ID: // Segment sizing
info_display_segsize(show_all);
break;
default:
info_display_default(show_all);
break;
}
grd_curcanv = save_canvas;
return 1;
default:
info_display_default(show_all);
break;
}
grd_curcanv = save_canvas;
return 0;
}
// ------------------------------------------------------------------------------------
window *info_window_create(void)
{
return window_create(Canv_editor, PAD_X + 250, PAD_Y + 8, 180, 160, info_display_all, NULL);
}

View file

@ -29,6 +29,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <time.h>
#include "inferno.h"
#include "window.h"
#include "messagebox.h"
#include "segment.h"
#include "gr.h"
@ -91,7 +92,7 @@ grs_canvas *Canv_editor; //the editor screen
grs_canvas *Canv_editor_game=&_canv_editor_game; //the game on the editor screen
grs_canvas *canv_offscreen; //for off-screen rendering
grs_canvas *Pad_text_canvas; // Keypad text
window *Pad_info; // Keypad text
grs_font *editor_font=NULL;
@ -779,7 +780,7 @@ void init_editor_screen()
//ui_add_gadget_button( EditorWindow, 640, 540, 50, 25, "Shell", DosShell );
ui_pad_activate( EditorWindow, PAD_X, PAD_Y );
Pad_text_canvas = gr_create_sub_canvas(Canv_editor, PAD_X + 250, PAD_Y + 8, 180, 160);
Pad_info = info_window_create();
ui_add_gadget_button( EditorWindow, PAD_X+6, PAD_Y+(30*5)+22, PAD_WIDTH, 20, "<<", med_keypad_goto_prev );
ui_add_gadget_button( EditorWindow, PAD_X+PAD_WIDTH1+6, PAD_Y+(30*5)+22, PAD_WIDTH, 20, ">>", med_keypad_goto_next );
@ -833,7 +834,7 @@ void close_editor_screen()
editor_screen_open = 0;
ui_pad_deactivate();
gr_free_sub_canvas(Pad_text_canvas);
window_close(Pad_info);
ui_close_window(EditorWindow);
@ -1050,7 +1051,6 @@ void editor(void)
while (Function_mode == FMODE_EDITOR) {
gr_set_curfont(editor_font);
info_display_all(EditorWindow);
ModeFlag = 0;

View file

@ -26,6 +26,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "gr.h"
#include "ui.h"
struct window;
/*
* Constants
*
@ -178,7 +180,7 @@ extern segment *Markedsegp; // Marked segment, used in conjunction with *Curse
extern int Markedside; // Marked side on Markedsegp.
extern sbyte Vertex_active[MAX_VERTICES]; // !0 means vertex is in use, 0 means not in use.
extern grs_canvas *Pad_text_canvas; // Keypad text
extern struct window *Pad_info; // Keypad text
// The extra group in the following arrays is used for group rotation.
extern group GroupList[MAX_GROUPS+1];
@ -619,7 +621,7 @@ extern grs_canvas *Canv_editor; //the editor screen
extern grs_canvas *Canv_editor_game; //the game on the editor screen
extern grs_canvas *canv_offscreen; //for off-screen rendering
extern grs_canvas *Pad_text_canvas; // Keypad text
extern struct window *Pad_info; // Keypad text
//where the editor is looking
extern vms_vector Ed_view_target;

View file

@ -21,7 +21,9 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifndef _INFO_H
#define _INFO_H
void info_display_all( UI_WINDOW * wnd );
struct window;
struct window *info_window_create(void);
extern int init_info;