Simplify related functions.
-void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height)
+void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height)
{
GList *list;
GList *work;
{
GList *list;
GList *work;
end_month = pan_date_value(fd->date, PAN_DATE_LENGTH_MONTH);
}
end_month = pan_date_value(fd->date, PAN_DATE_LENGTH_MONTH);
}
- *width = PAN_BOX_BORDER * 2;
- *height = PAN_BOX_BORDER * 2;
+ width = PAN_BOX_BORDER * 2;
+ height = PAN_BOX_BORDER * 2;
x = PAN_BOX_BORDER;
y = PAN_BOX_BORDER;
x = PAN_BOX_BORDER;
y = PAN_BOX_BORDER;
- *width += grid;
- *height = MAX(*height, grid + PAN_BOX_BORDER * 2 * 2);
+ width += grid;
+ height = MAX(height, grid + PAN_BOX_BORDER * 2 * 2);
struct PanWindow;
void pan_calendar_update(PanWindow *pw, PanItem *pi_day);
struct PanWindow;
void pan_calendar_update(PanWindow *pw, PanItem *pi_day);
-void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
+void pan_calendar_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height);
#include <cmath>
#include "filedata.h"
#include <cmath>
#include "filedata.h"
#include "pan-view-filter.h"
#include "typedefs.h"
#include "pan-view-filter.h"
#include "typedefs.h"
-static void pan_flower_size(PanWindow *pw, gint *width, gint *height)
+static void pan_flower_size(PanWindow *pw, gint &width, gint &height)
- if (width) *width = x2 - x1;
- if (height) *height = y2 - y1;
+ width = x2 - x1;
+ height = y2 - y1;
}
void pan_flower_compute(PanWindow *pw, FileData *dir_fd,
}
void pan_flower_compute(PanWindow *pw, FileData *dir_fd,
- gint *width, gint *height,
- gint *scroll_x, gint *scroll_y)
+ gint &width, gint &height,
+ gint &scroll_x, gint &scroll_y)
{
FlowerGroup *group;
GList *list;
{
FlowerGroup *group;
GList *list;
if (list)
{
auto pi = static_cast<PanItem *>(list->data);
if (list)
{
auto pi = static_cast<PanItem *>(list->data);
- *scroll_x = pi->x + pi->width / 2;
- *scroll_y = pi->y + pi->height / 2;
+ scroll_x = pi->x + pi->width / 2;
+ scroll_y = pi->y + pi->height / 2;
}
g_list_free(list);
}
static void pan_folder_tree_path(PanWindow *pw, FileData *dir_fd,
}
g_list_free(list);
}
static void pan_folder_tree_path(PanWindow *pw, FileData *dir_fd,
- gint *x, gint *y, gint *level,
- PanItem *parent,
- gint *width, gint *height)
+ gint &x, gint &y, gint level,
+ PanItem *parent,
+ gint &width, gint &height)
pan_filter_fd_list(&f, pw->filter_ui->filter_elements, pw->filter_ui->filter_classes);
pan_filter_fd_list(&f, pw->filter_ui->filter_elements, pw->filter_ui->filter_classes);
- *x = PAN_BOX_BORDER + ((*level) * MAX(PAN_BOX_BORDER, PAN_THUMB_GAP));
+ x = PAN_BOX_BORDER + (level * MAX(PAN_BOX_BORDER, PAN_THUMB_GAP));
- pi_box = pan_item_text_new(pw, *x, *y, dir_fd->path, PAN_TEXT_ATTR_NONE,
- PAN_BORDER_3,
- {PAN_TEXT_COLOR, 255});
+ pi_box = pan_item_text_new(pw, x, y, dir_fd->path, PAN_TEXT_ATTR_NONE,
+ PAN_BORDER_3,
+ {PAN_TEXT_COLOR, 255});
pi_box = pan_item_box_new(pw, file_data_ref(dir_fd),
pi_box = pan_item_box_new(pw, file_data_ref(dir_fd),
- *x, *y,
- PAN_BOX_BORDER, PAN_BOX_BORDER,
- PAN_BOX_OUTLINE_THICKNESS,
- {PAN_BOX_COLOR, PAN_BOX_ALPHA},
- {PAN_BOX_OUTLINE_COLOR, PAN_BOX_OUTLINE_ALPHA});
+ x, y,
+ PAN_BOX_BORDER, PAN_BOX_BORDER,
+ PAN_BOX_OUTLINE_THICKNESS,
+ {PAN_BOX_COLOR, PAN_BOX_ALPHA},
+ {PAN_BOX_OUTLINE_COLOR, PAN_BOX_OUTLINE_ALPHA});
- *x += PAN_BOX_BORDER;
- *y += PAN_BOX_BORDER;
+ x += PAN_BOX_BORDER;
+ y += PAN_BOX_BORDER;
if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE)
{
if (pw->size > PAN_IMAGE_SIZE_THUMB_LARGE)
{
- pi = pan_item_image_new(pw, fd, *x, *y, 10, 10);
- *x += pi->width + PAN_THUMB_GAP;
+ pi = pan_item_image_new(pw, fd, x, y, 10, 10);
+ x += pi->width + PAN_THUMB_GAP;
if (pi->height > y_height) y_height = pi->height;
}
else
{
if (pi->height > y_height) y_height = pi->height;
}
else
{
- pi = pan_item_thumb_new(pw, fd, *x, *y);
- *x += PAN_THUMB_SIZE + PAN_THUMB_GAP;
+ pi = pan_item_thumb_new(pw, fd, x, y);
+ x += PAN_THUMB_SIZE + PAN_THUMB_GAP;
y_height = PAN_THUMB_SIZE;
}
pan_item_size_by_item(pi_box, pi, PAN_BOX_BORDER);
}
y_height = PAN_THUMB_SIZE;
}
pan_item_size_by_item(pi_box, pi, PAN_BOX_BORDER);
}
- if (f) *y = pi_box->y + pi_box->height;
+ if (f) y = pi_box->y + pi_box->height;
if (!pan_is_ignored(fd->path, pw->ignore_symlinks))
{
if (!pan_is_ignored(fd->path, pw->ignore_symlinks))
{
- *level = *level + 1;
- pan_folder_tree_path(pw, fd, x, y, level, pi_box, width, height);
- *level = *level - 1;
+ pan_folder_tree_path(pw, fd, x, y, level + 1, pi_box, width, height);
pan_item_size_by_item(parent, pi_box, PAN_BOX_BORDER);
pan_item_size_by_item(parent, pi_box, PAN_BOX_BORDER);
- if (*y < pi_box->y + pi_box->height + PAN_BOX_BORDER)
- *y = pi_box->y + pi_box->height + PAN_BOX_BORDER;
+ y = std::max(y, pi_box->y + pi_box->height + PAN_BOX_BORDER);
pan_item_size_coordinates(pi_box, PAN_BOX_BORDER, width, height);
}
pan_item_size_coordinates(pi_box, PAN_BOX_BORDER, width, height);
}
-void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height)
+void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height)
- gint level;
- gint w;
- gint h;
x = PAN_BOX_BORDER;
y = PAN_BOX_BORDER;
x = PAN_BOX_BORDER;
y = PAN_BOX_BORDER;
- w = PAN_BOX_BORDER * 2;
- h = PAN_BOX_BORDER * 2;
-
- pan_folder_tree_path(pw, dir_fd, &x, &y, &level, nullptr, &w, &h);
+ width = PAN_BOX_BORDER * 2;
+ height = PAN_BOX_BORDER * 2;
- if (width) *width = w;
- if (height) *height = h;
+ pan_folder_tree_path(pw, dir_fd, x, y, 0, nullptr, width, height);
}
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
}
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */
struct PanWindow;
void pan_flower_compute(PanWindow *pw, FileData *dir_fd,
struct PanWindow;
void pan_flower_compute(PanWindow *pw, FileData *dir_fd,
- gint *width, gint *height,
- gint *scroll_x, gint *scroll_y);
-void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
+ gint &width, gint &height,
+ gint &scroll_x, gint &scroll_y);
+void pan_folder_tree_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height);
#include "pan-view-filter.h"
#include "typedefs.h"
#include "pan-view-filter.h"
#include "typedefs.h"
-void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height)
+void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height)
{
GList *list;
GList *work;
{
GList *list;
GList *work;
- *width = PAN_BOX_BORDER * 2;
- *height = PAN_BOX_BORDER * 2;
+ width = PAN_BOX_BORDER * 2;
+ height = PAN_BOX_BORDER * 2;
x = PAN_THUMB_GAP;
y = PAN_THUMB_GAP;
x = PAN_THUMB_GAP;
y = PAN_THUMB_GAP;
struct FileData;
struct PanWindow;
struct FileData;
struct PanWindow;
-void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
+void pan_grid_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height);
#include <cstring>
#include <glib-object.h>
#include <cstring>
#include <glib-object.h>
pi->height = child->y + child->height + border - pi->y;
}
pi->height = child->y + child->height + border - pi->y;
}
-void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h)
+void pan_item_size_coordinates(PanItem *pi, gint border, gint &w, gint &h)
- if (*w < pi->x + pi->width + border) *w = pi->x + pi->width + border;
- if (*h < pi->y + pi->height + border) *h = pi->y + pi->height + border;
+ w = std::max(w, pi->x + pi->width + border);
+ h = std::max(h, pi->y + pi->height + border);
// Determine sizes
void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border);
// Determine sizes
void pan_item_size_by_item(PanItem *pi, PanItem *child, gint border);
-void pan_item_size_coordinates(PanItem *pi, gint border, gint *w, gint *h);
+void pan_item_size_coordinates(PanItem *pi, gint border, gint &w, gint &h);
// Find items
PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key);
// Find items
PanItem *pan_item_find_by_key(PanWindow *pw, PanItemType type, const gchar *key);
-void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height)
+void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height)
{
GList *list;
GList *work;
{
GList *list;
GList *work;
pw->cache_list = pan_cache_sort(pw->cache_list, SORT_TIME, TRUE, TRUE);
list = filelist_sort(list, SORT_TIME, TRUE, TRUE);
pw->cache_list = pan_cache_sort(pw->cache_list, SORT_TIME, TRUE, TRUE);
list = filelist_sort(list, SORT_TIME, TRUE, TRUE);
- *width = PAN_BOX_BORDER * 2;
- *height = PAN_BOX_BORDER * 2;
+ width = PAN_BOX_BORDER * 2;
+ height = PAN_BOX_BORDER * 2;
struct FileData;
struct PanWindow;
struct FileData;
struct PanWindow;
-void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint *width, gint *height);
+void pan_timeline_compute(PanWindow *pw, FileData *dir_fd, gint &width, gint &height);
*/
static void pan_layout_compute(PanWindow *pw, FileData *dir_fd,
*/
static void pan_layout_compute(PanWindow *pw, FileData *dir_fd,
- gint *width, gint *height,
- gint *scroll_x, gint *scroll_y)
+ gint &width, gint &height,
+ gint &scroll_x, gint &scroll_y)
{
pan_window_items_free(pw);
{
pan_window_items_free(pw);
- *width = 0;
- *height = 0;
- *scroll_x = 0;
- *scroll_y = 0;
+ width = 0;
+ height = 0;
+ scroll_x = 0;
+ scroll_y = 0;
- pan_layout_compute(pw, pw->dir_fd, &width, &height, &scroll_x, &scroll_y);
+ pan_layout_compute(pw, pw->dir_fd, width, height, scroll_x, scroll_y);
pan_window_zoom_limit(pw);
pan_window_zoom_limit(pw);