#include "view-file-icon.h"
#include <cstring>
+#include <utility>
#include <glib-object.h>
#include "utilops.h"
#include "view-file.h"
+namespace
+{
+
/* between these, the icon width is increased by thumb_max_width / 2 */
-enum {
- THUMB_MIN_ICON_WIDTH = 128,
- THUMB_MAX_ICON_WIDTH = 160
-};
-#define THUMB_MIN_ICON_WIDTH_WITH_MARKS TOGGLE_SPACING * FILEDATA_MARKS_SIZE
+constexpr gint THUMB_MIN_ICON_WIDTH = 128;
+constexpr gint THUMB_MAX_ICON_WIDTH = 160;
-enum {
- VFICON_MAX_COLUMNS = 32,
- THUMB_BORDER_PADDING = 2
-};
+constexpr gint THUMB_MIN_ICON_WIDTH_WITH_MARKS = TOGGLE_SPACING * FILEDATA_MARKS_SIZE;
-enum {
- VFICON_TIP_DELAY = 500
-};
+constexpr gint VFICON_MAX_COLUMNS = 32;
+
+constexpr gint THUMB_BORDER_PADDING = 2;
+
+constexpr gint VFICON_TIP_DELAY = 500;
enum {
- FILE_COLUMN_POINTER = 0,
+ FILE_COLUMN_POINTER = VIEW_FILE_COLUMN_POINTER,
FILE_COLUMN_COUNT
};
+struct ColumnData
+{
+ ViewFile *vf;
+ gint number;
+};
+
+} // namespace
+
static void vficon_toggle_filenames(ViewFile *vf);
static void vficon_selection_remove(ViewFile *vf, FileData *fd, SelectionType mask, GtkTreeIter *iter);
static void vficon_move_focus(ViewFile *vf, gint row, gint col, gboolean relative);
gint col1;
gint row2;
gint col2;
- gint t;
gint i;
gint j;
if (g_list_index(vf->list, start) > g_list_index(vf->list, end))
{
- FileData *tmp = start;
- start = end;
- end = tmp;
+ std::swap(start, end);
}
work = g_list_find(vf->list, start);
// rectangular_selection==true.
if (row2 < row1)
{
- t = row1;
- row1 = row2;
- row2 = t;
+ std::swap(row1, row2);
}
if (col2 < col1)
{
- t = col1;
- col1 = col2;
- col2 = t;
+ std::swap(col1, col2);
}
DEBUG_1("table: %d x %d to %d x %d", row1, col1, row2, col2);
GList *work;
FileData *visible_fd = nullptr;
gint r;
- gint c;
gboolean valid;
GtkTreeIter iter;
}
r = -1;
- c = 0;
valid = gtk_tree_model_iter_children(store, &iter, nullptr);
{
GList *list;
r++;
- c = 0;
if (valid)
{
gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &list, -1);
{
fd = static_cast<FileData *>(work->data);
work = work->next;
- c++;
}
else
{
*-----------------------------------------------------------------------------
*/
-struct ColumnData
-{
- ViewFile *vf;
- gint number;
-};
-
static void vficon_cell_data_cb(GtkTreeViewColumn *, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{