mirror of https://github.com/MidnightCommander/mc
* view.c: Cleanup of preprocessor directives.
* view.h: Likewise. * widget.c: Likewise. * widget.h: Likewise.
This commit is contained in:
parent
f2e38b2c3a
commit
9b00e32f64
|
@ -1,5 +1,10 @@
|
|||
2001-09-15 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* view.c: Cleanup of preprocessor directives.
|
||||
* view.h: Likewise.
|
||||
* widget.c: Likewise.
|
||||
* widget.h: Likewise.
|
||||
|
||||
* textconf.h: Get rid of all PORT_HAS_*. Adjust all users.
|
||||
Continued eliminating GNOME code.
|
||||
|
||||
|
|
57
src/view.c
57
src/view.c
|
@ -37,9 +37,6 @@
|
|||
# include <sys/mman.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#include <ctype.h> /* For toupper() */
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
|
@ -73,7 +70,7 @@
|
|||
#ifdef HAVE_CHARSET
|
||||
#include "charsets.h"
|
||||
#include "selcodepage.h"
|
||||
#endif
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
#ifndef MAP_FILE
|
||||
#define MAP_FILE 0
|
||||
|
@ -97,10 +94,6 @@ int max_dirt_limit =
|
|||
10;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_X
|
||||
#define is_idle() 1
|
||||
#endif
|
||||
|
||||
extern Hook *idle_hook;
|
||||
|
||||
/* Our callback */
|
||||
|
@ -154,7 +147,7 @@ free_file (WView *view)
|
|||
mc_munmap (view->data, view->s.st_size);
|
||||
close_view_file (view);
|
||||
} else
|
||||
#endif
|
||||
#endif /* HAVE_MMAP */
|
||||
{
|
||||
if (view->reading_pipe){
|
||||
/* Check error messages */
|
||||
|
@ -344,7 +337,7 @@ put_editkey (WView *view, unsigned char key)
|
|||
* view->data array to allow changes to be reflected when
|
||||
* user switches back to ascii mode */
|
||||
view->data[view->edit_cursor] = byte_val;
|
||||
#endif /* HAVE_MMAP */
|
||||
#endif /* !HAVE_MMAP */
|
||||
node->offset = view->edit_cursor;
|
||||
node->value = byte_val;
|
||||
enqueue_change (&view->change_list, node);
|
||||
|
@ -675,7 +668,6 @@ view_init (WView *view, char *_command, const char *_file, int start_line)
|
|||
|
||||
/* {{{ Screen update functions */
|
||||
|
||||
#ifndef HAVE_X
|
||||
void
|
||||
view_percent (WView *view, int p, int w, gboolean update_gui)
|
||||
{
|
||||
|
@ -770,7 +762,6 @@ view_display_clean (WView *view, int height, int width)
|
|||
#define view_add_one_vline() one_vline()
|
||||
#define view_add_string(view,s) addstr (s)
|
||||
#define view_gotoyx(v,r,c) widget_move (v,r,c)
|
||||
#endif
|
||||
|
||||
/* Both the text mode and gnome editions use this */
|
||||
#define BOLD_COLOR MARKED_COLOR
|
||||
|
@ -1463,14 +1454,6 @@ search_update_steps (WView *view)
|
|||
update_steps = 20000;
|
||||
}
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
static void
|
||||
cancel_pressed (GtkWidget *widget, int *abort)
|
||||
{
|
||||
*abort = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
|
||||
{
|
||||
|
@ -1480,13 +1463,7 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
|
|||
long p, beginning;
|
||||
int found_len, search_start;
|
||||
int search_status;
|
||||
#ifdef HAVE_GNOME
|
||||
char *msg;
|
||||
int abort;
|
||||
GtkWidget *gd;
|
||||
#else
|
||||
Dlg_head *d = 0;
|
||||
#endif
|
||||
|
||||
/* Used to keep track of where the line starts, when looking forward */
|
||||
/* is the index before transfering the line; the reverse case uses */
|
||||
|
@ -1497,22 +1474,10 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
|
|||
/* Clear interrupt status */
|
||||
got_interrupt ();
|
||||
|
||||
#ifdef HAVE_GNOME
|
||||
abort = 0;
|
||||
msg = g_strdup_printf (_("Searching for `%s'"), text);
|
||||
gd = gnome_message_box_new (msg,
|
||||
GNOME_MESSAGE_BOX_INFO,
|
||||
GNOME_STOCK_BUTTON_CANCEL,
|
||||
NULL);
|
||||
g_free (msg);
|
||||
gnome_dialog_button_connect (GNOME_DIALOG (gd), 0, GTK_SIGNAL_FUNC (cancel_pressed), &abort);
|
||||
gtk_widget_show (gd);
|
||||
#else
|
||||
if (verbose){
|
||||
d = message (D_INSERT, _(" Search "), _("Searching %s"), text);
|
||||
mc_refresh ();
|
||||
}
|
||||
#endif
|
||||
|
||||
found_len = view->found_len;
|
||||
search_start = view->search_start;
|
||||
|
@ -1584,15 +1549,11 @@ search (WView *view, char *text, int (*search)(WView *, char *, char *, int))
|
|||
break;
|
||||
}
|
||||
disable_interrupt_key ();
|
||||
#ifdef HAVE_GNOME
|
||||
gtk_object_destroy (GTK_OBJECT (gd));
|
||||
#else
|
||||
if (verbose){
|
||||
if (verbose) {
|
||||
dlg_run_done (d);
|
||||
destroy_dlg (d);
|
||||
}
|
||||
#endif
|
||||
if (!s){
|
||||
if (!s) {
|
||||
message (0, _(" Search "), _(" Search string not found "));
|
||||
view->found_len = 0;
|
||||
}
|
||||
|
@ -2271,7 +2232,6 @@ view_handle_key (WView *view, int c)
|
|||
view_move_forward (view, vheight - 1);
|
||||
return 1;
|
||||
|
||||
#ifndef HAVE_X
|
||||
case XCTRL('o'):
|
||||
view_other_cmd ();
|
||||
return 1;
|
||||
|
@ -2280,7 +2240,6 @@ view_handle_key (WView *view, int c)
|
|||
case '!':
|
||||
exec_shell ();
|
||||
return 1;
|
||||
#endif /* !HAVE_X */
|
||||
|
||||
case 'F':
|
||||
set_monitor (view, on);
|
||||
|
@ -2328,7 +2287,7 @@ view_handle_key (WView *view, int c)
|
|||
view->dirty++;
|
||||
view_update( view, TRUE );
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* HAVE_CHARSET */
|
||||
|
||||
}
|
||||
if (c >= '0' && c <= '9')
|
||||
|
@ -2393,7 +2352,6 @@ real_view_event (Gpm_Event *event, void *x)
|
|||
/* }}} */
|
||||
/* {{{ Window creation, destruction and a driver stub for real view */
|
||||
|
||||
#ifndef PORT_WANTS_VIEW
|
||||
static int
|
||||
view_mode_callback (struct Dlg_head *h, int id, int msg)
|
||||
{
|
||||
|
@ -2434,9 +2392,7 @@ view (char *_command, const char *_file, int *move_dir_p, int start_line)
|
|||
"view",
|
||||
DLG_NONE);
|
||||
|
||||
#ifndef HAVE_X
|
||||
view_dlg = our_dlg;
|
||||
#endif
|
||||
wview = view_new (0, 0, COLS, LINES-1, 0);
|
||||
|
||||
bar = buttonbar_new (1);
|
||||
|
@ -2461,7 +2417,6 @@ view (char *_command, const char *_file, int *move_dir_p, int start_line)
|
|||
|
||||
return !error;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
view_hook (void *v)
|
||||
|
|
33
src/view.h
33
src/view.h
|
@ -79,17 +79,6 @@ typedef struct {
|
|||
int marks [10]; /* 10 marks: 0..9 */
|
||||
|
||||
|
||||
#ifdef HAVE_X
|
||||
int current_x, current_y; /* Current x,y position */
|
||||
int color; /* Current color */
|
||||
void *gtk_fname; /* filename widget */
|
||||
void *gtk_offset; /* offset widget */
|
||||
void *gtk_bytes; /* bytes */
|
||||
void *gtk_flags; /* flags (growing) */
|
||||
void *gtk_percent; /* percent */
|
||||
void *sadj; /* scrollbar adjustment */
|
||||
#endif /* HAVE_X */
|
||||
|
||||
int move_dir; /* return value from widget:
|
||||
* 0 do nothing
|
||||
* -1 view previous file
|
||||
|
@ -157,23 +146,9 @@ struct hexedit_change_node {
|
|||
unsigned char value;
|
||||
};
|
||||
|
||||
#ifdef HAVE_X
|
||||
#ifdef WANT_WIDGETS
|
||||
void view_display_clean (WView *view, int h, int w);
|
||||
|
||||
void x_destroy_view (WView *);
|
||||
void x_create_viewer (WView *);
|
||||
void x_focus_view (WView *);
|
||||
void x_init_view (WView *);
|
||||
|
||||
void view_freeze (WView *view);
|
||||
void view_thaw (WView *view);
|
||||
#endif /* WANT_WIDGETS */
|
||||
#else
|
||||
# define x_init_view(x)
|
||||
# define x_destroy_view(x)
|
||||
# define x_create_viewer(x)
|
||||
# define x_focus_view(x)
|
||||
#endif /* !HAVE_X */
|
||||
#define x_init_view(x)
|
||||
#define x_destroy_view(x)
|
||||
#define x_create_viewer(x)
|
||||
#define x_focus_view(x)
|
||||
|
||||
#endif /* __VIEW_H */
|
||||
|
|
134
src/widget.c
134
src/widget.c
|
@ -66,9 +66,7 @@ int quote = 0;
|
|||
static int
|
||||
button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
char buf[BUF_SMALL];
|
||||
#endif
|
||||
int stop = 0;
|
||||
int off = 0;
|
||||
|
||||
|
@ -117,7 +115,6 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
|||
case WIDGET_UNFOCUS:
|
||||
case WIDGET_FOCUS:
|
||||
case WIDGET_DRAW:
|
||||
#ifndef HAVE_X
|
||||
if (Msg==WIDGET_UNFOCUS)
|
||||
b->selected = 0;
|
||||
else if (Msg==WIDGET_FOCUS)
|
||||
|
@ -153,7 +150,6 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
|||
widget_move (&b->widget, 0, b->hotpos+off);
|
||||
addch ((unsigned char)b->text [b->hotpos]);
|
||||
}
|
||||
#endif /* HAVE_X */
|
||||
if (Msg == WIDGET_FOCUS)
|
||||
break;
|
||||
else
|
||||
|
@ -166,7 +162,6 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
|||
static int
|
||||
button_event (Gpm_Event *event, WButton *b)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
if (event->type & (GPM_DOWN|GPM_UP)){
|
||||
Dlg_head *h=b->widget.parent;
|
||||
dlg_select_widget (h, b);
|
||||
|
@ -176,7 +171,6 @@ button_event (Gpm_Event *event, WButton *b)
|
|||
return MOU_NORMAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -190,7 +184,6 @@ button_destroy (WButton *b)
|
|||
static int
|
||||
button_len (const char *text, unsigned int flags)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
int ret = strlen (text);
|
||||
switch (flags){
|
||||
case DEFPUSH_BUTTON:
|
||||
|
@ -207,9 +200,6 @@ button_len (const char *text, unsigned int flags)
|
|||
return 0;
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
return strlen (text);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -261,11 +251,7 @@ button_set_text (WButton *b, char *text)
|
|||
b->text = g_strdup (text);
|
||||
b->widget.cols = button_len (text, b->flags);
|
||||
button_scan_hotkey(b);
|
||||
#ifdef HAVE_X
|
||||
x_button_set (b, b->text);
|
||||
#else
|
||||
dlg_redraw (b->widget.parent);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,9 +261,7 @@ static int radio_event (Gpm_Event *event, WRadio *r);
|
|||
static int
|
||||
radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
int i;
|
||||
#endif
|
||||
|
||||
switch (Msg) {
|
||||
case WIDGET_INIT:
|
||||
|
@ -331,14 +315,6 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||
}
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_X
|
||||
case WIDGET_FOCUS:
|
||||
case WIDGET_CURSOR:
|
||||
x_radio_focus_item (r);
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_X
|
||||
case WIDGET_CURSOR:
|
||||
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
||||
radio_callback (h, r, WIDGET_FOCUS, ' ');
|
||||
|
@ -369,7 +345,6 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||
}
|
||||
return 1;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
return default_proc (h, Msg, Par);
|
||||
}
|
||||
|
@ -377,7 +352,6 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||
static int
|
||||
radio_event (Gpm_Event *event, WRadio *r)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
if (event->type & (GPM_DOWN|GPM_UP)){
|
||||
Dlg_head *h = r->widget.parent;
|
||||
|
||||
|
@ -390,7 +364,6 @@ radio_event (Gpm_Event *event, WRadio *r)
|
|||
return MOU_NORMAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -450,7 +423,6 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
|||
check_callback (h, c, WIDGET_FOCUS, ' ');
|
||||
return 1;
|
||||
|
||||
#ifndef HAVE_X
|
||||
case WIDGET_CURSOR:
|
||||
widget_move (&c->widget, 0, 1);
|
||||
break;
|
||||
|
@ -468,7 +440,6 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
|||
addch ((unsigned char)c->text [c->hotpos]);
|
||||
}
|
||||
return 1;
|
||||
#endif /* !HAVE_X */
|
||||
}
|
||||
return default_proc (h, Msg, Par);
|
||||
}
|
||||
|
@ -476,7 +447,6 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
|||
static int
|
||||
check_event (Gpm_Event *event, WCheck *c)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
if (event->type & (GPM_DOWN|GPM_UP)){
|
||||
Dlg_head *h = c->widget.parent;
|
||||
|
||||
|
@ -488,7 +458,6 @@ check_event (Gpm_Event *event, WCheck *c)
|
|||
return MOU_NORMAL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -543,7 +512,6 @@ label_callback (Dlg_head *h, WLabel *l, int Msg, int Par)
|
|||
/* We don't want to get the focus */
|
||||
if (Msg == WIDGET_FOCUS)
|
||||
return 0;
|
||||
#ifndef HAVE_X
|
||||
if (Msg == WIDGET_DRAW && l->text){
|
||||
char *p = l->text, *q, c = 0;
|
||||
int y = 0;
|
||||
|
@ -572,7 +540,6 @@ label_callback (Dlg_head *h, WLabel *l, int Msg, int Par)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return default_proc (h, Msg, Par);
|
||||
}
|
||||
|
||||
|
@ -598,11 +565,8 @@ label_set_text (WLabel *label, char *text)
|
|||
label->text = 0;
|
||||
|
||||
if (label->widget.parent)
|
||||
#ifdef HAVE_X
|
||||
x_label_set_text (label, text);
|
||||
#else
|
||||
label_callback (label->widget.parent, label, WIDGET_DRAW, 0);
|
||||
#endif
|
||||
|
||||
if (newcols < label->widget.cols)
|
||||
label->widget.cols = newcols;
|
||||
}
|
||||
|
@ -654,7 +618,6 @@ gauge_callback (Dlg_head *h, WGauge *g, int Msg, int Par)
|
|||
if (Msg == WIDGET_FOCUS)
|
||||
return 0;
|
||||
|
||||
#ifndef HAVE_X
|
||||
if (Msg == WIDGET_DRAW){
|
||||
widget_move (&g->widget, 0, 0);
|
||||
attrset (NORMALC);
|
||||
|
@ -684,7 +647,6 @@ gauge_callback (Dlg_head *h, WGauge *g, int Msg, int Par)
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return default_proc (h, Msg, Par);
|
||||
}
|
||||
|
||||
|
@ -695,18 +657,10 @@ gauge_set_value (WGauge *g, int max, int current)
|
|||
return; /* Do not flicker */
|
||||
if (max == 0)
|
||||
max = 1; /* I do not like division by zero :) */
|
||||
#ifdef HAVE_X
|
||||
/* NOTE: x_gauge_set_value has to be called before we change actual
|
||||
* max and current values in g, since it assumes g->max and
|
||||
* g->current as the previous values and max and current
|
||||
* as the new ones :) */
|
||||
x_gauge_set_value (g, max, current);
|
||||
#endif
|
||||
|
||||
g->current = current;
|
||||
g->max = max;
|
||||
#ifndef HAVE_X
|
||||
gauge_callback (g->widget.parent, g, WIDGET_DRAW, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -715,11 +669,7 @@ gauge_show (WGauge *g, int shown)
|
|||
if (g->shown == shown)
|
||||
return;
|
||||
g->shown = shown;
|
||||
#ifdef HAVE_X
|
||||
x_gauge_show (g);
|
||||
#else
|
||||
gauge_callback (g->widget.parent, g, WIDGET_DRAW, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -762,7 +712,6 @@ gauge_new (int y, int x, int shown, int max, int current, char *tkname)
|
|||
#define should_show_history_button(in) \
|
||||
(in->history && in->field_len > HISTORY_BUTTON_WIDTH * 2 + 1 && in->widget.parent)
|
||||
|
||||
#ifndef HAVE_X
|
||||
static void draw_history_button (WInput * in)
|
||||
{
|
||||
char c;
|
||||
|
@ -789,7 +738,6 @@ static void draw_history_button (WInput * in)
|
|||
addch (c);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/* }}} history button */
|
||||
|
||||
|
@ -802,10 +750,8 @@ void
|
|||
update_input (WInput *in, int clear_first)
|
||||
{
|
||||
int has_history = 0;
|
||||
#ifndef HAVE_X
|
||||
int i, j;
|
||||
unsigned char c;
|
||||
#endif
|
||||
int buf_len = strlen (in->buffer);
|
||||
|
||||
if (should_show_history_button (in))
|
||||
|
@ -826,12 +772,6 @@ update_input (WInput *in, int clear_first)
|
|||
if (in->mark > buf_len)
|
||||
in->mark = buf_len;
|
||||
|
||||
#ifdef HAVE_X
|
||||
if (clear_first && in->first)
|
||||
in->first = -1;
|
||||
x_update_input (in);
|
||||
#else
|
||||
|
||||
if (has_history)
|
||||
draw_history_button (in);
|
||||
|
||||
|
@ -853,7 +793,6 @@ update_input (WInput *in, int clear_first)
|
|||
|
||||
if (clear_first)
|
||||
in->first = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -982,7 +921,6 @@ i18n_htitle (void)
|
|||
static int
|
||||
history_callback (Dlg_head * h, int Par, int Msg)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
switch (Msg) {
|
||||
case DLG_DRAW:
|
||||
attrset (COLOR_NORMAL);
|
||||
|
@ -993,7 +931,6 @@ history_callback (Dlg_head * h, int Par, int Msg)
|
|||
printw (i18n_htitle());
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1285,7 +1222,6 @@ backward_word (WInput *in)
|
|||
in->point = p - in->buffer;
|
||||
}
|
||||
|
||||
#ifndef HAVE_X
|
||||
static void
|
||||
key_left (WInput *in)
|
||||
{
|
||||
|
@ -1303,10 +1239,6 @@ key_right (WInput *in)
|
|||
else
|
||||
forward_char (in);
|
||||
}
|
||||
#else
|
||||
#define key_left backward_char
|
||||
#define key_right forward_char
|
||||
#endif /* HAVE_X */
|
||||
|
||||
static void
|
||||
backward_delete (WInput *in)
|
||||
|
@ -1552,16 +1484,6 @@ is_in_input_map (WInput *in, int c_code)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef PORT_WINPUT_DELETES_MARKED
|
||||
static void
|
||||
port_region_marked_for_delete (WInput *in)
|
||||
{
|
||||
if (in->first == 1 && (in->point == in->mark))
|
||||
in->point = strlen (in->buffer);
|
||||
kill_region (in);
|
||||
in->first = 0;
|
||||
}
|
||||
#else
|
||||
static void
|
||||
port_region_marked_for_delete (WInput *in)
|
||||
{
|
||||
|
@ -1569,7 +1491,6 @@ port_region_marked_for_delete (WInput *in)
|
|||
in->point = 0;
|
||||
in->first = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
handle_char (WInput *in, int c_code)
|
||||
|
@ -1645,7 +1566,6 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
|
|||
return x_create_input (h, h->wdata, in);
|
||||
|
||||
case WIDGET_KEY:
|
||||
#ifndef HAVE_X
|
||||
if (Par == XCTRL('q')){
|
||||
int v;
|
||||
|
||||
|
@ -1654,7 +1574,6 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
|
|||
quote = 0;
|
||||
return v;
|
||||
}
|
||||
#endif /* !HAVE_X */
|
||||
if (Par == KEY_UP || Par == KEY_DOWN ||
|
||||
Par == ESC_CHAR || Par == KEY_F(10) ||
|
||||
Par == XCTRL('g'))
|
||||
|
@ -1671,11 +1590,9 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
|
|||
case WIDGET_DRAW:
|
||||
update_input (in, 0);
|
||||
break;
|
||||
#ifndef HAVE_X
|
||||
case WIDGET_CURSOR:
|
||||
widget_move (&in->widget, 0, in->point - in->first_shown);
|
||||
return 1;
|
||||
#endif /* !HAVE_X */
|
||||
|
||||
}
|
||||
return default_proc (h, Msg, Par);
|
||||
|
@ -1686,7 +1603,6 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
|
|||
int
|
||||
input_event (Gpm_Event *event, WInput *in)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
if (event->type & (GPM_DOWN|GPM_DRAG)){
|
||||
dlg_select_widget (in->widget.parent, in);
|
||||
|
||||
|
@ -1701,7 +1617,6 @@ input_event (Gpm_Event *event, WInput *in)
|
|||
}
|
||||
update_input (in, 1);
|
||||
}
|
||||
#endif
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -1764,13 +1679,6 @@ input_new (int y, int x, int color, int len, const char *def_text, char *tkname)
|
|||
*/
|
||||
static int listbox_cdiff (WLEntry *s, WLEntry *e);
|
||||
|
||||
#ifdef HAVE_X
|
||||
static void
|
||||
listbox_draw (WListbox *l, Dlg_head *h, int focused)
|
||||
{
|
||||
/* nothing */
|
||||
}
|
||||
#else
|
||||
static void
|
||||
listbox_drawscroll (WListbox *l)
|
||||
{
|
||||
|
@ -1851,7 +1759,6 @@ listbox_draw (WListbox *l, Dlg_head *h, int focused)
|
|||
attrset (normalc);
|
||||
listbox_drawscroll (l);
|
||||
}
|
||||
#endif /* HAVE_X */
|
||||
|
||||
/* Returns the number of items between s and e,
|
||||
must be on the same linked list */
|
||||
|
@ -1911,13 +1818,6 @@ listbox_remove_list (WListbox *l)
|
|||
if (!l->count)
|
||||
return;
|
||||
|
||||
#ifdef HAVE_X
|
||||
if (l->widget.wdata != (widget_data) NULL) {
|
||||
int i;
|
||||
for (i = 0; i < l->count; i++)
|
||||
x_listbox_delete_nth (l, i);
|
||||
}
|
||||
#endif
|
||||
p = l->list;
|
||||
|
||||
while (l->count--) {
|
||||
|
@ -1943,19 +1843,7 @@ listbox_remove_current (WListbox *l, int force)
|
|||
/* Ok, note: this won't allow for emtpy lists */
|
||||
if (!force && (!l->count || l->count == 1))
|
||||
return;
|
||||
|
||||
#ifdef HAVE_X
|
||||
if (l->widget.wdata != (widget_data) NULL) {
|
||||
x_listbox_delete_nth (l, l->pos);
|
||||
if (l->count > 1) {
|
||||
if (l->current->next != l->list)
|
||||
x_listbox_select_nth (l, l->pos);
|
||||
else if (l->current != l->list)
|
||||
x_listbox_select_nth (l, l->pos - 1);
|
||||
} else
|
||||
x_listbox_select_nth (l, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
l->count--;
|
||||
p = l->current;
|
||||
|
||||
|
@ -2136,7 +2024,6 @@ listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
|
|||
listbox_draw (l, h, 1);
|
||||
return ret_code;
|
||||
|
||||
#ifndef HAVE_X
|
||||
case WIDGET_CURSOR:
|
||||
widget_move (&l->widget, l->cursor_y, 0);
|
||||
return 1;
|
||||
|
@ -2146,7 +2033,6 @@ listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
|
|||
case WIDGET_DRAW:
|
||||
listbox_draw (l, h, msg != WIDGET_UNFOCUS);
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
return default_proc (h, msg, par);
|
||||
}
|
||||
|
@ -2154,7 +2040,6 @@ listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
|
|||
static int
|
||||
listbox_event (Gpm_Event *event, WListbox *l)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
int i;
|
||||
|
||||
Dlg_head *h = l->widget.parent;
|
||||
|
@ -2208,7 +2093,6 @@ listbox_event (Gpm_Event *event, WListbox *l)
|
|||
return MOU_ENDLOOP;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -2376,7 +2260,6 @@ buttonbar_callback (Dlg_head *h, WButtonBar *bb, int msg, int par)
|
|||
}
|
||||
return 0;
|
||||
|
||||
#ifndef HAVE_X
|
||||
case WIDGET_DRAW:
|
||||
if (!bb->visible)
|
||||
return 1;
|
||||
|
@ -2394,7 +2277,6 @@ buttonbar_callback (Dlg_head *h, WButtonBar *bb, int msg, int par)
|
|||
}
|
||||
attrset (SELECTED_COLOR);
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
return default_proc (h, msg, par);
|
||||
}
|
||||
|
@ -2413,7 +2295,6 @@ buttonbar_destroy (WButtonBar *bb)
|
|||
static int
|
||||
buttonbar_event (Gpm_Event *event, WButtonBar *bb)
|
||||
{
|
||||
#ifndef HAVE_X
|
||||
int button;
|
||||
|
||||
if (!(event->type & GPM_UP))
|
||||
|
@ -2423,7 +2304,6 @@ buttonbar_event (Gpm_Event *event, WButtonBar *bb)
|
|||
button = event->x / 8;
|
||||
if (button < 10 && bb->labels [button].function)
|
||||
(*bb->labels [button].function)(bb->labels [button].data);
|
||||
#endif
|
||||
return MOU_NORMAL;
|
||||
}
|
||||
|
||||
|
@ -2495,12 +2375,6 @@ define_label (Dlg_head *h, Widget *paneletc, int idx, char *text, void (*cback)(
|
|||
define_label_data (h, paneletc, idx, text, (void (*)(void *)) cback, 0);
|
||||
}
|
||||
|
||||
#ifdef HAVE_X
|
||||
void redraw_labels (Dlg_head *h, Widget *paneletc)
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
void
|
||||
redraw_labels (Dlg_head *h, Widget *paneletc)
|
||||
{
|
||||
|
@ -2514,4 +2388,4 @@ redraw_labels (Dlg_head *h, Widget *paneletc)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
28
src/widget.h
28
src/widget.h
|
@ -32,9 +32,6 @@ typedef struct WRadio {
|
|||
int count; /* number of members */
|
||||
char **texts; /* texts of labels */
|
||||
int upper_letter_is_hotkey; /* If true, then the capital letter is a hk */
|
||||
#ifdef HAVE_GNOME
|
||||
void *first_gtk_radio;
|
||||
#endif
|
||||
} WRadio;
|
||||
|
||||
typedef struct WCheck {
|
||||
|
@ -217,29 +214,4 @@ void redraw_labels (Dlg_head *h, Widget *paneletc);
|
|||
WButtonBar *find_buttonbar (Dlg_head *h, Widget *paneletc);
|
||||
void buttonbar_hint (WButtonBar *bb, char *s);
|
||||
|
||||
#ifdef HAVE_X
|
||||
int x_create_radio (Dlg_head *h, widget_data parent, WRadio *r);
|
||||
int x_create_button (Dlg_head *h, widget_data parent, WButton *b);
|
||||
int x_create_check (Dlg_head *h, widget_data parent, WCheck *c);
|
||||
int x_create_label (Dlg_head *h, widget_data parent, WLabel *l);
|
||||
int x_create_input (Dlg_head *h, widget_data parent, WInput *in);
|
||||
int x_create_listbox (Dlg_head *h, widget_data parent, WListbox *l);
|
||||
int x_create_buttonbar (Dlg_head *h, widget_data parent, WButtonBar *bb);
|
||||
|
||||
void x_button_set (WButton *b, char *text);
|
||||
void x_label_set_text (WLabel *label, char *text);
|
||||
void x_listbox_select_nth (WListbox *l, int nth);
|
||||
void x_listbox_delete_nth (WListbox *l, int nth);
|
||||
void x_label_set_text (WLabel *label, char *text);
|
||||
int x_create_gauge (Dlg_head *h, widget_data parent, WGauge *g);
|
||||
void x_gauge_show (WGauge *g);
|
||||
void x_gauge_set_value (WGauge *g, int max, int current);
|
||||
void x_radio_toggle (WRadio *);
|
||||
void x_radio_focus_item (WRadio *radio);
|
||||
void x_listbox_select_nth (WListbox *, int);
|
||||
void x_list_insert (WListbox *, WLEntry *, WLEntry *);
|
||||
void x_redefine_label (WButtonBar *, int);
|
||||
void x_update_input (WInput *in);
|
||||
#endif
|
||||
|
||||
#endif /* __WIDGET_H */
|
||||
|
|
Loading…
Reference in New Issue