Commit Graph

2098 Commits

Author SHA1 Message Date
Roland Illig
26c2f7fc50 * view.c (save_edit_changes): Renamed to
view_hexedit_save_changes().
2005-04-18 20:12:18 +00:00
Roland Illig
f6f90ed34f * view.c (struct WView): Moved the growing buffer variables
between the data source and the display section.
2005-04-18 20:06:16 +00:00
Roland Illig
aae5612581 * view.c (view_set_datasource_string): Removed call to
view_close_datasource() for consistency with the other
	view_set_datasource_*() functions. Adjusted the callers.
2005-04-17 11:40:26 +00:00
Roland Illig
18325716b1 * view.c (display): Renamed frame_shift to left or top, whatever
is more appropriate.
2005-04-17 11:35:31 +00:00
Roland Illig
0dc31ebb6c * view.c (display): Renamed width and height to right and bottom.
The values of the variables aren't really the width and height
	of anything.
2005-04-17 11:21:54 +00:00
Roland Illig
56ea657694 * view.c (display): Simplified the ruler drawing code. 2005-04-17 11:05:42 +00:00
Roland Illig
093f7a679a * ChangeLog: Added the rest of the log message. 2005-04-17 10:15:32 +00:00
Roland Illig
054e617e9b * view.c: Added four functions view_get_top(), view_get_left(),
view_get_bottom(), view_get_right() to mark the bounds of the
	rectangle that can be used for displaying data. Expressed
	view_get_datalines() and view_get_datacolumns() in terms of
	these four functions.
2005-04-17 10:14:18 +00:00
Roland Illig
46a8f2bdc5 * view.c: Corrected some typos and indentation. 2005-04-17 10:02:58 +00:00
Roland Illig
76c3ff06a5 * view.c: Eliminated some ?: operators. 2005-04-17 09:50:38 +00:00
Roland Illig
98240f77bd * view.c (view_load): Changed return type to gboolean. Adjusted
returned values.
	* view.c (view): Rewrote the code a little bit.
	* view.h (view): Rewrote the comment.
2005-04-17 09:35:41 +00:00
Roland Illig
74318e44bb * view.c (save_edit_changes): Changed return type to gboolean.
* view.c (view_ok_to_quit): Changed return type to gboolean.
	Adjusted returned values.
2005-04-17 09:17:58 +00:00
Roland Illig
3c872a532c * view.c (save_edit_changes): Completely rewritten to be robust
on errors. All changed bytes that could not be saved are kept
	in the change list, so that the user can try to save them later.
	* view.c (view_set_byte): Added for save_edit_changes().
	* view.c (display): view_place_cursor() is called after displaying
	in hex mode.
2005-04-17 09:05:42 +00:00
Roland Illig
3cdf8bf168 * view.c (free_change_list): Don't use view->change_list as
scratch variable.
2005-04-16 22:06:53 +00:00
Roland Illig
7456a7c035 * view.c (enqueue_change): Rewrote the function once more, this
time eliminating the redundant variable `curr'. Introduced
	another variable, as it was inappropriate to reuse the `head'
	variable as a list iterator.
2005-04-16 22:01:48 +00:00
Roland Illig
9e5c41008d * view.c (enqueue_change): Combined the while loop with the break.
Fixed an off-by-one-error.
2005-04-16 21:49:48 +00:00
Roland Illig
d2f7ec86c4 * view.c (enqueue_change): Made the algorithm independent of the
memory layout (especially the order) of the fields in struct
	hexedit_change_node.
2005-04-16 21:47:26 +00:00
Roland Illig
0453262b4b * view.c (enqueue_change): Made the algorithm independent of the
memory layout (especially the order) of the fields in struct
	hexedit_change_node.
2005-04-16 21:45:36 +00:00
Roland Illig
2d8721c745 * view.c (display): Removed the call to the empty macros
view_freeze() and view_thaw(). Deleted these macros, as they
	are otherwise unused.
2005-04-16 18:56:58 +00:00
Roland Illig
021e1cb48e * view.c (view_get_datacolumns): Added. Replaced equivalent
expressions to call this function.
	* view.c (display): Fixed a bug introduced with the last change.
2005-04-16 18:53:51 +00:00
Roland Illig
d51fac0d75 * view.c (vwidth, vheight): Replaced these two macros with their
expansion. They looked like variables, which was irritating.
2005-04-16 18:32:09 +00:00
Roland Illig
0384ebe60c * view.c: Added the `byte' type as an alias for unsigned char.
Converted some datasources to using byte as the base type.
	Removed the superfluous type conversions.
2005-04-16 15:13:20 +00:00
Roland Illig
8ce21c781b * view.c (struct WView): Renamed start_display to dpy_text_start.
Fixed one invalid use of bit arithmetics (line 1819).
2005-04-16 14:52:36 +00:00
Roland Illig
dc97c493c5 * view.c (struct WView): Removed start_col. Added
dpy_text_start_col, which has a similar function like start_col,
	but does not have negative values. Added bounds checking for
	dpy_text_start_col. Code cleanup, as usual.
2005-04-16 14:25:52 +00:00
Roland Illig
e4635efd2d * view.c (struct WView): Renamed have_frame to dpy_frame_size.
* view.c (view_is_in_panel): Added.
	* view.c (view_percent): Removed the last parameter, as it has
	always the same value.
	* view.c: Code cleanup.
2005-04-16 13:45:16 +00:00
Roland Illig
e7b7360f79 * view.c (struct WView): Aligned all datasource fields so that they
look more related than before.
2005-04-16 12:56:50 +00:00
Roland Illig
081dd56e8c * layout.c: Followed the renaming of view_init() to view_load().
* view.h: Likewise.
2005-04-14 18:24:02 +00:00
Roland Illig
14a8919772 * util.h (str_unconst): Added a conditional INLINE_STR_UNCONST
that makes str_unconst() an inline function.
2005-04-14 18:16:04 +00:00
Roland Illig
3db06a9dd2 * view.c (struct WView): Renamed ds_file_size to ds_file_filesize,
to avoid confusion with ds_file_datasize.
2005-04-14 11:31:05 +00:00
Roland Illig
b3913aa39f * view.c (struct WView): Renamed growing_buffer to growbuf_in_use,
blocks to growbuf_blocks, block_ptr to growbuf_blockptr.
2005-04-14 11:27:13 +00:00
Roland Illig
a44dbeab65 * view.c (struct WView): Renamed wrap_mode to text_wrap_mode, as
it only applies to the text viewer.
2005-04-14 11:14:42 +00:00
Roland Illig
c2c7cfe647 * view.c (struct WView): Renamed viewer_magic_flag to magic_mode. 2005-04-14 11:12:01 +00:00
Roland Illig
fe6cf255d2 * view.c (struct WView): Moved hexedit_mode into the "Editor
modes" section.
2005-04-14 11:08:25 +00:00
Roland Illig
4dcd4b8da2 * view.c (struct WView): Renamed viewer_nroff_flag to
text_nroff_mode.
2005-04-14 11:06:12 +00:00
Roland Illig
2b41552c06 * view.c (struct WView): Changed the type of hex_mode to gboolean.
Fixed one non-boolean operation in toggle_wrap_mode().
2005-04-14 11:02:21 +00:00
Roland Illig
f468578ff7 * view.c (struct WView): Renamed hexedit_text to hexview_in_text. 2005-04-14 10:59:02 +00:00
Roland Illig
c1860072d7 * view.c (struct WView): Removed the "first" field, as it was
always 0.
2005-04-14 09:18:28 +00:00
Roland Illig
366dc2ce75 * view.c: Removed the "file monitor" feature (tail -f). It has
not been working since at least mc-4.6.0.
2005-04-14 09:09:34 +00:00
Roland Illig
bea9efb0f2 * view.c (view_new): Don't use view_init_growbuf, as this function
also activates it. Rather set view->growing_buffer = FALSE.
2005-04-14 08:35:56 +00:00
Roland Illig
d994002e5f * view.c (struct WView): Removed the view_active field. It was
practically equivalent to view->datasource != DS_NONE.
	* view.c (do_view_init): Renamed to view_load().
	* view.c (view_new): Every field of the WView is initialized
	explicitly.
2005-04-14 08:00:14 +00:00
Roland Illig
502309b4fa * view.c (view_get_datalines): Using the STATUS_LINE constant.
* view.c (display): Using the OFFSETTYPE_PRIX constant to print
	an offset_type in uppercase hex letters.
2005-04-14 00:59:33 +00:00
Roland Illig
d3bf9a489f * view.c (display): Fixed a bug that I introduced some hours ago.
* view.c (view_move_forward2): Rewrote the hexmode algorithm to
	get rid of the ?: operators. Introduced some variables with names
	that better fit their actual use. Fixed a bug that appeared when
	scrolling down by single lines in framed (panel) mode.
2005-04-14 00:43:34 +00:00
Roland Illig
9eff3cef04 * view.c (view_move_forward2): Backed out my last changes. The old
code worked better. :)
2005-04-14 00:18:35 +00:00
Roland Illig
ac03019408 * view.c (view_move_forward2): Added missing declaration. 2005-04-13 22:21:13 +00:00
Roland Illig
e65531ce4e * view.c: Reformatted the header comment. 2005-04-13 22:19:52 +00:00
Roland Illig
0b2f50aad4 * view.c (view_move_forward2): Simplified the code.
* view.c (get_byte_growing_buffer): Added bounds checking.
2005-04-13 22:18:04 +00:00
Roland Illig
ca1fc0467d * view.c (view_handle_editkey): Simplified the code. 2005-04-13 21:34:57 +00:00
Roland Illig
1a26500862 * view.c (struct WView): Removed the last_byte field, because it
got too complex maintaining it together with the new datasource
	framework. The function view_get_filesize() now takes its place.
	Corrected the type of the growing buffer to unsigned char. Added
	a field growbuf_finished to indicate when all data has been read.
	* view.c (view_move_cursor_to_eol): Renamed to
	view_hexview_move_to_eol().
	* view.c (view_get_filesize): Added.
	* view.c (view_get_filesize_with_exact): Added.
	* view.c (get_byte_indexed): get_byte with bounds checking.
	* view.c (view_growbuf_read_until): Closes the datasource after
	reading has finished.
	* view.c (view_percent): The percentage is only shown when its
	exact value can be computed.
	* view.c (view_status): The [grow] field has been removed from
	the status line. Instead, the filesize is reported as ">= n"
	bytes.
	* view.c (count_backspaces): Added a bounds check.
	* view.c (display): Using get_byte_indexed instead of get_byte.
	* view.c (move_forward2): Renamed to view_move_forward2 because
	of the equally-named function in src/help.c. Replaced the
	algorithm for the hexview mode by a much simpler version. Now
	we have 5 ?: operators less than before.
	* view.c (get_bottom_first): Added bounds checking.
	* view.c (move_right): Simplified the code.
	* view.c (goto_addr): Fixed an off-by-one error.
	* view.c (view_close_datasource): For the growing buffer cases,
	check if the datasource has already been closed before.
2005-04-13 21:09:00 +00:00
Roland Illig
a3a1e26210 * util.h (str_unconst): Provide a replacement for the const_cast
macro from global.h.
	* util.c (str_unconst): Likewise.
2005-04-13 18:47:12 +00:00
Roland Illig
293d35daf0 * view.c: Removed mmap(2) support. Now regular files are
accessed using mc_read(). Added a framework for datasources.
	Introduced assertions. Removed some variables (e.g. view->data)
	that were used for many things simultaneously.
2005-04-07 11:23:53 +00:00