[gnome-commander] TextRender: more C++ rework
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] TextRender: more C++ rework
- Date: Thu, 28 Jul 2011 19:15:23 +0000 (UTC)
commit 2d9afd9d89ebe870a1f11c8acb0b09099dbafc43
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Thu Jul 28 21:12:32 2011 +0200
TextRender: more C++ rework
src/intviewer/text-render.cc | 24 ++++++++++++------------
src/intviewer/text-render.h | 16 ++++++++--------
src/intviewer/viewer-widget.cc | 6 +++---
3 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/src/intviewer/text-render.cc b/src/intviewer/text-render.cc
index c65b968..b4e4734 100644
--- a/src/intviewer/text-render.cc
+++ b/src/intviewer/text-render.cc
@@ -103,7 +103,7 @@ struct TextRender::Private
int max_column;
offset_type current_offset;
offset_type last_displayed_offset;
- TEXTDISPLAYMODE dispmode;
+ DISPLAYMODE dispmode;
gboolean hex_offset_display;
gchar *fixed_font_name;
@@ -231,7 +231,7 @@ static void text_render_init (TextRender *w)
w->priv = g_new0 (TextRender::Private, 1);
w->priv->button = 0;
- w->priv->dispmode = TR_DISP_MODE_TEXT;
+ w->priv->dispmode = TextRender::DISPLAYMODE_TEXT;
w->priv->h_adjustment = NULL;
w->priv->old_h_adj_value = 0.0;
w->priv->old_h_adj_lower = 0.0;
@@ -860,7 +860,7 @@ static void text_render_internal_load(TextRender *w)
gv_set_fixed_count(w->priv->dp, w->priv->fixed_limit);
gv_set_tab_size(w->priv->dp, w->priv->tab_size);
- text_render_set_display_mode (w, TR_DISP_MODE_TEXT);
+ text_render_set_display_mode (w, TextRender::DISPLAYMODE_TEXT);
text_render_update_adjustments_limits(w);
}
@@ -1174,7 +1174,7 @@ static int text_render_utf8_print_char(TextRender *w, char_type value)
}
-void text_render_set_display_mode (TextRender *w, TEXTDISPLAYMODE mode)
+void text_render_set_display_mode (TextRender *w, TextRender::DISPLAYMODE mode)
{
g_return_if_fail (IS_TEXT_RENDER (w));
g_return_if_fail (w->priv->fops!=NULL);
@@ -1188,7 +1188,7 @@ void text_render_set_display_mode (TextRender *w, TEXTDISPLAYMODE mode)
switch (mode)
{
- case TR_DISP_MODE_TEXT:
+ case TextRender::DISPLAYMODE_TEXT:
gv_set_data_presentation_mode(w->priv->dp, w->priv->wrapmode ? PRSNT_WRAP : PRSNT_NO_WRAP);
w->priv->display_line = text_mode_display_line;
@@ -1196,7 +1196,7 @@ void text_render_set_display_mode (TextRender *w, TEXTDISPLAYMODE mode)
w->priv->copy_to_clipboard = text_mode_copy_to_clipboard;
break;
- case TR_DISP_MODE_BINARY:
+ case TextRender::DISPLAYMODE_BINARY:
// Binary display mode doesn't support UTF8
// TODO: switch back to the previous encoding, not just ASCII
@@ -1210,7 +1210,7 @@ void text_render_set_display_mode (TextRender *w, TEXTDISPLAYMODE mode)
w->priv->copy_to_clipboard = text_mode_copy_to_clipboard;
break;
- case TR_DISP_MODE_HEXDUMP:
+ case TextRender::DISPLAYMODE_HEXDUMP:
// HEX display mode doesn't support UTF8
// TODO: switch back to the previous encoding, not just ASCII
@@ -1233,9 +1233,9 @@ void text_render_set_display_mode (TextRender *w, TEXTDISPLAYMODE mode)
}
-TEXTDISPLAYMODE text_render_get_display_mode(TextRender *w)
+TextRender::DISPLAYMODE text_render_get_display_mode(TextRender *w)
{
- g_return_val_if_fail (IS_TEXT_RENDER (w), TR_DISP_MODE_TEXT);
+ g_return_val_if_fail (IS_TEXT_RENDER (w), TextRender::DISPLAYMODE_TEXT);
return w->priv->dispmode;
}
@@ -1302,7 +1302,7 @@ void text_render_set_wrap_mode(TextRender *w, gboolean ACTIVE)
return;
w->priv->wrapmode = ACTIVE;
- if (w->priv->dispmode==TR_DISP_MODE_TEXT)
+ if (w->priv->dispmode==TextRender::DISPLAYMODE_TEXT)
{
w->priv->column = 0;
gv_set_data_presentation_mode(w->priv->dp, w->priv->wrapmode ? PRSNT_WRAP : PRSNT_NO_WRAP);
@@ -1328,7 +1328,7 @@ void text_render_set_fixed_limit(TextRender *w, int fixed_limit)
w->priv->fixed_limit = fixed_limit;
// always 16 bytes in hex dump
- if (w->priv->dispmode==TR_DISP_MODE_HEXDUMP)
+ if (w->priv->dispmode==TextRender::DISPLAYMODE_HEXDUMP)
fixed_limit = HEXDUMP_FIXED_LIMIT;
if (w->priv->dp)
@@ -1396,7 +1396,7 @@ void text_render_set_encoding(TextRender *w, const char *encoding)
// Ugly hack: UTF-8 is not acceptable encoding in Binary/Hexdump modes
if (g_ascii_strcasecmp (encoding, "UTF8")==0 && (
- w->priv->dispmode==TR_DISP_MODE_BINARY || w->priv->dispmode==TR_DISP_MODE_HEXDUMP))
+ w->priv->dispmode==TextRender::DISPLAYMODE_BINARY || w->priv->dispmode==TextRender::DISPLAYMODE_HEXDUMP))
{
g_warning ("Can't set UTF8 encoding when in Binary or HexDump display mode");
return;
diff --git a/src/intviewer/text-render.h b/src/intviewer/text-render.h
index d1dd3ec..a5aa7f5 100644
--- a/src/intviewer/text-render.h
+++ b/src/intviewer/text-render.h
@@ -52,13 +52,13 @@ struct TextRender
const char *encoding;
gboolean wrap_mode;
};
-};
-enum TEXTDISPLAYMODE
-{
- TR_DISP_MODE_TEXT,
- TR_DISP_MODE_BINARY,
- TR_DISP_MODE_HEXDUMP
+ enum DISPLAYMODE
+ {
+ DISPLAYMODE_TEXT,
+ DISPLAYMODE_BINARY,
+ DISPLAYMODE_HEXDUMP
+ };
};
inline GtkWidget *text_render_new ()
@@ -78,8 +78,8 @@ void text_render_load_filedesc(TextRender *w, int filedesc);
void text_render_notify_status_changed(TextRender *w);
-void text_render_set_display_mode (TextRender *w, TEXTDISPLAYMODE mode);
-TEXTDISPLAYMODE text_render_get_display_mode(TextRender *w);
+void text_render_set_display_mode (TextRender *w, TextRender::DISPLAYMODE mode);
+TextRender::DISPLAYMODE text_render_get_display_mode(TextRender *w);
ViewerFileOps *text_render_get_file_ops(TextRender *w);
GVInputModesData *text_render_get_input_mode_data(TextRender *w);
diff --git a/src/intviewer/viewer-widget.cc b/src/intviewer/viewer-widget.cc
index 57219f1..6f2b81f 100644
--- a/src/intviewer/viewer-widget.cc
+++ b/src/intviewer/viewer-widget.cc
@@ -364,17 +364,17 @@ void gviewer_set_display_mode(GViewer *obj, VIEWERDISPLAYMODE mode)
{
case DISP_MODE_TEXT_FIXED:
client = obj->priv->tscrollbox;
- text_render_set_display_mode (obj->priv->textr, TR_DISP_MODE_TEXT);
+ text_render_set_display_mode (obj->priv->textr, TextRender::DISPLAYMODE_TEXT);
break;
case DISP_MODE_BINARY:
client = obj->priv->tscrollbox;
- text_render_set_display_mode (obj->priv->textr, TR_DISP_MODE_BINARY);
+ text_render_set_display_mode (obj->priv->textr, TextRender::DISPLAYMODE_BINARY);
break;
case DISP_MODE_HEXDUMP:
client = obj->priv->tscrollbox;
- text_render_set_display_mode (obj->priv->textr, TR_DISP_MODE_HEXDUMP);
+ text_render_set_display_mode (obj->priv->textr, TextRender::DISPLAYMODE_HEXDUMP);
break;
case DISP_MODE_IMAGE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]