mirror of
https://github.com/MidnightCommander/mc
synced 2025-04-02 21:22:54 +03:00
1999-06-24 Norbert Warmuth <nwarmuth@privat.circular.de>
* gnome/gmc-chargrid.c (update_strip): Paint every character with the assigned fore and background color instead of using the colors of the first character for the whole line. 1999-06-24 smil@linuxfan.com * src/view.c (view_update_bytes_per_line, display): show correctly the offset of the file (full 8 digit), display offset in bold colour (view_labels): use goto_addr instead of goto_line in hex mode (goto_addr): New function. Goto offset address in hex mode. * src/view.h: use unsigned long for hexedit cursor position in file
This commit is contained in:
parent
0897355081
commit
4519b43ebc
@ -1,3 +1,9 @@
|
|||||||
|
1999-06-24 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||||
|
|
||||||
|
* gmc-chargrid.c (update_strip): Paint every character with the
|
||||||
|
assigned fore and background color instead of using the colors of
|
||||||
|
the first character for the whole line.
|
||||||
|
|
||||||
1999-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
1999-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||||
|
|
||||||
* gsession.c (create_default_panel): Use directory specified in
|
* gsession.c (create_default_panel): Use directory specified in
|
||||||
|
@ -275,13 +275,13 @@ update_strip (GmcCharGrid *cgrid, int x, int y, int width)
|
|||||||
while (i < width) {
|
while (i < width) {
|
||||||
first = i;
|
first = i;
|
||||||
ocolor = attrs[i].bg_set ? attrs[i].bg : GTK_WIDGET (cgrid)->style->bg[GTK_STATE_NORMAL].pixel;
|
ocolor = attrs[i].bg_set ? attrs[i].bg : GTK_WIDGET (cgrid)->style->bg[GTK_STATE_NORMAL].pixel;
|
||||||
color = ocolor;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
i++;
|
i++;
|
||||||
|
color = attrs[i].bg_set ? attrs[i].bg : GTK_WIDGET (cgrid)->style->bg[GTK_STATE_NORMAL].pixel;
|
||||||
} while ((i < width) && (color == ocolor));
|
} while ((i < width) && (color == ocolor));
|
||||||
|
|
||||||
gcolor.pixel = color;
|
gcolor.pixel = ocolor;
|
||||||
gdk_gc_set_foreground (cgrid->gc, &gcolor);
|
gdk_gc_set_foreground (cgrid->gc, &gcolor);
|
||||||
|
|
||||||
gdk_draw_rectangle (cgrid->widget.window,
|
gdk_draw_rectangle (cgrid->widget.window,
|
||||||
@ -300,13 +300,13 @@ update_strip (GmcCharGrid *cgrid, int x, int y, int width)
|
|||||||
while (i < width) {
|
while (i < width) {
|
||||||
first = i;
|
first = i;
|
||||||
ocolor = attrs[i].fg_set ? attrs[i].fg : GTK_WIDGET (cgrid)->style->fg[GTK_STATE_NORMAL].pixel;
|
ocolor = attrs[i].fg_set ? attrs[i].fg : GTK_WIDGET (cgrid)->style->fg[GTK_STATE_NORMAL].pixel;
|
||||||
color = ocolor;
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
i++;
|
i++;
|
||||||
|
color = attrs[i].fg_set ? attrs[i].fg : GTK_WIDGET (cgrid)->style->fg[GTK_STATE_NORMAL].pixel;
|
||||||
} while ((i < width) && (color == ocolor));
|
} while ((i < width) && (color == ocolor));
|
||||||
|
|
||||||
gcolor.pixel = color;
|
gcolor.pixel = ocolor;
|
||||||
gdk_gc_set_foreground (cgrid->gc, &gcolor);
|
gdk_gc_set_foreground (cgrid->gc, &gcolor);
|
||||||
|
|
||||||
gdk_draw_text (cgrid->widget.window,
|
gdk_draw_text (cgrid->widget.window,
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
1999-06-24 smil@linuxfan.com
|
||||||
|
|
||||||
|
* view.c (view_update_bytes_per_line, display): show correctly the
|
||||||
|
offset of the file (full 8 digit), display offset in bold colour
|
||||||
|
|
||||||
|
(view_labels): use goto_addr instead of goto_line in hex mode
|
||||||
|
|
||||||
|
(goto_addr): New function. Goto offset address in hex mode.
|
||||||
|
|
||||||
|
* view.h: use unsigned long for hexedit cursor position in file
|
||||||
|
|
||||||
1999-06-24 Norbert Warmuth <nwarmuth@privat.circular.de>
|
1999-06-24 Norbert Warmuth <nwarmuth@privat.circular.de>
|
||||||
|
|
||||||
* menu.c (menubar_execute): Now needs an additional do_refresh in order
|
* menu.c (menubar_execute): Now needs an additional do_refresh in order
|
||||||
|
41
src/view.c
41
src/view.c
@ -650,7 +650,7 @@ view_update_bytes_per_line(WView *view)
|
|||||||
cols = view->widget.cols;
|
cols = view->widget.cols;
|
||||||
|
|
||||||
view->bottom_first = -1;
|
view->bottom_first = -1;
|
||||||
view->bytes_per_line = 2 * (cols - 7) / 9;
|
view->bytes_per_line = 2 * (cols - 8) / 9;
|
||||||
view->bytes_per_line &= 0xfffc;
|
view->bytes_per_line &= 0xfffc;
|
||||||
|
|
||||||
if (view->bytes_per_line == 0)
|
if (view->bytes_per_line == 0)
|
||||||
@ -876,12 +876,14 @@ display (WView *view)
|
|||||||
|
|
||||||
for (;row < height && from < view->last_byte; row++){
|
for (;row < height && from < view->last_byte; row++){
|
||||||
/* Print the hex offset */
|
/* Print the hex offset */
|
||||||
g_snprintf (hex_buff, sizeof (hex_buff), "%05X", (int) (from - view->first));
|
view_set_color (view, BOLD_COLOR);
|
||||||
|
g_snprintf (hex_buff, sizeof (hex_buff), "%08X", (int) (from - view->first));
|
||||||
view_gotoyx (view, row, frame_shift);
|
view_gotoyx (view, row, frame_shift);
|
||||||
view_add_string (view, hex_buff);
|
view_add_string (view, hex_buff);
|
||||||
|
view_set_color (view, DEF_COLOR);
|
||||||
|
|
||||||
/* Hex dump starts from column seven */
|
/* Hex dump starts from column nine */
|
||||||
col = 7;
|
col = 9;
|
||||||
|
|
||||||
/* Each hex number is two digits */
|
/* Each hex number is two digits */
|
||||||
hex_buff[2] = 0;
|
hex_buff[2] = 0;
|
||||||
@ -1893,7 +1895,7 @@ toggle_hex_mode (WView *view)
|
|||||||
view_update (view, TRUE);
|
view_update (view, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Both views */
|
/* Ascii view */
|
||||||
void
|
void
|
||||||
goto_line (WView *view)
|
goto_line (WView *view)
|
||||||
{
|
{
|
||||||
@ -1921,6 +1923,31 @@ goto_line (WView *view)
|
|||||||
view_update (view, TRUE);
|
view_update (view, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Hex view */
|
||||||
|
void
|
||||||
|
goto_addr (WView *view)
|
||||||
|
{
|
||||||
|
char *line, *error, prompt [BUF_SMALL];
|
||||||
|
unsigned long addr;
|
||||||
|
|
||||||
|
g_snprintf (prompt, sizeof (prompt), _(" The current address is 0x%lx.\n"
|
||||||
|
" Enter the new address:"), view->edit_cursor);
|
||||||
|
line = input_dialog (_(" Goto Address "), prompt, "");
|
||||||
|
if (line){
|
||||||
|
if (*line) {
|
||||||
|
addr = strtol (line, &error, 0);
|
||||||
|
if ((*error == '\0') && (addr <= view->last_byte)) {
|
||||||
|
move_to_top (view);
|
||||||
|
view_move_forward (view, addr/view->bytes_per_line);
|
||||||
|
view->edit_cursor = addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g_free (line);
|
||||||
|
}
|
||||||
|
view->dirty++;
|
||||||
|
view_update (view, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/* Both views */
|
/* Both views */
|
||||||
static void
|
static void
|
||||||
regexp_search (WView *view, int direction)
|
regexp_search (WView *view, int direction)
|
||||||
@ -2042,7 +2069,9 @@ view_labels (WView *view)
|
|||||||
|
|
||||||
my_define (h, 10, _("Quit"), view_quit_cmd, view);
|
my_define (h, 10, _("Quit"), view_quit_cmd, view);
|
||||||
my_define (h, 4, view->hex_mode ? _("Ascii"): _("Hex"), toggle_hex_mode, view);
|
my_define (h, 4, view->hex_mode ? _("Ascii"): _("Hex"), toggle_hex_mode, view);
|
||||||
my_define (h, 5, _("Line"), goto_line, view);
|
my_define (h, 5, view->hex_mode ? _("Goto") : _("Line"),
|
||||||
|
view->hex_mode ? goto_addr : goto_line,
|
||||||
|
view);
|
||||||
my_define (h, 6, view->hex_mode ? _("Save") : _("RxSrch"), regexp_search_cmd, view);
|
my_define (h, 6, view->hex_mode ? _("Save") : _("RxSrch"), regexp_search_cmd, view);
|
||||||
|
|
||||||
my_define (h, 2, view->hex_mode ? view->hexedit_mode ?
|
my_define (h, 2, view->hex_mode ? view->hexedit_mode ?
|
||||||
|
@ -39,7 +39,7 @@ typedef struct {
|
|||||||
/* For the case of WINCH we should reset it to -1 */
|
/* For the case of WINCH we should reset it to -1 */
|
||||||
unsigned long start_display;/* First char displayed */
|
unsigned long start_display;/* First char displayed */
|
||||||
int start_col; /* First displayed column, negative */
|
int start_col; /* First displayed column, negative */
|
||||||
unsigned int edit_cursor; /* HexEdit cursor position in file */
|
unsigned long edit_cursor; /* HexEdit cursor position in file */
|
||||||
char hexedit_mode; /* Hexidecimal editing mode flag */
|
char hexedit_mode; /* Hexidecimal editing mode flag */
|
||||||
char nib_shift; /* A flag for inserting nibbles into bytes */
|
char nib_shift; /* A flag for inserting nibbles into bytes */
|
||||||
enum ViewSide view_side; /* A flag for the active editing panel */
|
enum ViewSide view_side; /* A flag for the active editing panel */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user